Can't use Arquillian with remote WL - weblogic

I want to use arquillian to create unit tests for a ADF project. The tests should run on a remote WL 10.3.6.
With a weld-container everything is fine but if I change to remote WL I always get the following exception:
java.lang.IllegalArgumentException: ArquillianServletRunner not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.
at org.jboss.arquillian.protocol.servlet.ServletUtil.determineBaseURI(ServletUtil.java:64)
at org.jboss.arquillian.protocol.servlet.ServletURIHandler.locateTestServlet(ServletURIHandler.java:60)
at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.invoke(ServletMethodExecutor.java:84)
at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:120)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.test.impl.execution.ClientTestExecuter.execute(ClientTestExecuter.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createTestContext(ContainerEventController.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)
at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)
at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)
at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)
at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I removed all unneeded stuff to have a very basic setup / project:
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.company</groupId>
<artifactId>test-arquilian</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.1.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1</artifactId>
<version>1.0.0.Alpha2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
arquillian.xml
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="wls" default="true">
<configuration>
<property name="adminUrl">t3://localhost:7001</property>
<property name="adminUserName">weblogic</property>
<property name="adminPassword">Welcome1</property>
<property name="target">DefaultServer</property>
<property name="wlsHome">C:\space\wls_10_3_6\wlserver_10.3</property>
</configuration>
</container>
</arquillian>
FirstArquilianTest.java
package de.company;
import junit.framework.Assert;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
#RunWith(Arquillian.class)
public class FirstArquilianTest {
#Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class);
}
#Test
public void failTest() {
Assert.fail("Not yet implemented");
}
}
When I start the test I will receive the following output:
Sep 13, 2013 10:51:34 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient deploy
INFO: Starting weblogic.Deployer to deploy the test artifact.
Sep 13, 2013 10:51:38 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient forkWebLogicDeployer
INFO: weblogic.Deployer appears to have terminated successfully.
Sep 13, 2013 10:51:38 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient undeploy
INFO: Starting weblogic.Deployer to undeploy the test artifact.
Sep 13, 2013 10:51:41 AM org.jboss.arquillian.container.wls.WebLogicDeployerClient forkWebLogicDeployer
INFO: weblogic.Deployer appears to have terminated successfully.
If I add a breakpoint I can see that the application is deloyed to the weblogic (in weblogic console). Here everything looks right.
Maybe anyone can help me with this exception?
Update:
I tried it with
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1</artifactId>
<version>1.0.0.Final-SNAPSHOT</version>
but it has the same effect / exception.
I exported the artefact as mentioned in the comments. Here is the output:
Update:
I changed the dep to "arquillian-wls-remote-10.3" and now I receive this exception:
java.lang.ClassNotFoundException: de.company.FirstArquilianTest
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.executeTest(ServletTestRunner.java:158)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.execute(ServletTestRunner.java:126)
at org.jboss.arquillian.protocol.servlet.runner.ServletTestRunner.doGet(ServletTestRunner.java:90)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3739)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3705)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2282)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2181)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
After changing to "arquillian-wls-remote-10.3" an ear instead of a war is build. The ear has much more content (web.xml, etc.). Will upload an example.
Here is the zipped ear-File: http://www.guigarage.com/wordpress/wp-content/uploads/2013/09/ear.zip
Solution
You need at least one EJB in your deployment. If no EJB is specified the ear can't be deployed to WL. After adding a EJB everithing was fine. The WL-Test from Arquillian is a great example: https://github.com/arquillian/arquillian-container-wls/blob/master/wls-remote-10.3/src/test/java/org/jboss/arquillian/container/wls/remote_10_3/WebLogicDeployJarTest.java

WLS 10.3.x if I'm not mistaken uses only the Java EE 5 APIs, and hence you'll need to use the arquillian-wls-remote-10.3 artifact for this series of the WLS containers.
arquillian-wls-remote-12.1 is to be used only for WLS 12c.
As for testing JAR deployments on Java EE 5 containers, Arquillian chooses to wrap JARs inside an EAR file to make them deployable. Ideally for Java EE 5 containers, you would create EJB modules as JAR files, and hence this would make sense in such a scenario.
I do not know what you want to test yet, but the advice here is: your ShrinkWrap deployment should mirror the actual deployment you make in production as much as possible. If you're testing EJBs, you should prepare a deployment that includes the EJBs in the same structure as your project build output. If you're testing a POJO that resides in a utility JAR eventually packaged in a WAR/EAR file, then by all means create a ShrinkWrap JavaArchive for the JAR, but wrap it inside a WebArchive or EnterpriseArchive for Java EE 5 containers. You may find that Java EE 6 containers operate differently so you will need revisit these guidelines.
If you want an example test, on how JAR based deployments are tested in WLS 10.3.x, you could take a look at this test in the Arquillian WLS container test suite.

