-
15. Re: Unwaring web app - leaves some files in the war
peterj Dec 18, 2007 11:42 AM (in response to dsklyut)Regarding the contents of the war archive (whther file or directory), here is where my confusion comes in. This is your illustration:
deploy +myapp.war +conf +config.properties +WEB-INF
This tells me that there are two entities in the deploy directory: myapp.war and WEB-INF. Then in myapp.war there is a directory named conf. In other words, the WEB-INF directory is not located in the war archive but is outside of it. I am sure that is not what you meant, but whereas in this case I can assume you really meant that WEB-INF is within myapp.war (at least I hope you meant that), in other cases I have to take your word for the layout, and in many cases the layout has me confused because it cannot be correct.
Put it another way. Here are the contents of the war I am using to duplicate this problem, as produced by the jar utility:
$ jar -tf webapp.war
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/peter/
index.jsp
WEB-INF/classes/config.properties
WEB-INF/classes/peter/TheServlet.class
WEB-INF/web.xml
I would illustrate this as follows:webapp.war + index.jsp + WEB-INF + classes + config.properties + peter + TheServlet.class
or alternatively as:
Contents of myapp.war:index.jsp WEB-INF/classes/config.properties WEB-INF/classes/peter/TheServlet.class
The code that you posted, can I assume that the code is located within the class ProjectRootClass, and that the class is not a servlet? Also, this code does not access the properties file. How is the properties file accessed? -
16. Re: Unwaring web app - leaves some files in the war
peterj Dec 18, 2007 2:27 PM (in response to dsklyut)Wait a minute, I think I understand now. What you posted is the code that gets the base directory, and the code that opens the properties file appends "conf/config.properties" top the base to get the file location.
I added your code to my servlet, and here is the output (when all of my classes are in the WEB-INF/classes directory:
11:12:42,640 INFO [STDOUT] ProjectRootClass: Probe URL is vfsfile:/opt/jboss/jboss-5.0.0.Beta2/server/webapp/deploy/inear.ear/webapp.war/WEB-INF/classes/peter/ProjectRootClass.class
11:12:42,641 INFO [STDOUT] ProjectRootClass: The project root was detected at /opt/jboss/jboss-5.0.0.Beta2/server/webapp/deploy/inear.ear/webapp.war
And then I packaged my classes in a jar file and placed it into WEB-INF/lib:
11:17:26,260 INFO [STDOUT] ProjectRootClass: Probe URL is jar:vfsfile:/opt/jboss/jboss-5.0.0.Beta2/server/webapp/deploy/inear.ear/webapp.war/WEB-INF/lib/stuff.jar!/peter/ProjectRootClass.class
11:17:26,260 INFO [STDOUT] ProjectRootClass: The project root was detected at /opt/jboss/jboss-5.0.0.Beta2/server/webapp/deploy/inear.ear/webapp.war
In both cases the base location is webapp.war directory (both the ear and war are exploded).
So it appears that if the ear and war are exploded that it should work (that is, the code should not be looking in the tmp or work files for the base.
So some more questions - where did the code you posted come from? I hope it did not come from a JSP! If it did, you might have to precompile the JSP and package it in the jar file, or put it in the classes directory. If the code is not from a JSP, then I need to see the output from the code, and the code that opens the properties file. -
17. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 19, 2007 4:23 AM (in response to dsklyut)Just to clear up the confusion, the WEB_INF is located under myapp.war and not standalone in the deploy directory!! Sorry my indentation again ;)
The code that does this is packaged in a jar file in the WEB_INF/lib directory!!
So some more questions - where did the code you posted come from? I hope it did not come from a JSP! If it did, you might have to precompile the JSP and package it in the jar file, or put it in the classes directory. If the code is not from a JSP, then I need to see the output from the code, and the code that opens the properties file.
But the library is used/called from within a JSP, so this ,might have something to do with it.
My output for the ProjectRootClass is as follows
10:13:53,230 INFO [STDOUT] ProjectRootClass: Probe URL is jar:file:/C:/jboss/jboss-5.0.0.Beta2/server/default/work/jboss.web/localhost/myapp/WEB-INF/lib/jsptools.jar!/com/project/ProjectRootClass.class
So for you to replicate it i suggest you package that code in a jar file, place it under you WEB-INF/lib directory, create a JSP page and reference it from the JSP page and see what happens ;)
But going back to my last post, there is a difference between the 4.2.2 and the 5.0 in my "work" directory, in the 4.2.2 i dont have any WEB-INF directory in the "work" directory!! -
18. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 19, 2007 4:44 AM (in response to dsklyut)Just so you know my directory structure of where the jsp is packaged(shouldnt make a difference but ill post it anyways)
So please note this is all below the myapp.war in case my indentation is not up to scratch again+myapp.war +conf +conf.properties +web-inf +lib index.jsp
So the jsp is under myapp.war.
Cheers Peter,
LL -
19. Re: Unwaring web app - leaves some files in the war
peterj Dec 19, 2007 2:24 PM (in response to dsklyut)I also placed my class in a jar file in the web-inf/lib directory, and I am calling it from a jsp. So as far as I can tell I have the same setup that you have. Yet there must be something different because I am not seeing what you are seeing. For example, here are the contents of my work/jboss.web/localhost/webapp directory:
tldCache.ser
org/apache/jsp/index_jsp.java
org/apache/jsp/index_jsp.class
Notice that there is no web-inf directory, nor any jar file.
Does the application work in 4.2.2? You never said. -
20. Re: Unwaring web app - leaves some files in the war
peterj Dec 19, 2007 2:41 PM (in response to dsklyut)I tried something. Instead of exploded directories, I packaged the war into a file, and the ear into a file. Now I am seeing the same results you are seeing. I though you stated that you were using exploded directories?
Here is my directory/file structure (starting with the deploy directory):
deploy/inear.ear/meta-inf/application.xml
deploy/inear.ear/webapp.war/index.jsp
deploy/inear.ear/webapp.war/web-inf/web.xml
deploy/inear.ear/webapp.war/web-inf/lib/stuff.jar
deploy/inear.ear/webapp.war/web-inf/classes/config.properties -
21. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 20, 2007 5:16 AM (in response to dsklyut)
Does the application work in 4.2.2? You never said.
I kind of did, see my comment on the difference of the directory structure between 4.2.2 and 5.0. 4.2.2 has no web-inf directory in the work directory whereas 5.0 does. Works fine in 4.2.2!!
Here is my directory/file structure (starting with the deploy directory):
deploy/inear.ear/meta-inf/application.xml
deploy/inear.ear/webapp.war/index.jsp
deploy/inear.ear/webapp.war/web-inf/web.xml
deploy/inear.ear/webapp.war/web-inf/lib/stuff.jar
deploy/inear.ear/webapp.war/web-inf/classes/config.properties
The difference between me and you now is that my config.properties does not sit inside the classes directory but just under the base web directory so in your case it would look like so
deploy/inear.ear/webapp.war/config/config.properties
thought you stated that you were using exploded directories?
I did and im after double checking again ;). Deleted what was in the work directory and fired it up again, still same problem, i have the WEB-INF in the work directory. With exploded ear i no longer get any entry in the "tmp" directory, i assume this is because the directories are already exploded in the deploy directory.
I dont see how the location of the config.properties will make a difference to what you are getting though!! You sure you are using 5.0 Beta 2??
I will assume so, ok i dont know if this will make a difference but I´ll just describe what is happening. I dont directly reference the ProjectRootClass, i use an interface thats given to me and that indirectly references the ProjectRootClass, under the hood if you like to call it that way. The 2 classes are however packaged in 2 different jars from one another but both under the WEB-INF/lib directory. I dont see how that would make a difference from directly accessing it but i thought i would mention it anyways.(Just in case).
Im working on windows XP(Although i use cgywin to start it up) and you are on linux(i think), could this be a factor??
Cheers Peter,
LL -
22. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 20, 2007 5:48 AM (in response to dsklyut)Ok this might be easier, take the jmx-console.war in the default dir that is an exploded war file from jboss.
In the work directory for this war i see+jmx-console +org +WEB-INF +classes tldCache.ser
What do you have for this directory structure?? -
23. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 20, 2007 7:03 AM (in response to dsklyut)Also JDK version is 1.5.0_13!!
-
24. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 20, 2007 7:50 AM (in response to dsklyut)Ok interesting update!!
Downloaded the 5.0 beta2 again today, set the one up on my windows box and set up on my linux box, started both up!!
Took a look in the work directory for the jmx-console.war on my linux box and i have no web-inf dir, take a look on my windows box and i do have it!!!
Something not right going on there!!
Im also having another issue and wondering is there any relation, i should post in the right forum but just want to ask do you think there is any relation going on. Im in the process of setting up my development environment and want to hot swap/deploy my code. Ive read about what i have to do
http://wiki.jboss.org/wiki/Wiki.jsp?page=ExplodedDeployment
http://wiki.jboss.org/wiki/Wiki.jsp?page=DeployTipsAndBuildSampleScripts
So i have my exploded ear and i have eclipse exporting my classes to the exploded directories. I then have an ant script which touches my application.xml and web.xml but i dont get any reload. Jboss does not respond!! Has this any relation to what im experiencing with above ?? or should i just post in the "deployment" forum and see what they say?
Cheers Peter,
LL -
25. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 20, 2007 8:03 AM (in response to dsklyut)
m also having another issue and wondering is there any relation, i should post in the right forum but just want to ask do you think there is any relation going on. Im in the process of setting up my development environment and want to hot swap/deploy my code. Ive read about what i have to do
http://wiki.jboss.org/wiki/Wiki.jsp?page=ExplodedDeployment
http://wiki.jboss.org/wiki/Wiki.jsp?page=DeployTipsAndBuildSampleScripts
So i have my exploded ear and i have eclipse exporting my classes to the exploded directories. I then have an ant script which touches my application.xml and web.xml but i dont get any reload. Jboss does not respond!! Has this any relation to what im experiencing with above ?? or should i just post in the "deployment" forum and see what they say?
Forget the above, i missed a step in the documents, i was meant to make an entry in the conf/jboss-service.xml for the URLDeploymentScanner. Only thing now is that in 5.0 there isnt any entry now for it in jboss-service.xml!! Maybe i have to add it, we shall see!! -
26. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 20, 2007 10:20 AM (in response to dsklyut)didnt mention that i was running on windows XP!!
Now I have!! -
27. Re: Unwaring web app - leaves some files in the war
peterj Dec 20, 2007 1:02 PM (in response to dsklyut)Wow, lots of posts. Let me see what I can answer.
First, I did see where you stated that in 4.2.x that the work directory does not contain web-inf, but as I pointed out you never said that the app worked correctly there, though you did now. The presence of the web-inf directory under the work directory does not necessarily indicate a problem - the class loader could still load the classes from the web-inf/lib directory in the exploded directories, in which case the code could work even though the web-inf/lib and its jars are in the work directory.
I have added a conf/config.properties to my war. And I tried the exploded ear with the exploded war in 4.2.x, 5.0 beta2 and a early version on beta3. And I tried it on Linux and XP. The results?4.2.x beta2 beta3 _____ _____ _____ XP works broke broke Linux works works works
It is somewhat interesting that the deployer is not working correctly on Windows. Just for grins, I tried beta3 on Vista, it's broke there too.
As I mentioned earlier, deployment in beta2 is broken in so many ways. Congratulations on finding yet another way that it is broken. And the issue with redeployment not happing when you touch application.xml is yet another way deployment is broken in beta2. But hey, hot deployment was not working at all in beta1. You should try the touching application.xml thing in beta3 when it comes out (I'm guessing next week).
One final bit of info: in 5.0, the hot deployment configuration is found in the file server/xxx/conf/bootstrap-beans.xml, look for a bean named HDScanner. In addition, there are several other beans that aid in deployment.
So what should you do about your problem. I suggest that either:
a) you deploy in Linux
b) you fall back to 4.2.x
The behavior of the deployer on Windows in the 5.0 betas is clearly wrong, not sure if there is a JIRA issue for that problem (anyone from RedHat want to chime in on that?). -
28. Re: Unwaring web app - leaves some files in the war
peterj Dec 20, 2007 4:45 PM (in response to dsklyut)Important correction!
I just now downloaded the source from the beta3 tag in svn, built it, and tried my app there. It works correctly, even on Windows:
13:41:00,427 INFO [STDOUT] ProjectRootClass: Probe URL is jar:file:/F:/opt/jbos
s/JBoss_5_0_0_Beta3/build/output/jboss-5.0.0.Beta3/server/servlets/deploy/inear.
ear/webapp.war/WEB-INF/lib/stuff.jar!/peter/ProjectRootClass.class
13:41:00,427 INFO [STDOUT] ProjectRootClass: The project root was detected at /
F:/opt/jboss/JBoss_5_0_0_Beta3/build/output/jboss-5.0.0.Beta3/server/servlets/de
ploy/inear.ear/webapp.war
So here is another option:
c) wait for JBossAS 5.0 beta3 (looks like it might be out on the 21st) -
29. Re: Unwaring web app - leaves some files in the war
lovelyliatroim Dec 21, 2007 3:33 AM (in response to dsklyut)Ok so its broken, cheers for the help Peter.
I will wait for beta3 to come out.
c) wait for JBossAS 5.0 beta3 (looks like it might be out on the 21st)
Thats the 21st of when?? 21 st december?? So today??
Ok back to hot deployment, this is something that i will need to work when i start my development.
One final bit of info: in 5.0, the hot deployment configuration is found in the file server/xxx/conf/bootstrap-beans.xml, look for a bean named HDScanner. In addition, there are several other beans that aid in deployment.
So do i have to make an entry in here like in 4.2.2 with the URLDeploymentScanner for hot swap to work or will JBoss 5.0 automatically pick this up??
Did you test for hot swap with 5.0 beta3 or just the original property file issue?(Just out of curiousity to see if it works)