NameNotFoundException: Name openejb is not bound in this Context

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

NameNotFoundException: Name openejb is not bound in this Context

Alexander Saint Croix-2
Hello,

I'm having some trouble wiring my app's persistence.xml to the Resource
defined in the openejb.xml conf file.

First, here's the error:

<openjpa-1.0.0-r420667:568756 nonfatal general error>

> org.apache.openjpa.persistence.PersistenceException: There were errors
> initializing your configuration:
> org.apache.commons.lang.exception.NestableRuntimeException: There was an
> error duing JNDI lookup of the name "java:openejb/Resource/myDataSource".
> at org.apache.openjpa.lib.conf.Configurations.lookup(Configurations.java
> :583)
> at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.lookupConnectionFactory(
> OpenJPAConfigurationImpl.java:962)
> at org.apache.openjpa.conf.OpenJPAConfigurationImpl.getConnectionFactory(
> OpenJPAConfigurationImpl.java:950)
> at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory
> (JDBCConfigurationImpl.java:801)
> at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory
> (JDBCConfigurationImpl.java:708)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(
> ConfigurationImpl.java:289)
> at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(
> OpenJPAConfigurationImpl.java:1459)
> at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(
> AbstractBrokerFactory.java:636)
> at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(
> AbstractBrokerFactory.java:169)
> at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
> DelegatingBrokerFactory.java:142)
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
> (EntityManagerFactoryImpl.java:192)
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
> (EntityManagerFactoryImpl.java:145)
> at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
> (EntityManagerFactoryImpl.java:56)
> at org.eremite.HelloServlet.doGet(HelloServlet.java:61)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:290)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:206)
> at org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:233)
> at org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:175)
> at org.apache.catalina.core.StandardHostValve.invoke(
> StandardHostValve.java:128)
> at org.apache.catalina.valves.ErrorReportValve.invoke(
> ErrorReportValve.java:102)
> at org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:109)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> :263)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> :844)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process
> (Http11Protocol.java:584)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:613)
> Caused by: javax.naming.NameNotFoundException: Name openejb is not bound
> in this Context
> at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
> at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
> at javax.naming.InitialContext.lookup(InitialContext.java:351)
> at org.apache.openjpa.lib.conf.Configurations.lookup(Configurations.java
> :581)
> ... 31 more
>

Second, the relevant parts of the persistence.xml:


   <persistence-unit name="example" transaction-type="RESOURCE_LOCAL">

>
>        <jta-data-source>
>            java:openejb/Resource/myDataSource
>        </jta-data-source>
>
>        <non-jta-data-source>
>            java:openejb/Resource/myNonJtaDataSource
>        </non-jta-data-source>
>    ...
>    </persistence-unit>
>

Third, the relevant parts of the openejeb.xml conf doc:

<Resource id="myDataSource" type="DataSource">

>    JdbcDriver  = com.mysql.jdbc.Driver
>    JdbcUrl     = jdbc:mysql://localhost/corm
>    UserName    = root
>    Password    = pw
> </Resource>
>
> <Resource id="myNonJtaDataSource" type="DataSource"
>          provider="Default Unmanaged JDBC Database">
>    JdbcDriver  = com.mysql.jdbc.Driver
>    JdbcUrl     = jdbc:mysql://localhost/corm
>    UserName    = root
>    Password    = pw
> </Resource>


Any ideas?
--
Alexander
Reply | Threaded
Open this post in threaded view
|

Re: NameNotFoundException: Name openejb is not bound in this Context

dblevins
Administrator
Think I might have this fixed.  Testing now.

-David

On Dec 17, 2007, at 7:40 PM, Alexander Saint Croix wrote:

