« Return to Thread: Tomcat - Injection: No such property

Re: Tomcat - Injection: No such property

by klewelling :: Rate this Message:

Reply to Author | View in Thread

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