wood burning stoves*
The moose likes BEA/Weblogic and the fly likes Where is _wl_cls_gen.jar coming from? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Where is _wl_cls_gen.jar coming from?" Watch "Where is _wl_cls_gen.jar coming from?" New topic
Author

Where is _wl_cls_gen.jar coming from?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

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?

- Dave
Rajiv Dadhich
Greenhorn

Joined: Jan 22, 2009
Posts: 5
hi all,
i am also facing same problem.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Its probably a weblogic generated file. How about redeploying the WAR after deleting it ?

Usually when we have such caching problems with source code we delete the contents of the staging folder and try again (In DEV of course ).

Does that help ? Can you describe your problem a little more elaborately ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Rajiv Dadhich
Greenhorn

Joined: Jan 22, 2009
Posts: 5
hi,
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.
Andy Kay
Greenhorn

Joined: Oct 26, 2009
Posts: 29
Folks,

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.

Please share your thoughts.

Thanks.
Andy


http://ananthkannan.blogspot.com
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

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 ?
Andy Kay
Greenhorn

Joined: Oct 26, 2009
Posts: 29
Deepak,

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.

Anyways thanks for your help!

Andy
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Well, I never mentioned XMLs are missing


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
Andy Kay
Greenhorn

Joined: Oct 26, 2009
Posts: 29
Folks,

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.

Hope this helps.

Andy
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Thank you for sharing the solution. Out of curiosity, does the getResourceAsStream method help you ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Where is _wl_cls_gen.jar coming from?