hwellmann / jeeunit

Automatically exported from code.google.com/p/jeeunit
Other
0 stars 1 forks source link

jeeunit-tomcat7-0.9.0 can't load its war file into Tomcat #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is really a bug in Tomcat itself (and i'll try submitting it there), but 
I'll post it here because it's making jeeunit completely unusuable for me. Here 
is the stack trace:

org.apache.catalina.loader.WebappLoader.copyDir(WebappLoader.java:1123)
org.apache.catalina.loader.WebappLoader.setRepositories(WebappLoader.java:892)
org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:603)
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5124
)
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:8
86)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)

Parameters to copyDir are 
   srcDir: a WARDirContext listing the files in the WAR's WEB-INF\classes folder
   dstDir: "C:\Users\Alex\AppData\Local\Temp\79269d2e-1293-48a7-96f8-ba6167fd3556\catalina\work\Tomcat\localhost\jeeunit\WEB-INF\classes"

The problem: 
copyDir copies the first two files, "WEB-INF\classes\.netbeans_automatic_build" 
and "WEB-INF\classes\.netbeans_update_resources" correctly, but throws a 
FileNotFoundException when copying 
"WEB-INF\classes\com\syncwords\service\HealthResource.class" (then catches it 
and returns false).

The reason:
FileOutputStream(currentFile) cannot create the path of subdirectories 
"com\syncwords\service" if they don't already exist. This behavior is not 
described in the Javadocs, but is referenced in this tutorial: 
http://www.yaldex.com/java_tutorial/0685656438.htm "The first four constructors 
will also create the file if it does not already exist, but only if the parent 
directory exists, so it is a good idea to check this." It may be 
platform-dependent.

I am running Windows 7 x64, Netbeans 7.1, tomcat-catalina-7.0.23, JDK 1.6

What I don't understand... how is jeeunit working for anyone else???

Original issue reported on code.google.com by adubinsk...@gmail.com on 20 Jan 2012 at 11:58

GoogleCodeExporter commented 9 years ago
I've decided I won't bother submitting it there. I don't know if it's really a 
bug, maybe more a feature request. If you need the recursive copy 
functionality, submit it yourself. Maybe the problem is that the Tomcat APIs 
should be used differently.

Anyway, please let me know how I can get jeeunit working.

Original comment by adubinsk...@gmail.com on 20 Jan 2012 at 12:34

GoogleCodeExporter commented 9 years ago
Tried glassfish, didn't work either. "error deploying WAR" in 
com.googlecode.jeeunit.glassfish.EmbeddedGlassfishContainer.deployWar (appName 
is null)

Did anyone try this on Windows?

Original comment by adubinsk...@gmail.com on 20 Jan 2012 at 3:31

GoogleCodeExporter commented 9 years ago
As I don't work or test on Windows myself, this might indeed be a Windows 
issue. Have you tried running some of the jeeunit examples in your environment? 

jeeunit-example/jeeunit-example-test-tomcat7 would be the one to try. If you 
see the same issue there, then I'd say there's a Windows specific problem that 
needs further analysis.

If this example works but your own tests still do not, could you try to isolate 
a test case and attach a small self-contained test project to this issue?

A reproducible bug is usually the first step towards a solution :-)

Original comment by hwellman...@gmail.com on 25 Jan 2012 at 11:34

GoogleCodeExporter commented 9 years ago
First, had to fix the versions in the example poms (they were set to 
0.9.0-SNAPSHOT) Then, did a mvn -Ptest install. The following modules failed:

  jeeunit-jboss7 - launchJBoss7(com.googlecode.jeeunit.jboss7.test.EmbeddedJBoss7LauncherTest): Invalid jboss.home.dir: \home\hwellmann\apps\jboss-as-7.0.2.Final

  jeeunit-example-test-tomcat6 - 
Running com.googlecode.jeeunit.tomcat6.test.EmbeddedTomcat6LauncherTest
16:35:20,910 main  INFO Embedded:806 - Starting tomcat server
16:35:21,525 main  INFO StandardEngine:452 - Starting Servlet Engine: Apache 
Tomcat/6.0.33
16:35:21,640 main ERROR ContextConfig:1023 - Exception fixing docBase for 
context [/jeeunit]
java.io.FileNotFoundException: 
C:\Users\Alex\AppData\Local\Temp\f61cb894-b722-45c9-9d58-6918e843fb1a\webapps\je
eunit\WEB-INF\classes\com\googlecode\jeeunit\tomcat6\test\EmbeddedTomcat6Launche
rTest.class (The system cannot find the path specified).
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
        at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:457)
        at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:173)
        at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:905)
        at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1021)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
        at org.apache.catalina.core.StandardContext.init(StandardContext.java:5707)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4449)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
        at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
        at com.googlecode.jeeunit.tomcat6.EmbeddedTomcat6Container.startServer(EmbeddedTomcat6Container.java:394)

  jeeunit-example-test-tomcat7 - 
Running com.googlecode.jeeunit.tomcat7.test.EmbeddedTomcat7LauncherTest
16:39:48,204 main  INFO Http11Protocol:336 - Initializing ProtocolHandler 
["http-bio-8090"]
16:39:48,258 main  INFO StandardService:437 - Starting service Tomcat
16:39:48,258 main  INFO StandardEngine:288 - Starting Servlet Engine: Apache 
Tomcat/7.0.23
16:39:48,880 pool-2-thread-1 ERROR WebappLoader:628 - LifecycleException
java.io.IOException: Failed to copy resources
        at org.apache.catalina.loader.WebappLoader.setRepositories(WebappLoader.java:893)
        at org.apache.catalina.loader.WebappLoader.startInternal(WebappLoader.java:603)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5124)

  jeeunit-example-spring-tomcat6 - similar to test-tomcat6

  jeeunit-example-spring-tomcat7 - similar to test-tomcar7

  jeeunit-example-extend-war - couldn't build without jeeunit-example-spring-tomcat6 

  jeeunit-example-test-jboss7 - no jboss.home.dir again

  jeeunit-example-test-resin - 
com.googlecode.jeeunit.resin.test.TitleTest: GET 
http://localhost:9090/jeeunit/testrunner?class=com.googlecode.jeeunit
.resin.test.TitleTest&method=byTitle returned a response status of 404 Not Found

So, glassfish may have been my fault (didn't investigate it too deeply), but 
the failure with Tomcat is real. I debugged it and gave my conclusion in the 
first post.

Original comment by adubinsk...@gmail.com on 25 Jan 2012 at 2:52