You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by klewelling <kl...@gmail.com> on 2008/04/01 02:24:47 UTC

Re: Tomcat - Injection: No such property

I am having the same problem with Jetty. I am using the maven jetty:run
plugin and when I put my SSBs in a separate EJB jar openEJB starts up fine.
The EJBs are loaded correctly and I can get the local interface from JNDI,
however when I call any method I get a NPE because nothing is injected. When
I take the SSBs and place them in my WAR project everything works fine. 

I am going to create an example app that demonstrates this problem. If
someone could let me know where to upload it I would appreciate it.

Here is the output of the failed run:

[INFO] Starting jetty 6.1.6 ...
2008-03-31 19:22:58.839::INFO:  jetty-6.1.6
Apache OpenEJB 3.0-SNAPSHOT    build: 20080311-01:28
http://openejb.apache.org/
INFO - openejb.home =
/home/klewelling/Documents/development/java-examples/tech-preview/Struts-WAR
INFO - openejb.base =
/home/klewelling/Documents/development/java-examples/tech-preview/Struts-WAR
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=techPreviewUnmanaged, type=Resource,
provider-id=Default JDBC Database)
INFO - Configuring Service(id=techPreview, type=Resource,
provider-id=Default JDBC Database)
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
INFO - Found EjbModule in classpath:
/home/klewelling/.m2/repository/com/etcc/example/EJB/1.0/EJB-1.0.jar
INFO - Configuring app:
/home/klewelling/.m2/repository/com/etcc/example/EJB/1.0/EJB-1.0.jar
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean UnitTestHelperBean:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Configuring PersistenceUnit(name=DefaultPU,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Loaded Module:
/home/klewelling/.m2/repository/com/etcc/example/EJB/1.0/EJB-1.0.jar
INFO - Assembling app:
/home/klewelling/.m2/repository/com/etcc/example/EJB/1.0/EJB-1.0.jar
INFO - PersistenceUnit(name=DefaultPU,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Jndi(name=UnitTestHelperBeanLocal) -->
Ejb(deployment-id=UnitTestHelperBean)
INFO - Jndi(name=UserOperationsBeanLocal) -->
Ejb(deployment-id=UserOperationsBean)
INFO - Jndi(name=AuthenticationOperationsBeanLocal) -->
Ejb(deployment-id=AuthenticationOperationsBean)
INFO - Jndi(name=DatabaseSetupBeanLocal) -->
Ejb(deployment-id=DatabaseSetupBean)
INFO - Created Ejb(deployment-id=UnitTestHelperBean,
ejb-name=UnitTestHelperBean, container=Default Stateless Container)
INFO - Created Ejb(deployment-id=UserOperationsBean,
ejb-name=UserOperationsBean, container=Default Stateless Container)
INFO - Created Ejb(deployment-id=AuthenticationOperationsBean,
ejb-name=AuthenticationOperationsBean, container=Default Stateless
Container)
INFO - Created Ejb(deployment-id=DatabaseSetupBean,
ejb-name=DatabaseSetupBean, container=Default Stateless Container)
INFO - Deployed
Application(path=/home/klewelling/.m2/repository/com/etcc/example/EJB/1.0/EJB-1.0.jar)
INFO - OpenEJB ready.
OpenEJB ready.
2008-03-31 19:23:02.901::INFO:  No Transaction manager found - if your
webapp requires one, please configure one.
WARN - Injection: No such property
'com.etcc.example.ejb.util.DatabaseSetupBean/em' in class
com.etcc.example.ejb.util.DatabaseSetupBean
2008-03-31 19:23:03.437::WARN:  failed StartupServlet
javax.servlet.ServletException: The bean encountered a non-application
exception.; nested exception is:
        java.lang.NullPointerException
        at
org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:437)
        at
org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
        at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:612)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
        at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1216)
        at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:509)
        at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:447)
        at
org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:110)
        at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
        at
org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
        at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:147)
        at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
        at org.mortbay.jetty.Server.doStart(Server.java:222)
        at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
        at
org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
        at
org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:337)
        at
org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:279)
        at
org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:203)
        at
org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:182)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:420)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:330)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:123)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
        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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at
org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

Thanks
Kenneth