> Hello,
>
> I'm having some trouble wiring my app's persistence.xml to the  
> Resource
> defined in the openejb.xml conf file.
>
> First, here's the error:
>
> <openjpa-1.0.0-r420667:568756 nonfatal general error>
>> org.apache.openjpa.persistence.PersistenceException: There were  
>> errors
>> initializing your configuration:
>> org.apache.commons.lang.exception.NestableRuntimeException: There  
>> was an
>> error duing JNDI lookup of the name "java:openejb/Resource/
>> myDataSource".
>> at  
>> org.apache.openjpa.lib.conf.Configurations.lookup(Configurations.java
>> :583)
>> at
>> org
>> .apache
>> .openjpa.conf.OpenJPAConfigurationImpl.lookupConnectionFactory(
>> OpenJPAConfigurationImpl.java:962)
>> at  
>> org
>> .apache.openjpa.conf.OpenJPAConfigurationImpl.getConnectionFactory(
>> OpenJPAConfigurationImpl.java:950)
>> at
>> org
>> .apache
>> .openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory
>> (JDBCConfigurationImpl.java:801)
>> at  
>> org
>> .apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory
>> (JDBCConfigurationImpl.java:708)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:39)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(
>> ConfigurationImpl.java:289)
>> at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(
>> OpenJPAConfigurationImpl.java:1459)
>> at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(
>> AbstractBrokerFactory.java:636)
>> at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(
>> AbstractBrokerFactory.java:169)
>> at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
>> DelegatingBrokerFactory.java:142)
>> at
>> org
>> .apache
>> .openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
>> (EntityManagerFactoryImpl.java:192)
>> at
>> org
>> .apache
>> .openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
>> (EntityManagerFactoryImpl.java:145)
>> at
>> org
>> .apache
>> .openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
>> (EntityManagerFactoryImpl.java:56)
>> at org.eremite.HelloServlet.doGet(HelloServlet.java:61)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>> ApplicationFilterChain.java:290)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>> ApplicationFilterChain.java:206)
>> at org.apache.catalina.core.StandardWrapperValve.invoke(
>> StandardWrapperValve.java:233)
>> at org.apache.catalina.core.StandardContextValve.invoke(
>> StandardContextValve.java:175)
>> at org.apache.catalina.core.StandardHostValve.invoke(
>> StandardHostValve.java:128)
>> at org.apache.catalina.valves.ErrorReportValve.invoke(
>> ErrorReportValve.java:102)
>> at org.apache.catalina.core.StandardEngineValve.invoke(
>> StandardEngineValve.java:109)
>> at  
>> org
>> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
>> :263)
>> at  
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
>> :844)
>> at org.apache.coyote.http11.Http11Protocol
>> $Http11ConnectionHandler.process
>> (Http11Protocol.java:584)
>> at org.apache.tomcat.util.net.JIoEndpoint
>> $Worker.run(JIoEndpoint.java:447)
>> at java.lang.Thread.run(Thread.java:613)
>> Caused by: javax.naming.NameNotFoundException: Name openejb is not  
>> bound
>> in this Context
>> at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>> at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>> at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
>> at javax.naming.InitialContext.lookup(InitialContext.java:351)
>> at  
>> org.apache.openjpa.lib.conf.Configurations.lookup(Configurations.java
>> :581)
>> ... 31 more
>>
>
> Second, the relevant parts of the persistence.xml:
>
>
>   <persistence-unit name="example" transaction-type="RESOURCE_LOCAL">
>>
>>       <jta-data-source>
>>           java:openejb/Resource/myDataSource
>>       </jta-data-source>
>>
>>       <non-jta-data-source>
>>           java:openejb/Resource/myNonJtaDataSource
>>       </non-jta-data-source>
>>   ...
>>   </persistence-unit>
>>
>
> Third, the relevant parts of the openejeb.xml conf doc:
>
> <Resource id="myDataSource" type="DataSource">
>>   JdbcDriver  = com.mysql.jdbc.Driver
>>   JdbcUrl     = jdbc:mysql://localhost/corm
>>   UserName    = root
>>   Password    = pw
>> </Resource>
>>
>> <Resource id="myNonJtaDataSource" type="DataSource"
>>         provider="Default Unmanaged JDBC Database">
>>   JdbcDriver  = com.mysql.jdbc.Driver
>>   JdbcUrl     = jdbc:mysql://localhost/corm
>>   UserName    = root
>>   Password    = pw
>> </Resource>
>
>
> Any ideas?
> --
> Alexander

Reply | Threaded
Open this post in threaded view
|

Re: NameNotFoundException: Name openejb is not bound in this Context

dblevins
Administrator
Ok.  Yank the openejb.war you have now and give this one a try.  Best  
do that while tomcat is shutdown.

http://people.apache.org/~dblevins/openejb-tomcat-3.0.0-SNAPSHOT.war

The "java:openejb/Resource/myDataSource" reference should resolve.

-David


On Dec 19, 2007, at 5:11 PM, David Blevins wrote:

