You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by David Blevins <da...@visi.com> on 2009/02/06 07:36:11 UTC

Re: Tomcat - Injection: No such property

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 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.