I notice that after I copy my WAR to the appropriate WL 9.2.2 directory and restart my server, there are no classes in the WL tmp directory -- $WL_HOME/user_projects/domains/nps_pt_92/servers/myserver/tmp/_WL_user/myapp/uy62cb/war/WEB-INF, only a file "_wl_cls_gen.jar" that contains such classes.
Problem is, it contains old classes -- i.e. not the ones in the WAR file's classes directory.
How does this file get generated and is there any way in the admin console I can tell it to not produce that file?
Thanks for replying.
The problem is resolved now. Earlier i was storing keystore in /WEB-INF/classes which was not accessible after deploying war on weblogic because of above mentioned problem.
Now, i am reading keystore using getResourceStream(...) and storing its contents in newly created keystore at some temporary location.
I am also facing this problem. Please allow me to describe in bit detail:
I have a webapp deployed on weblogic server 10.3 which uses spring framework. One of java classes which is inside some services.jar accessing a XML file which resides in web-inf/classes folder. That java class loads the XML as below:
final File headerFile = ResourceUtils.getFile("classpath://data-values.xml");
What weblogic does during WAR deployment(obviously it internally explodes) it puts all the files reside in web-inf/classes folder into jar called _wl_cls_gen.jar file and copies into web-inf/lib directory under domain stage folder. This is where the problem during deployment as my java class was unable to read the xml and throwing error as FileNotFoundException.
java.io.FileNotFoundException: class path resource [//data-values.xml] cannot be resolved to absolute file path because it does not reside in the file system: zip:C:/domains/devDomain/servers/AdminServer/tmp/_WL_user/testWebApp/8j5e1y/war/WEB-INF/lib/_wl_cls_gen.jar!/data-values.xml
Is there a way to avoid generating _wl_cls_gen.jar during deployment? or there is a bug in Spring's ResourceUtils.getFile() method?
This works fine when I deploy war as exploded. But my requirement is deploy as WAR only.
You can check if Spring is the problem by looking into the wl_cls_gen.jar file. Does it have your XML ?
If the XML is missing, it is a problem with weblogic. If you have time to wait, ask the WL support team about the problem and a possible resolution.
If you cannot wait, the easiest thing to do is to remove the file from classes and put it some where else on the class path. Or modify the code to read the file from a standard location that is common to all your environments. For example read from '/usr/data/project/properties.props' on all environments to get around the problem.
I read something about a fast swap method. That might help also. Do you have some sample source code that can be used to replicate the problem ?
Joined: Oct 26, 2009
Well, I never mentioned XMLs are missing. They are bundled into a _wls_cls_gen.jar from classes folder into web-inf/lib folder. And I can't put my XMLs into a location from where I can read as the application itself is product which is used by few clients. And again fast swap method is supported only in DEV mode. So using the same in PROD is out of question.
Ah ok. I assumed that WL was discarding it when packaging.
And again fast swap method is supported only in DEV mode. So using the same in PROD is out of question.
Thanks for letting me know that. I have never used fast swap myself but came across it a few days back.
If you find a solution let us know what it is. I will try to replicate the problem if time allows
Joined: Oct 26, 2009
finally some work around. It looks like there is no way we can stop weblogic NOT to generate _wl_cls_gen.jar file. One way is modify the code, instead of using ResourceUtils.getFile() method, we used ClasspathResource with combination of InputStream. That fixed the issue.
It looks Spring's ResourceUtils.getFile() definitely have a bug in reading XMLs from web-inf/classes folder in WAR deployment.