ebaxt wrote:
> 
> I'm trying to run my application with Tomcat+openEJB, but I can't figure
> out why the EntityManager isn't injected correctly into the EAO
> sessionbean.
> My war file is packed with the ejb.jar in \WEB-INF\lib. 
> 
> The client is able to lookup the facade, but when the facade delegates the
> EntityManager actions to the EAO a null pointer exception is thrown. 
> 
> Here's the log.
> 
> INFO  - PersistenceUnit(name=sp2k,
> provider=org.apache.openjpa.persistence.PersistenceProviderImpl)
> INFO  - Jndi(name=TaxaEAOBeanLocal) --> Ejb(deployment-id=TaxaEAOBean)
> INFO  - Jndi(name=Sp2kServiceBeanRemote) -->
> Ejb(deployment-id=Sp2kServiceBean)
> INFO  - Created Ejb(deployment-id=TaxaEAOBean, ejb-name=TaxaEAOBean,
> container=My Stateless Container)
> INFO  - Created Ejb(deployment-id=Sp2kServiceBean,
> ejb-name=Sp2kServiceBean, container=My Stateless Container)
> INFO  - Deployed
> Application(path=F:\tomcat\apache-tomcat-6.0.16\webapps\fddb-war-1.0-SNAPSHOT)
> WARN  - Injection: No such property
> 'no.uib.gyro.domain.classification.TaxaEAOBean/em' in class
> no.uib.gyro.domain.classification.TaxaEAOBean
> WARN  - Injection: No such property
> 'no.uib.gyro.domain.classification.TaxaEAOBean/em' in class
> no.uib.gyro.domain.classification.TaxaEAOBean
> 
> The @PersistenceContext annotation is inside the TaxaEAOBean, so it's not
> past to the EAO from the facade.
> 
> The strange thing is that when I put the EJB's in the war archive, it all
> works fine. Is there a difference to openEJB between adding ejb.jar in
> WEB-INF\lib or to put the beans directly in the WEB-INF\classes?
> 
> Thanks.
> 
> -Erik
> 

-- 
View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16401174.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Tomcat - Injection: No such property

Posted by David Blevins <da...@visi.com>.
On Apr 1, 2008, at 12:14 PM, klewelling wrote:
>
> FYI I got the injection to work. When I was putting together a  
> demonstration
> the injection started working. The problem has to do with  
> dependencies in
> the pom.xml. I am not sure if there was something extra causing the  
> problem
> or perhaps the order of the jars in the classpath. I am uploading an  
> example
>
> http://www.nabble.com/file/p16421933/injection-example.zip
> injection-example.zip
>
> By the way this example demonstrations embedding openEJB in Jetty. The
> important piece of the puzzle is in the WAR/pom.xml:
>
> <plugin>
>    <groupId>org.mortbay.jetty</groupId>
> 	<artifactId>maven-jetty-plugin</artifactId>
> 	<configuration>
> 		<scanIntervalSeconds>5</scanIntervalSeconds>
> 		<contextPath>/example</contextPath>
> 		<systemProperties>
> 			<systemProperty>
> 				<name>java.naming.factory.initial</name>
> 				<value>org.apache.openejb.client.LocalInitialContextFactory</ 
> value>
> 			</systemProperty>
> 			<systemProperty>
> 				<name>java.naming.factory.url.pkgs</name>
> 				<value>org.mortbay.naming</value>
> 			</systemProperty>
> 		</systemProperties>
> 	</configuration>
> 	<dependencies>
> 	</dependencies>
> </plugin>
>
>
> The system property "java.naming.factory.url.pkgs" is the key. From  
> what I
> can tell openEJB's IvmContext will attempt to do JNDI lookups and if  
> it
> fails will look for additional ObjectFactories and delegate to them.  
> By
> adding the "org.morbay.naming" system property IvmContext finds the  
> Jetty
> JNDI context. Without this setting the jetty plugin will fail with the
> error: "javax.naming.NameNotFoundException: Name "java:comp" not  
> found."
>
> It took me a while to figure this out so it may be useful to add to  
> the
> openEJB docs.

This is great, thank you!  We'll definitely get this into the docs.

-David


Re: Tomcat - Injection: No such property

Posted by JensToerber <je...@juwimm.com>.
Hi David,

