Hello,
I have a question about integrating OpenWebBeans with a pure Tomcat server.
I looked for some solutions in the internet and here is what I did with my
project:
First I added some dependencies to the pom.xml:
<*dependency*>
<*groupId*>javax.enterprise</*groupId*>
<*artifactId*>cdi-api</*artifactId*>
<*version*>1.2</*version*>
</*dependency*>
<*dependency*>
<*groupId*>org.apache.openwebbeans</*groupId*>
<*artifactId*>openwebbeans-spi</*artifactId*>
<*version*>1.2.7</*version*>
</*dependency*>
<*dependency*>
<*groupId*>org.apache.openwebbeans</*groupId*>
<*artifactId*>openwebbeans-impl</*artifactId*>
<*version*>1.2.7</*version*>
</*dependency*>
<*dependency*>
<*groupId*>org.apache.openwebbeans</*groupId*>
<*artifactId*>openwebbeans-web</*artifactId*>
<*version*>1.2.7</*version*>
</*dependency*>
Having them, I was able to compile and deploy my project, however the
dependency injection simply did not work.
Then I additionally added the following dependency:
<*dependency*>
<*groupId*>org.apache.openwebbeans</*groupId*>
<*artifactId*>openwebbeans-tomcat7</*artifactId*>
<*version*>1.2.7</*version*>
</*dependency*>
And also created context.xml file under the src/main/webapp/META-INF folder
of my app with the following content:
<*Context*>
<
*Listener className=
"org.apache.webbeans.web.tomcat7.ContextLifecycleListener" */>
</*Context*>
However, this time I had deployment issue:
Dec 22, 2014 6:54:28 PM org.apache.tomcat.util.digester.Digester
startElement
SEVERE: Begin event threw exception
java.lang.ClassNotFoundException:
org.apache.webbeans.web.tomcat.ContextLifecycleListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at
org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144)
at
org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1288)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
I tried to tackle that with adding the OWB jars in the tomcat/lib folder.
But gave it up after the fifth ClassNotFoundError. It is not an option for
me anyway: I am not in control of the productive server, so I cannot touch
its lib directory.
I also looked in the OpenWebBeans samples, but they don't even package the
jars with them.
Can anyone share their experience with me?
Thanks a lot!
Ivan