Related

Using EL 2.2 in an application deployed on Oracle Weblogic 10.3.6 isn't working?

I'm running Weblogic 10.3.6 and trying to build a new dynamic web application (in eclipse) that supports JSF 2.2.8 and EL 2.2 and JDK 1.7 U45, but unfortunately EL 2.2 is throwing an exception.
The weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.3/weblogic-web-app.xsd">
<wls:weblogic-version>10.3.6</wls:weblogic-version>
<wls:context-root>MyApp</wls:context-root>
<wls:library-ref>
<wls:library-name>jstl</wls:library-name>
<wls:specification-version>1.2</wls:specification-version>
<wls:exact-match>true</wls:exact-match>
</wls:library-ref>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>com.sun.el.*</wls:package-name>
<wls:package-name>javax.el.*</wls:package-name>
<wls:package-name>com.sun.faces.*</wls:package-name>
<wls:package-name>javax.faces.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
The following exception is thrown trying to run a page with an parameterized method call in EL
com.sun.el.parser.ParseException: Encountered "(" at line 1, column 22.
Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"?" ...
"/" ...
"div" ...
"%" ...
"mod" ...
at com.sun.el.parser.ELParser.generateParseException(ELParser.java:2143)
at com.sun.el.parser.ELParser.jj_consume_token(ELParser.java:2025)
at com.sun.el.parser.ELParser.DeferredExpression(ELParser.java:113)
at com.sun.el.parser.ELParser.CompositeExpression(ELParser.java:40)
at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:173)
Changing the weblogic.xml <container-descriptor> to
<wls:container-descriptor>
<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>
</wls:container-descriptor>
yields the same exception above, untill I add the following to the web.xml
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
Then the exception thrown changes to
java.lang.NoSuchMethodError: javax.el.ELResolver.invoke(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;
at com.sun.el.parser.AstValue.getValue(AstValue.java:111)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
at com.sun.faces.facelets.el.ELText$ELTextVariable.writeText(Unknown Source)
at com.sun.faces.facelets.el.ELText$ELTextComposite.writeText(Unknown Source)
at com.sun.faces.facelets.compiler.TextInstruction.write(Unknown Source)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(Unknown Source)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(Unknown Source)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(Unknown Source)
at javax.faces.component.UIComponentBase.encodeChildren(Unknown Source)
at javax.faces.component.UIComponent.encodeAll(Unknown Source)
at javax.faces.component.UIComponent.encodeAll(Unknown Source)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(Unknown Source)
at com.sun.faces.application.view.MultiViewHandler.renderView(Unknown Source)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(Unknown Source)
at com.sun.faces.lifecycle.Phase.doPhase(Unknown Source)
at com.sun.faces.lifecycle.LifecycleImpl.render(Unknown Source)
at javax.faces.webapp.FacesServlet.service(Unknown Source)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
I don't understand how weblogic is behaving, the same steps worked with other develobers as in the second answer in this question
Here is my workaround for EL in the old weblogic:
Add artifact from here as a dependency https://repository.jboss.org/nexus/content/repositories/releases/org/jboss/el/jboss-el/2.0.2.CR1/
Add to web.xml
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
Enjoy parameterized method calls. No other configuration required (no library-refs, no prefer-application-packages, no prefer-web-inf-classes)
I ran into a similar error trying to deploy JSF 2.2 in WebLogic 12.1.3. The accepted answer didn't quite suffice, or at least it lead to other errors. The following did the trick:
web/pom.xml:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.13</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-api</artifactId>
<version>2.2</version>
</dependency>
weblogic-application:
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application
xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/javaee_5.xsd
http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.4/weblogic-application.xsd">
<prefer-application-packages>
<package-name>javax.el.*</package-name>
<package-name>javax.faces.*</package-name>
<package-name>com.sun.el.*</package-name>
<package-name>com.sun.faces.*</package-name>
<package-name>com.bea.faces.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
<resource-name>META-INF/services/com.sun.faces.*</resource-name>
</prefer-application-resources>
</weblogic-application>
There are more details in this post https://roundwheeltech.wordpress.com/2016/06/15/deploying-a-jsf-2-2-to-weblogic-12-1-3/.
I have found a bit of a work around on the Oracle forums, it encapsulates the WAR in an EAR and uses the EAR's weblogic-application.xml to basically enforce the same package references but apparently this time weblogic honors the preferences and it works fine.
Still don't know how to do that with only a WAR file.
Solution posted on the forums
For me the following worked:
Weblogic 10.3.5.0
I have a JavaEE application with both ejbs in EJB container and
Facelets in Web container.
I added /META_INF/weblogic-application.xml :
<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.1/weblogic-application.xsd"
xmlns="http://xmlns.oracle.com/weblogic/weblogic-application">
<prefer-application-packages>
<package-name>com.sun.el.*</package-name>
<package-name>javax.el.*</package-name>
</prefer-application-packages>
</weblogic-application>
Included el-api-2.2.jar and el-impl-2.2.jar to the WEB-INF/lib
library.
it works, it does not work for me when using the weblogic.xml
Thank you "965902" whoever you are !

DropWizard JAR Signing Bug

I am trying to unit test my DropWizard 0.7.0 app, just like the docs recommend:
#Test
public void runRegisertsLocationResource() {
given:
Environment environment = Mockito.mock(Environment)
JerseyEnvironment jersey = Mockito.mock(JerseyEnvironment)
MyApplication fixture = new MyApplication()
MyConfiguration config = new MyConfiguration()
Mockito.when(environment.jersey()).thenReturn(jersey)
when:
fixture.run(config, environment)
then:
Mockito.verify(jersey).register(Mockito.any(LocationResource))
}
When I run this I get:
java.lang.SecurityException: class "javax.servlet.DispatcherType"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:952)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:666)
at java.lang.ClassLoader.defineClass(ClassLoader.java:794)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at io.dropwizard.Configuration.<init>(Configuration.java:62)
at io.auditcloud.micros.backend.service.config.BackendConfiguration.<init>(BackendConfiguration.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:186)
at io.auditcloud.micros.backend.service.BackendApplicationTest.runRegisertsAllProviders(BackendApplicationTest.groovy:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Here are my dependencies defined inside build.gradle:
dependencies {
compile (
'com.codahale.metrics:metrics-core:3.0.2',
'com.codahale.metrics:metrics-json:3.0.1',
'com.wordnik:swagger-jaxrs_2.10:1.3.4',
'io.dropwizard:dropwizard-core:0.7.0',
'io.dropwizard:dropwizard-auth:0.7.0',
'org.apache.commons:commons-lang3:3.3.2',
'io.dropwizard:dropwizard-client:0.7.0',
'org.eclipse.jetty:jetty-servlets:8.1.14.v20131031',
'com.google.inject:guice:3.0'
)
testCompile(
'org.mockito:mockito-all:1.9.0'
)
}
What's going on here?
Update: How to reproduce (step by step)
Create a new DropWizard project and use the exact dependencies mention above (I use Gradle but whatever works should be fine).
Create a new JUnit test class, say, under src/test/java, and make it look exactly like my JUnit test above, except replace MyApplication with whatever is the name of your DropWizard app's main class, and replace MyConfiguration with the respective configuration impl. Note: my app is written in Groovy, hence the Groovy syntax; you may need to "Java-ify" my code snippet above to get it to compile.
Run the test; you should get the same exception as I have posted above.
Edit: See UPDATE below
This is not an answer. Please don't vote on it. It will be deleted upon confirmation from the OP
So I'm wondering if you have tested the above steps for yourself. I followed the steps as you've stated, of course creating my own classes (super simple with little to no implementation, since you haven't specified any. And I don't get the result you are experiencing. I am also using Maven and Java. Whether or not the problem is with groovy, I am not sure, as I am not a groovy user.
Below you will find my Minimal, Complete, and Verifiable example (MCVE) implementation of your step-by-step. I suggest you create something similar that reproduces the problem. Create a project from scratch, as you have described (maybe using the below example as a starting point), then start adding features until it reproduces the problem. This is also a good way to discover the root of the problem yourself.
I would start with a simple Groovy project, and if a simple project, like the one below causes the problem, then it may be a Groovy problem, and you should edit your post with the MCVE so others familiar with Groovy can try and find the problem.
If it's not a Groovy problem, and you discover the problem by building on top of my MCVE, and you can't figure out the cause and how to fix it, then please do post the MCVE also.
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackoverflow.spring</groupId>
<artifactId>dropwizard-stackoverflow</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<dropwizard.version>0.7.0</dropwizard.version>
</properties>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-auth</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-client</artifactId>
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-json</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
MyConfiguration
import io.dropwizard.Configuration;
public class MyConfiguration extends Configuration {}
MyApplication
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
public class MyApplication extends Application<MyConfiguration> {
#Override
public void initialize(Bootstrap<MyConfiguration> btstrp) {}
#Override
public void run(MyConfiguration t, Environment e) throws Exception {
e.jersey().register(new LocationResource());
}
}
LocationResource
import javax.ws.rs.Path;
#Path("/location")
public class LocationResource {}
Test
import dropwizard.stackoverflow.resource.LocationResource;
import io.dropwizard.jersey.setup.JerseyEnvironment;
import io.dropwizard.setup.Environment;
import org.junit.Test;
import org.mockito.Mockito;
public class SimpleDropWizardTest {
#Test
public void runRegisertsLocationResource() throws Exception {
Environment environment = Mockito.mock(Environment.class);
JerseyEnvironment jersey = Mockito.mock(JerseyEnvironment.class);
MyApplication fixture = new MyApplication();
MyConfiguration config = new MyConfiguration();
Mockito.when(environment.jersey()).thenReturn(jersey);
fixture.run(config, environment);
Mockito.verify(jersey).register(Mockito.any(LocationResource.class));
}
}
Test Result
UPDATE
So I seem to have made my MCVE incorrectly. For some reason I missed
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>8.1.14.v20131031</version>
</dependency>
And it just so happens, this appears to be the the smoking gun. When I added this dependency to the above project, I would get a similar exception, which was not exactly the same, but detailed the same problem during class loading.
If you get rid of this dependency, it will work with the above example. Seems to be a conflict of versions. Dropwizard is already dependent on Jetty 9.0.7.v20131107. You can see the Maven dependency tree
[INFO] +- io.dropwizard:dropwizard-core:jar:0.7.0:compile
...
[INFO] | +- io.dropwizard:dropwizard-jetty:jar:0.7.0:compile
[INFO] | | +- com.codahale.metrics:metrics-jetty9:jar:3.0.1:compile
[INFO] | | +- org.eclipse.jetty:jetty-server:jar:9.0.7.v20131107:compile
[INFO] | | | \- org.eclipse.jetty:jetty-io:jar:9.0.7.v20131107:compile
[INFO] | | +- org.eclipse.jetty:jetty-servlet:jar:9.0.7.v20131107:compile
[INFO] | | | \- org.eclipse.jetty:jetty-security:jar:9.0.7.v20131107:compile
[INFO] | | +- org.eclipse.jetty:jetty-servlets:jar:9.0.7.v20131107:compile
[INFO] | | | \- org.eclipse.jetty:jetty-continuation:jar:9.0.7.v20131107:compile
[INFO] | | \- org.eclipse.jetty:jetty-http:jar:9.0.7.v20131107:compile
Basically when you declare a top level dependency (as you have with Jetty), it will supersede any transitive dependencies. So you have a Jetty 9.0.7 artifacts trying to interact with your declared 8.1.14 servlets artifact.

IntelliJ cucumber-jvm plugin doesn't run tests

Running a .feature file gives me the following error:
" >....< cucumber.cli.Main --format org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter --monochrome --glue C:/projects/selenium-parent/selenium/src/test/resources/InformationPage.feature
Testing started at 09:20 ...
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy13.feature(Unknown Source)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:108)
at cucumber.runtime.Runtime.run(Runtime.java:94)
at cucumber.runtime.Runtime.run(Runtime.java:82)
at cucumber.cli.Main.run(Main.java:20)
at cucumber.cli.Main.main(Main.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at cucumber.runtime.RuntimeOptions$1.invoke(RuntimeOptions.java:94)
... 11 more
Caused by: java.lang.NoSuchMethodError: gherkin.formatter.model.Feature.getLine()Ljava/lang/Integer;
at org.jetbrains.plugins.cucumber.java.run.CucumberJvmSMFormatter.feature(CucumberJvmSMFormatter.java:89)
... 16 more
Process finished with exit code 1
Empty test suite.
The feature file works if I invoke it via a JUnit test. So what why is it reporting Empty test suite?
Feature: Information Page
Scenario: Has expected components
Given I navigate to the information page
Then I should see the table component
This was due to me not having the latest cucumber-jvm plugin installed.
I had
Caused by: java.lang.ClassNotFoundException: org.jetbrains.plugins.cucumber.java.run.CucumberJvm3SMFormatter
I needed this in the pom
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.2</version>
</dependency>
and needed cucumber for java plugin installed

tomee persistence.xml in EJB JAR META-INF crashes my application deployment

I am using TomEE to deploy an EAR file, that contains one EJB JAR and one WAR.
I want to add entities using the default provider. I have created a resource in tomee.xml to use MySQL DB.
Then I would like to use entity manager so I am trying to create the following persistence.xml in the EJB JAR META-INF directory:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="MyProjectDataBase" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>MyProjectDS</jta-data-source>
<non-jta-data-source>MyProjectDSUnmanaged</non-jta-data-source>
<properties>
<property name="openjpa.jdbc.DBDictionary" value="mysql" />
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
</properties>
</persistence-unit>
</persistence>
MyProject & MyProjectUnmanaged are the resources Ids I created in tomee.xml.
Once I add this persistence.xml I get the following exception in catalina.out and my app is not deployed:
SEVERE: Application could not be deployed: /Users/avitale/Development/apache-tomee-jaxrs-1.5.0/apps/projecteam-ear
org.apache.openejb.OpenEJBException: Creating application failed: /Users/avitale/Development/apache-tomee-jaxrs-1.5.0/apps/projecteam-ear: loader (instance of org/apache/catalina/loader/StandardClassLoader): attempted duplicate class definition for name: "org/apache/openejb/cdi/CdiPlugin"
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:940)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:532)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:433)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:341)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:231)
at org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:131)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:113)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
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:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: java.lang.LinkageError: loader (instance of org/apache/catalina/loader/StandardClassLoader): attempted duplicate class definition for name: "org/apache/openejb/cdi/CdiPlugin"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.openejb.cdi.OptimizedLoaderService.loadWebBeansPlugins(OptimizedLoaderService.java:70)
at org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:53)
at org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:47)
at org.apache.webbeans.plugins.PluginLoader.startUp(PluginLoader.java:75)
at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:159)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:150)
at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:44)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:794)
... 20 more
Once I remove the persistence.xml then the application is successfully deployed.
Please help me as I don't understand how to proceed :(
Thanks in advance.
Would be helpful if you could specify the version you are actually using.
More over, did you check you won't deliver TomEE or any related dependencies in your EAR file (I mean lib/ or WEB-INF/lib)?
For your information, TomEE 1.5.1 will be released shortly with some fixes around EAR deployments.