i interpreted your answer as there should not be a problem with Spring.
Hence thanks for the hint ;-).
So i took my test web application and tried to get Spring 2.5.1 running with
JndiObjectFactoryBean and it worked.
Hence i looked in our production application and i am sorry we had a
packaging problem. We were still delivering ejb3-persistence-<version>.jar
of Hibernate and jta-<version>.jar. But these two are provided by JBoss
(uses Hibernate as JPA provider) and/or Openejb (openejb-core, openejb-jee).
Simple, bad mistake, but i hope it helps anyone else facing a similar "no
such property" injection problem.

In our situation it makes no difference if i use the lookupOnStartup="false"
with the proxy interfaces or lookupOnStartup="true" (default) without proxy
interfaces. Both configurations work as expected.

Thanks for the help.
Best regards,

Jens

David Blevins wrote:
> 
> 
> On Jan 31, 2009, at 2:49 AM, JensToerber wrote:
> 
>>
>> Hi,
>>
>> i am facing the same problem in Tomcat 6.0.18. EntityManager does  
>> not get
>> injected: "no such property".
>> Openejb 3.1 works in a test application with EJB-, EntityManager-,
>> DataSource-, javax.Mail.Session-, Queue-injection.
>>
>> Now i have the situation to port an existing application which uses  
>> Spring's
>> org.springframework.jndi.JndiObjectFactoryBean for looking up EJBs.
>>
>> Ok we could replace that by a ServiceLocator or of course the
>> EJB3-Injection. But to minimize the effort it would be great to get  
>> this
>> scenario running.
>>
>> I have the impression that Spring changes something regarding JNDI,  
>> where
>> then Openejb and/or Tomcat have problems.
>>
>> How about this:
>> - 
>> Djava 
>> .naming 
>> .factory.initial=org.apache.openejb.client.LocalInitialContextFactory
>> -Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX
>>
>> What should work? This as system properties on startup of Tomcat?
>> - 
>> Djava 
>> .naming 
>> .factory.initial=org.apache.openejb.client.LocalInitialContextFactory
>> -Djava.naming.factory.url.pkgs=org.apache.naming.factory
>>
>> Don't get the complete idea here, i am sorry.
> 
> Seems this thread is getting a little overloaded to the point of being  
> misleading.
> 
> The Jetty-specific suggestion of setting the  
> java.naming.factory.initial and java.naming.factory.url as system  
> properties should not be done in Tomcat as it will cause failures.   
> Our integration expects to live inside of Tomcat's JNDI tree and we  
> have a lot of code that adds entries to the Tomcat tree so it should  
> contain everything that is required to run the app, including any  
> @PersistenceContext, @PersistenceUnit, @Resource, @EJB refs.
> 
> Can you give a code example of what you are attempting that doesn't  
> seem to be working?
> 
> I don't know if this helps anyone on the thread, but here's a servlet  
> that has injected one of every kind of resource[1].  We have  
> equivalents test for each ejb type that run in tomcat as well.
> 
> I suspect we could use a bunch more webapp examples.
> 
> -David
> 
> 
> [1]
> http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/itests/openejb-itests-servlets/src/main/java/org/apache/openejb/test/servlet/AnnotatedServlet.java
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p21952124.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Tomcat - Injection: No such property

Posted by David Blevins <da...@visi.com>.
On Jan 31, 2009, at 2:49 AM, JensToerber wrote:

>
> Hi,
>
> i am facing the same problem in Tomcat 6.0.18. EntityManager does  
> not get
> injected: "no such property".
> Openejb 3.1 works in a test application with EJB-, EntityManager-,
> DataSource-, javax.Mail.Session-, Queue-injection.
>
> Now i have the situation to port an existing application which uses  
> Spring's
> org.springframework.jndi.JndiObjectFactoryBean for looking up EJBs.
>
> Ok we could replace that by a ServiceLocator or of course the
> EJB3-Injection. But to minimize the effort it would be great to get  
> this
> scenario running.
>
> I have the impression that Spring changes something regarding JNDI,  
> where
> then Openejb and/or Tomcat have problems.
>
> How about this:
> - 
> Djava 
> .naming 
> .factory.initial=org.apache.openejb.client.LocalInitialContextFactory
> -Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX
>
> What should work? This as system properties on startup of Tomcat?
> - 
> Djava 
> .naming 
> .factory.initial=org.apache.openejb.client.LocalInitialContextFactory
> -Djava.naming.factory.url.pkgs=org.apache.naming.factory
>
> Don't get the complete idea here, i am sorry.

Seems this thread is getting a little overloaded to the point of being  
misleading.

