« Return to Thread: Tomcat - Injection: No such property
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?
Erikklewelling 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
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
« Return to Thread: Tomcat - Injection: No such property
| Free embeddable forum powered by Nabble | Forum Help |