user2525905
user2525905

Reputation: 3

Receiving "Name [jdbc/WorklightDS] is not bound in this Context. Unable to find [jdbc]" errors after manual Install

We are trying to install worklight 5.06 enterprise manually on our server with one DB (worklight), on Tomcat 7 on Rhel Linux. We ran the create-worklight-oracle.sql script, and have followed the instructions on http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m6/index.jsp?topic=%2Fcom.ibm.worklight.help.doc%2Fadmin%2Fc_installation.html

but are still running into some issues. Specifically it appears we're having an issue with our config files for tomcat to talk to the worklight DB:

SEVERE: com.worklight.server.bundle.project.messages:logger.projectStartFailed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in URL [jar:file:/usr/share/java/tomcat7/worklight-jee-library.jar!/conf/core.xml]: Cannot resolve reference to bean 'brokerSessionFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerSessionFactory' defined in URL [jar:file:/usr/share/java/tomcat7/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'rssBrokerDS' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean
 with name 'rssBrokerDS' defined in URL [jar:file:/usr/share/java/tomcat7/worklight-jee-library.jar!/conf/spring-server-core.xml]: Cannot resolve reference to bean 'worklight-direct' while setting bean property 'targetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'worklight-direct' defined in URL [jar:file:/usr/share/java/tomcat7/worklight-jee-library.jar!/conf/spring-server-core.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/WorklightDS] is not bound in this Context. Unable to find [jdbc].
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

Probably something stupid wrong, I've done the following for the database config: added following to our worklight.properties in the exploded worklight.war: uncommented these lines:

wl.db.type=ORACLE
wl.db.url=jdbc:oracle:thin:@//DBSERVER:1521/SERVICE_NAME <-- changed from our internal names
wl.db.username=worklight
wl.db.password=worklight

Added the following to the context.xml for tomcat in the stanza;

<Resource name="jdbc/WorklightDS"
auth="Container"
type="javax.sql.DataSource"
username="worklight"
password="worklight"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@//DBSERVER:1521/SERVICE_NAME"/>

Added the following to the web.xml at the end of the file (before the /web-app> end tag):

<resource-ref>
    <res-ref-name>jdbc/WorklightDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

Possible Solution: Issue was with using the JNDI connection - using jdbc connection alone works fine.

Upvotes: 0

Views: 6350

Answers (1)

Eric Wang
Eric Wang

Reputation: 109

For Worklight 506 on tomcat 7, here's a sample configuration for you:

Set JDBC Data Source in tomcat 7 server.xml (in < host> section)

<Context docBase="worklight" path="/worklight">
<Resource auth="Container"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    maxActive="80"
    maxIdle="4"
    maxWait="5000"
    name="jdbc/WorkLightDS"
    password="worklight"
    type="javax.sql.DataSource"
    url="jdbc:oracle:thin:@//DBSERVER:1521/SERVICE_NAME"
    username="worklight"/>
</Context>

In worklight.propertis, set below two line:

wl.db.type=ORACLE
wl.db.jndi.name=java:comp/env/jdbc/WorkLightDS

Upvotes: 2

Related Questions