The Jetty-specific suggestion of setting the  
java.naming.factory.initial and java.naming.factory.url as system  
properties should not be done in Tomcat as it will cause failures.   
Our integration expects to live inside of Tomcat's JNDI tree and we  
have a lot of code that adds entries to the Tomcat tree so it should  
contain everything that is required to run the app, including any  
@PersistenceContext, @PersistenceUnit, @Resource, @EJB refs.

Can you give a code example of what you are attempting that doesn't  
seem to be working?

I don't know if this helps anyone on the thread, but here's a servlet  
that has injected one of every kind of resource[1].  We have  
equivalents test for each ejb type that run in tomcat as well.

I suspect we could use a bunch more webapp examples.

-David


[1] http://svn.apache.org/repos/asf/openejb/tags/openejb-3.1/itests/openejb-itests-servlets/src/main/java/org/apache/openejb/test/servlet/AnnotatedServlet.java


Re: Tomcat - Injection: No such property

Posted by JensToerber <je...@juwimm.com>.
Hi,

i am facing the same problem in Tomcat 6.0.18. EntityManager does not get
injected: "no such property".
Openejb 3.1 works in a test application with EJB-, EntityManager-,
DataSource-, javax.Mail.Session-, Queue-injection.

Now i have the situation to port an existing application which uses Spring's
org.springframework.jndi.JndiObjectFactoryBean for looking up EJBs.

Ok we could replace that by a ServiceLocator or of course the
EJB3-Injection. But to minimize the effort it would be great to get this
scenario running.

I have the impression that Spring changes something regarding JNDI, where
then Openejb and/or Tomcat have problems.

How about this:
-Djava.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory
-Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX

What should work? This as system properties on startup of Tomcat?
-Djava.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory
-Djava.naming.factory.url.pkgs=org.apache.naming.factory

Don't get the complete idea here, i am sorry.

Any help appreciated.

Thanks in advance.

Best regards,

Jens


David Blevins wrote:
> 
> 
> On Apr 2, 2008, at 3:30 PM, klewelling wrote:
>>
>>
>> You may want to try setting the properties as system properties,  
>> i.e. java
>> ...
>> - 
>> Djava 
>> .naming 
>> .factory.initial=org.apache.openejb.client.LocalInitialContextFactory
>> -Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX
>>
>> or something like that. I think it may be important that openEJB's
>> initialContext is the first to start up rather than tomcats. If I  
>> have some
>> free time I can try to get my setup working with tomcat.
> 
> That's definitely true of most third-party JNDI implementations; i.e.  
> we should be first as we will delegate to them, whereas they usually  
> won't delegate to us.  But for Tomcat specifically, we have some code  
> that exports all of our JNDI entries into Tomcat so that there only  
> needs to be one JNDI impl controlling the show -- Tomcat's.
> 
> Not sure why the EntityManager isn't getting picked up with the beans  
> in WEB-INF/lib/ vs WEB-INF/classes/.  We did add some very detailed  
> logging around the resolution of EntityManager references specifically  
> since 3.0-beta-2 that might help (in the new openejb.war i just put  
> up).  Hopefully there'll be something in the log that might illuminate  
> what's going on.
> 
> -David
> 
>> ebaxt wrote:
>>>
>>> Thank you Kenneth!
>>>
>>> I have tried to set the properties you talked about, but I don't  
>>> really
>>> know how to configure it to lookup Tomcat's JNDI context.
>>>
>>> I have tried this with no luck:
>>>
>>>        Properties p = new Properties();
>>>        p.put(Context.INITIAL_CONTEXT_FACTORY,
>>> "org.apache.openejb.client.LocalInitialContextFactory");
>>>        p.put(Context.URL_PKG_PREFIXES,  
>>> "org.apache.naming.factory.XXX");
>>>
>>> Do you know how to configure this correctly?
>>>
>>> Erik
>>>
>>>
>>> klewelling wrote:
>>>>
>>>> FYI I got the injection to work. When I was putting together a
>>>> demonstration the injection started working. The problem has to do  
>>>> with
>>>> dependencies in the pom.xml. I am not sure if there was something  
>>>> extra
>>>> causing the problem or perhaps the order of the jars in the  
>>>> classpath. I
>>>> am uploading an example
>>>>
>>>> http://www.nabble.com/file/p16421933/injection-example.zip
>>>> injection-example.zip
>>>>
>>>> By the way this example demonstrations embedding openEJB in Jetty.  
>>>> The
>>>> important piece of the puzzle is in the WAR/pom.xml:
>>>>
>>>> <plugin>
>>>>    <groupId>org.mortbay.jetty</groupId>
>>>> 	<artifactId>maven-jetty-plugin</artifactId>
>>>> 	<configuration>
>>>> 		<scanIntervalSeconds>5</scanIntervalSeconds>
>>>> 		<contextPath>/example</contextPath>
>>>> 		<systemProperties>
>>>> 			<systemProperty>
>>>> 				<name>java.naming.factory.initial</name>
>>>> 				<value>org.apache.openejb.client.LocalInitialContextFactory</ 
>>>> value>
>>>> 			</systemProperty>
>>>> 			<systemProperty>
>>>> 				<name>java.naming.factory.url.pkgs</name>
>>>> 				<value>org.mortbay.naming</value>
>>>> 			</systemProperty>
>>>> 		</systemProperties>
>>>> 	</configuration>
>>>> 	<dependencies>
>>>> 	</dependencies>
>>>> </plugin>
>>>>
>>>>
>>>> The system property "java.naming.factory.url.pkgs" is the key.  
>>>> From what
>>>> I can tell openEJB's IvmContext will attempt to do JNDI lookups  
>>>> and if it
>>>> fails will look for additional ObjectFactories and delegate to  
>>>> them. By
>>>> adding the "org.morbay.naming" system property IvmContext finds  
>>>> the Jetty
>>>> JNDI context. Without this setting the jetty plugin will fail with  
>>>> the
>>>> error: "javax.naming.NameNotFoundException: Name "java:comp" not  
>>>> found."
>>>>
>>>> It took me a while to figure this out so it may be useful to add  
>>>> to the
>>>> openEJB docs.
>>>>
>>>> Hope this helps,
>>>> Kenneth
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452221.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p21762062.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Tomcat - Injection: No such property

