Errors in Running Servlet test with GAE/Arquillian

廉价感情. 提交于 2019-12-25 02:18:23

问题


I tried to run with:

$ mvn -Dtest=AnnotatedEchoServletTestCase test -Dappengine.sdk.root=/home/xybrek/buildtools/appengine-java-sdk-1.8.4

This is the log:


T E S T S

Running com.myapp.AnnotatedEchoServletTestCase
Mar 07, 2014 6:15:20 PM org.jboss.arquillian.container.appengine.embedded.AppEngineSetup prepare
INFO: servlet-test.war:
/WEB-INF/
/WEB-INF/lib/
/WEB-INF/lib/appengine-api-1.0-sdk-1.8.4.jar
/WEB-INF/classes/
/WEB-INF/classes/com/
/WEB-INF/classes/com/myapp/
/WEB-INF/classes/com/myapp/EchoServlet.class
/WEB-INF/classes/org/
/WEB-INF/classes/org/jboss/
/WEB-INF/classes/org/jboss/arquillian/
/WEB-INF/classes/org/jboss/arquillian/container/
/WEB-INF/classes/org/jboss/arquillian/container/appengine/
/WEB-INF/classes/org/jboss/arquillian/container/appengine/embedded/
/WEB-INF/classes/org/jboss/arquillian/container/appengine/embedded/hack/
/WEB-INF/classes/org/jboss/arquillian/container/appengine/embedded/hack/AppEngineHack.class
/WEB-INF/classes/org/jboss/arquillian/container/appengine/embedded/hack/AppEngineHack$1.class
/WEB-INF/classes/org/jboss/arquillian/container/appengine/embedded/hack/AppEngineHack$2.class
Mar 07, 2014 6:15:20 PM org.jboss.arquillian.container.common.AppEngineCommonContainer$1 run
INFO: Get temp root: /tmp
Mar 07, 2014 6:15:21 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
SEVERE: Received exception processing /tmp/servlet-test.war/WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: Could not locate /tmp/servlet-test.war/WEB-INF/appengine-web.xml
  at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:140)
  at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:75)
  at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:166)
  at com.google.appengine.tools.development.ApplicationConfigurationManager$WarModuleConfigurationHandle.readConfiguration(ApplicationConfigurationManager.java:399)
  at com.google.appengine.tools.development.ApplicationConfigurationManager.<init>(ApplicationConfigurationManager.java:146)
  at com.google.appengine.tools.development.ApplicationConfigurationManager.newWarConfigurationManager(ApplicationConfigurationManager.java:88)
  at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:137)
  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.jboss.arquillian.container.appengine.embedded.hack.DevAppServerFactoryHack.createDevAppServer(DevAppServerFactoryHack.java:36)
  at org.jboss.arquillian.container.appengine.embedded.hack.DevAppServerFactoryHack.createDevAppServer(DevAppServerFactoryHack.java:25)
  at org.jboss.arquillian.container.appengine.embedded.AppEngineEmbeddedContainer$1.run(AppEngineEmbeddedContainer.java:68)
  at org.jboss.arquillian.container.appengine.embedded.AppEngineEmbeddedContainer$1.run(AppEngineEmbeddedContainer.java:66)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.jboss.arquillian.container.appengine.embedded.AppEngineEmbeddedContainer.doDeploy(AppEngineEmbeddedContainer.java:66)
  at org.jboss.arquillian.container.common.AppEngineCommonContainer.deploy(AppEngineCommonContainer.java:94)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
  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.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.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:50)
  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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
  at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
  at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:78)
  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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
  at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
  at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.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:606)
  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.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
  at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:95)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:80)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:263)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:239)
  at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:79)
  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.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.client.ContainerEventController.execute(ContainerEventController.java:101)
  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.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.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:606)
  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:606)
  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.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
  at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)
  at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)
  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:309)
  at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)
  at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
  at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
  at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
  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.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
  at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
  at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
  at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
Caused by: java.io.FileNotFoundException: /tmp/servlet-test.war/WEB-INF/appengine-web.xml (No such file or directory)
  at java.io.FileInputStream.open(Native Method)
  at java.io.FileInputStream.<init>(FileInputStream.java:146)
  at java.io.FileInputStream.<init>(FileInputStream.java:101)
  at com.google.apphosting.utils.config.AppEngineWebXmlReader.getInputStream(AppEngineWebXmlReader.java:137)
  ... 110 more

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.826 sec <<< FAILURE!

Results :

Tests in error:

com.myapp.AnnotatedEchoServletTestCase: Error starting AppEngine.

It seems it could not locate: com.google.apphosting.utils.config.AppEngineConfigException: Could not locate /tmp/servlet-test.war/WEB-INF/appengine-web.xml

Where its in /src/main/webapp/WEB-INF and /src/test/webapp/WEB-INF


回答1:


It looks like you're not packaging the appengine-web.xml file into ShrinkWrap's archive.




回答2:


You have to use addAsWebInfResource(new File("src/main/webapp/WEB-INF/appengine-web.xml")) while creating your ShrinkWrap archive.

You might want to see the WebContainer API.




回答3:


Files in src/main/webapp is not available for the test classloader by default. A solution is to put the *web.xml in your src/main/resources instead, and put the file in its intended target location when you're assembling the final artifact.



来源:https://stackoverflow.com/questions/22247618/errors-in-running-servlet-test-with-gae-arquillian

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!