Getting FileNotFoundException when deploying war using Maven Jetty plugin

I'm using Maven 3.0.3 with the Jetty plugin. I'm getting the error below:
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/applicationContext.xml
which I don't understand, because the file is present at target/mywar/WEB-INF/applicationContext.xml. I call this file in my web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4">
<display-name>/jx-production-1.0-SNAPSHOT</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>Any ideas what I'm missing? Here is my Jetty plugin definition in my pom.xml …
<profile>
<id>jetty</id>
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.2.2.v20101205</version>
<configuration>
<webAppConfig>
<contextPath>/all-new-jx</contextPath>
<descriptor>target/jx-1.0-SNAPSHOT/WEB-INF/web.xml</descriptor>
</webAppConfig>
<jettyConfig>config/jetty7/jetty.xml</jettyConfig>
<scanIntervalSeconds>10</scanIntervalSeconds>
<contextHandlers>
<contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
<contextPath>/all-new-jx-web</contextPath>
<resourceBase>${project.basedir}/target/web</resourceBase>
<handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
</contextHandler>
</contextHandlers>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-rewrite</artifactId>
<version>7.2.2.v20101205</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
Here's the long, nasty error I'm getting:
2011-08-04 14:08:56.677:WARN::Failed startup of context
o.m.j.p.JettyWebAppContext{/all-new-jx,file:/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/src/main/webapp/},file:/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/src/main/webapp/
org.springframework.beans.factory.BeanDefinitionStoreException:
IOException parsing XML document from ServletContext resource
[/WEB-INF/applicationContext.xml]; nested exception is
java.io.FileNotFoundException: Could not open ServletContext resource
[/WEB-INF/applicationContext.xml] at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:641)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:228)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:164)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at org.eclipse.jetty.server.Server.doStart(Server.java:243) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at
org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by:
java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml] at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:641)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:228)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1181)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:584)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:496)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:164)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:226)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:93)
at org.eclipse.jetty.server.Server.doStart(Server.java:243) at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:55)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) at
org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at
org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Thanks for your advice.
I assume you're using the run goal--i.e. mvn jetty:run? That runs a webapp "in place", meaning it looks for classes in target/classes or in your project dependencies, and it loads web resources from src/main/webapp (assuming default directory layout). It won't find anything in target/mywar/.... You could use one of the other jetty plugin goals, but I'd recommend just moving your applicationContext.xml into the classpath and using classpath:/applicationContext.xml as your contextConfigLocation.