Posted by David Blevins <da...@visi.com>.
On Apr 2, 2008, at 3:30 PM, klewelling wrote:
>
>
> You may want to try setting the properties as system properties,  
> i.e. java
> ...
> - 
> Djava 
> .naming 
> .factory.initial=org.apache.openejb.client.LocalInitialContextFactory
> -Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX
>
> or something like that. I think it may be important that openEJB's
> initialContext is the first to start up rather than tomcats. If I  
> have some
> free time I can try to get my setup working with tomcat.

That's definitely true of most third-party JNDI implementations; i.e.  
we should be first as we will delegate to them, whereas they usually  
won't delegate to us.  But for Tomcat specifically, we have some code  
that exports all of our JNDI entries into Tomcat so that there only  
needs to be one JNDI impl controlling the show -- Tomcat's.

Not sure why the EntityManager isn't getting picked up with the beans  
in WEB-INF/lib/ vs WEB-INF/classes/.  We did add some very detailed  
logging around the resolution of EntityManager references specifically  
since 3.0-beta-2 that might help (in the new openejb.war i just put  
up).  Hopefully there'll be something in the log that might illuminate  
what's going on.

-David

> ebaxt wrote:
>>
>> Thank you Kenneth!
>>
>> I have tried to set the properties you talked about, but I don't  
>> really
>> know how to configure it to lookup Tomcat's JNDI context.
>>
>> I have tried this with no luck:
>>
>>        Properties p = new Properties();
>>        p.put(Context.INITIAL_CONTEXT_FACTORY,
>> "org.apache.openejb.client.LocalInitialContextFactory");
>>        p.put(Context.URL_PKG_PREFIXES,  
>> "org.apache.naming.factory.XXX");
>>
>> Do you know how to configure this correctly?
>>
>> Erik
>>
>>
>> klewelling wrote:
>>>
>>> FYI I got the injection to work. When I was putting together a
>>> demonstration the injection started working. The problem has to do  
>>> with
>>> dependencies in the pom.xml. I am not sure if there was something  
>>> extra
>>> causing the problem or perhaps the order of the jars in the  
>>> classpath. I
>>> am uploading an example
>>>
>>> http://www.nabble.com/file/p16421933/injection-example.zip
>>> injection-example.zip
>>>
>>> By the way this example demonstrations embedding openEJB in Jetty.  
>>> The
>>> important piece of the puzzle is in the WAR/pom.xml:
>>>
>>> <plugin>
>>>    <groupId>org.mortbay.jetty</groupId>
>>> 	<artifactId>maven-jetty-plugin</artifactId>
>>> 	<configuration>
>>> 		<scanIntervalSeconds>5</scanIntervalSeconds>
>>> 		<contextPath>/example</contextPath>
>>> 		<systemProperties>
>>> 			<systemProperty>
>>> 				<name>java.naming.factory.initial</name>
>>> 				<value>org.apache.openejb.client.LocalInitialContextFactory</ 
>>> value>
>>> 			</systemProperty>
>>> 			<systemProperty>
>>> 				<name>java.naming.factory.url.pkgs</name>
>>> 				<value>org.mortbay.naming</value>
>>> 			</systemProperty>
>>> 		</systemProperties>
>>> 	</configuration>
>>> 	<dependencies>
>>> 	</dependencies>
>>> </plugin>
>>>
>>>
>>> The system property "java.naming.factory.url.pkgs" is the key.  
>>> From what
>>> I can tell openEJB's IvmContext will attempt to do JNDI lookups  
>>> and if it
>>> fails will look for additional ObjectFactories and delegate to  
>>> them. By
>>> adding the "org.morbay.naming" system property IvmContext finds  
>>> the Jetty
>>> JNDI context. Without this setting the jetty plugin will fail with  
>>> the
>>> error: "javax.naming.NameNotFoundException: Name "java:comp" not  
>>> found."
>>>
>>> It took me a while to figure this out so it may be useful to add  
>>> to the
>>> openEJB docs.
>>>
>>> Hope this helps,
>>> Kenneth
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452221.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Re: Tomcat - Injection: No such property