> Think I might have this fixed.  Testing now.
>
> -David
>
> On Dec 17, 2007, at 7:40 PM, Alexander Saint Croix wrote:
>
>> Hello,
>>
>> I'm having some trouble wiring my app's persistence.xml to the  
>> Resource
>> defined in the openejb.xml conf file.
>>
>> First, here's the error:
>>
>> <openjpa-1.0.0-r420667:568756 nonfatal general error>
>>> org.apache.openjpa.persistence.PersistenceException: There were  
>>> errors
>>> initializing your configuration:
>>> org.apache.commons.lang.exception.NestableRuntimeException: There  
>>> was an
>>> error duing JNDI lookup of the name "java:openejb/Resource/
>>> myDataSource".
>>> at  
>>> org
>>> .apache.openjpa.lib.conf.Configurations.lookup(Configurations.java
>>> :583)
>>> at
>>> org
>>> .apache
>>> .openjpa.conf.OpenJPAConfigurationImpl.lookupConnectionFactory(
>>> OpenJPAConfigurationImpl.java:962)
>>> at  
>>> org
>>> .apache.openjpa.conf.OpenJPAConfigurationImpl.getConnectionFactory(
>>> OpenJPAConfigurationImpl.java:950)
>>> at
>>> org
>>> .apache
>>> .openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory
>>> (JDBCConfigurationImpl.java:801)
>>> at  
>>> org
>>> .apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory
>>> (JDBCConfigurationImpl.java:708)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(
>>> NativeMethodAccessorImpl.java:39)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>> DelegatingMethodAccessorImpl.java:25)
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>> at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(
>>> ConfigurationImpl.java:289)
>>> at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(
>>> OpenJPAConfigurationImpl.java:1459)
>>> at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(
>>> AbstractBrokerFactory.java:636)
>>> at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(
>>> AbstractBrokerFactory.java:169)
>>> at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
>>> DelegatingBrokerFactory.java:142)
>>> at
>>> org
>>> .apache
>>> .openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
>>> (EntityManagerFactoryImpl.java:192)
>>> at
>>> org
>>> .apache
>>> .openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
>>> (EntityManagerFactoryImpl.java:145)
>>> at
>>> org
>>> .apache
>>> .openjpa.persistence.EntityManagerFactoryImpl.createEntityManager
>>> (EntityManagerFactoryImpl.java:56)
>>> at org.eremite.HelloServlet.doGet(HelloServlet.java:61)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
>>> ApplicationFilterChain.java:290)
>>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(
>>> ApplicationFilterChain.java:206)
>>> at org.apache.catalina.core.StandardWrapperValve.invoke(
>>> StandardWrapperValve.java:233)
>>> at org.apache.catalina.core.StandardContextValve.invoke(
>>> StandardContextValve.java:175)
>>> at org.apache.catalina.core.StandardHostValve.invoke(
>>> StandardHostValve.java:128)
>>> at org.apache.catalina.valves.ErrorReportValve.invoke(
>>> ErrorReportValve.java:102)
>>> at org.apache.catalina.core.StandardEngineValve.invoke(
>>> StandardEngineValve.java:109)
>>> at  
>>> org
>>> .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
>>> :263)
>>> at  
>>> org
>>> .apache.coyote.http11.Http11Processor.process(Http11Processor.java
>>> :844)
>>> at org.apache.coyote.http11.Http11Protocol
>>> $Http11ConnectionHandler.process
>>> (Http11Protocol.java:584)
>>> at org.apache.tomcat.util.net.JIoEndpoint
>>> $Worker.run(JIoEndpoint.java:447)
>>> at java.lang.Thread.run(Thread.java:613)
>>> Caused by: javax.naming.NameNotFoundException: Name openejb is not  
>>> bound
>>> in this Context
>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>>> at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
>>> at org.apache.naming.SelectorContext.lookup(SelectorContext.java:
>>> 137)
>>> at javax.naming.InitialContext.lookup(InitialContext.java:351)
>>> at  
>>> org
>>> .apache.openjpa.lib.conf.Configurations.lookup(Configurations.java
>>> :581)
>>> ... 31 more
>>>
>>
>> Second, the relevant parts of the persistence.xml:
>>
>>
>>  <persistence-unit name="example" transaction-type="RESOURCE_LOCAL">
>>>
>>>      <jta-data-source>
>>>          java:openejb/Resource/myDataSource
>>>      </jta-data-source>
>>>
>>>      <non-jta-data-source>
>>>          java:openejb/Resource/myNonJtaDataSource
>>>      </non-jta-data-source>
>>>  ...
>>>  </persistence-unit>
>>>
>>
>> Third, the relevant parts of the openejeb.xml conf doc:
>>
>> <Resource id="myDataSource" type="DataSource">
>>>  JdbcDriver  = com.mysql.jdbc.Driver
>>>  JdbcUrl     = jdbc:mysql://localhost/corm
>>>  UserName    = root
>>>  Password    = pw
>>> </Resource>
>>>
>>> <Resource id="myNonJtaDataSource" type="DataSource"
>>>        provider="Default Unmanaged JDBC Database">
>>>  JdbcDriver  = com.mysql.jdbc.Driver
>>>  JdbcUrl     = jdbc:mysql://localhost/corm
>>>  UserName    = root
>>>  Password    = pw
>>> </Resource>
>>
>>
>> Any ideas?
>> --
>> Alexander
>
>