Posted by klewelling <kl...@gmail.com>.

You may want to try setting the properties as system properties, i.e. java
...
-Djava.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory
-Djava.naming.factory.url.pkgs=org.apache.naming.factory.XXX

or something like that. I think it may be important that openEJB's
initialContext is the first to start up rather than tomcats. If I have some
free time I can try to get my setup working with tomcat.

Kenneth


ebaxt wrote:
> 
> Thank you Kenneth!
> 
> I have tried to set the properties you talked about, but I don't really
> know how to configure it to lookup Tomcat's JNDI context.
> 
> I have tried this with no luck:
> 
>         Properties p = new Properties();
>         p.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
>         p.put(Context.URL_PKG_PREFIXES, "org.apache.naming.factory.XXX");
> 
> Do you know how to configure this correctly?
> 
> Erik
> 
> 
> klewelling wrote:
>> 
>> FYI I got the injection to work. When I was putting together a
>> demonstration the injection started working. The problem has to do with
>> dependencies in the pom.xml. I am not sure if there was something extra
>> causing the problem or perhaps the order of the jars in the classpath. I
>> am uploading an example
>> 
>>  http://www.nabble.com/file/p16421933/injection-example.zip
>> injection-example.zip 
>> 
>> By the way this example demonstrations embedding openEJB in Jetty. The
>> important piece of the puzzle is in the WAR/pom.xml:
>> 
>> <plugin>
>>     <groupId>org.mortbay.jetty</groupId>
>> 	<artifactId>maven-jetty-plugin</artifactId>
>> 	<configuration>
>> 		<scanIntervalSeconds>5</scanIntervalSeconds>
>> 		<contextPath>/example</contextPath>
>> 		<systemProperties>
>> 			<systemProperty>
>> 				<name>java.naming.factory.initial</name>
>> 				<value>org.apache.openejb.client.LocalInitialContextFactory</value>
>> 			</systemProperty>
>> 			<systemProperty>
>> 				<name>java.naming.factory.url.pkgs</name>
>> 				<value>org.mortbay.naming</value>
>> 			</systemProperty>
>> 		</systemProperties>
>> 	</configuration>
>> 	<dependencies>
>> 	</dependencies>
>> </plugin>
>> 
>> 
>> The system property "java.naming.factory.url.pkgs" is the key. From what
>> I can tell openEJB's IvmContext will attempt to do JNDI lookups and if it
>> fails will look for additional ObjectFactories and delegate to them. By
>> adding the "org.morbay.naming" system property IvmContext finds the Jetty
>> JNDI context. Without this setting the jetty plugin will fail with the
>> error: "javax.naming.NameNotFoundException: Name "java:comp" not found."
>> 
>> It took me a while to figure this out so it may be useful to add to the
>> openEJB docs. 
>> 
>> Hope this helps,
>> Kenneth
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452221.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Tomcat - Injection: No such property

Posted by ebaxt <eb...@broadpark.no>.
Thank you Kenneth!

I have tried to set the properties you talked about, but I don't really know
how to configure it to lookup Tomcat's JNDI context.

I have tried this with no luck:

        Properties p = new Properties();
        p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
        p.put(Context.URL_PKG_PREFIXES, "org.apache.naming.factory.XXX");

Do you know how to configure this correctly?

Erik


klewelling wrote:
> 
> FYI I got the injection to work. When I was putting together a
> demonstration the injection started working. The problem has to do with
> dependencies in the pom.xml. I am not sure if there was something extra
> causing the problem or perhaps the order of the jars in the classpath. I
> am uploading an example
> 
>  http://www.nabble.com/file/p16421933/injection-example.zip
> injection-example.zip 
> 
> By the way this example demonstrations embedding openEJB in Jetty. The
> important piece of the puzzle is in the WAR/pom.xml:
> 
> <plugin>
>     <groupId>org.mortbay.jetty</groupId>
> 	<artifactId>maven-jetty-plugin</artifactId>
> 	<configuration>
> 		<scanIntervalSeconds>5</scanIntervalSeconds>
> 		<contextPath>/example</contextPath>
> 		<systemProperties>
> 			<systemProperty>
> 				<name>java.naming.factory.initial</name>
> 				<value>org.apache.openejb.client.LocalInitialContextFactory</value>
> 			</systemProperty>
> 			<systemProperty>
> 				<name>java.naming.factory.url.pkgs</name>
> 				<value>org.mortbay.naming</value>
> 			</systemProperty>
> 		</systemProperties>
> 	</configuration>
> 	<dependencies>
> 	</dependencies>
> </plugin>
> 
> 
> The system property "java.naming.factory.url.pkgs" is the key. From what I
> can tell openEJB's IvmContext will attempt to do JNDI lookups and if it
> fails will look for additional ObjectFactories and delegate to them. By
> adding the "org.morbay.naming" system property IvmContext finds the Jetty
> JNDI context. Without this setting the jetty plugin will fail with the
> error: "javax.naming.NameNotFoundException: Name "java:comp" not found."
> 
> It took me a while to figure this out so it may be useful to add to the
> openEJB docs. 
> 
> Hope this helps,
> Kenneth
> 

-- 
View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16452163.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: Tomcat - Injection: No such property

Posted by klewelling <kl...@gmail.com>.
FYI I got the injection to work. When I was putting together a demonstration
the injection started working. The problem has to do with dependencies in
the pom.xml. I am not sure if there was something extra causing the problem
or perhaps the order of the jars in the classpath. I am uploading an example

http://www.nabble.com/file/p16421933/injection-example.zip
injection-example.zip 

By the way this example demonstrations embedding openEJB in Jetty. The
important piece of the puzzle is in the WAR/pom.xml:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
	<artifactId>maven-jetty-plugin</artifactId>
	<configuration>
		<scanIntervalSeconds>5</scanIntervalSeconds>
		<contextPath>/example</contextPath>
		<systemProperties>
			<systemProperty>
				<name>java.naming.factory.initial</name>
				<value>org.apache.openejb.client.LocalInitialContextFactory</value>
			</systemProperty>
			<systemProperty>
				<name>java.naming.factory.url.pkgs</name>
				<value>org.mortbay.naming</value>
			</systemProperty>
		</systemProperties>
	</configuration>
	<dependencies>
	</dependencies>
</plugin>


The system property "java.naming.factory.url.pkgs" is the key. From what I
can tell openEJB's IvmContext will attempt to do JNDI lookups and if it
fails will look for additional ObjectFactories and delegate to them. By
adding the "org.morbay.naming" system property IvmContext finds the Jetty
JNDI context. Without this setting the jetty plugin will fail with the
error: "javax.naming.NameNotFoundException: Name "java:comp" not found."

It took me a while to figure this out so it may be useful to add to the
openEJB docs. 

Hope this helps,
Kenneth
-- 
View this message in context: http://www.nabble.com/Tomcat---Injection%3A-No-such-property-tp16374013p16421933.html
Sent from the OpenEJB User mailing list archive at Nabble.com.