wood burning stoves 2.0*
The moose likes BEA/Weblogic and the fly likes Do we have Application specific class-path? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Do we have Application specific class-path?" Watch "Do we have Application specific class-path?" New topic
Author

Do we have Application specific class-path?

Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
In my project, we have two web applications which refer the same jar file (let us call resourceBundle.jar). In our deployment machine the both web application are packed as an EAR file and both EAR has a separate copy of the resourceBundle.jar inside the EAR file.

In our local machine this resourceBundle.jar was added in the server class path, as both applications uses the same keys to load the values it breaks the application.
So to overcome this, I have added the resourceBundle.jar inside the WEB-INF\lib folder for the both web applications and removed the resourceBundle.jar from the server class path.

After restarting the server, both applications were unable to find the classes inside the jar….

I am know that if the jar files are placed inside the WEB-INF\lib folder it is very specific to that application and it will not shared with another application. But I was surprised that it does’t happen with weblogic 9.2….

I am sure that should be a way to achieve this which I was not aware… can you please help me …

Thanks for your help

My Thoughts : http://passion4java.blogspot.com
Try not to become a man of success but rather to become a man of value.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

mmm well weblogic can indeed detect this correctly. But where are these classes needed ? Are they needed by a jar that houses POJOs or are they needed inside an EJB jar ? Where you must place the jar might depend on the class loader hierarchy


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
bottom line is we have two has map with same keys, it should hold different values based on the application.

As we have this map (inside the jar) in the server path, both values are getting overridden both application got crashed...
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

If both applications use the same JAR, and you are sure that different versions of the jar will not be available at any point in time, you can go ahead and use the jar in the server's classpath. However it is a good practice to wrap the jar along with the ear. As long as a manifest entry is present the jar will be picked up
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Deepak I do agree if you make that as EAR it will be picked separately , but i thinking why the weblogic was not picking the jar which I placed in the web-inf/lib folder of the deployed application.
If that works, both applications will have separate jar and it will not be any more in server class-path…
I really don’t why this is not working… any thoughts
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Are these classes referenced from an EJB ? Can you wrap it along with the EAR's top level and include a manifest entry ? That will work
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
i want to solve this in my local development machine. if i make it as EAR every time for a small change i have to build the EAR and deploy again...
i will loose the hot deployment feature

Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Since it is just for DEV, you should have no problem putting the jar in the server's classpath ?
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Deepak if i put the jar in my server class then both application will use the same jar and the application will break

what i want is i want to keep the two seperate jar for each application, as you said i can achive by packing as EAR file and deploy

but in my machine i was deployed directly by giving the web application folder.... is there any other to do this???
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

ah ! I now understand what you are trying to say. Yes there is a way, but you are yet to tell me where this class is used. Is it used inside an EJB ? If you add a manifest.mf classpath entry and place it in the top level folder of the WAR, it should be picked up.
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
thats right deepak... actually the application consist of only servlet and jsp's but in our deployed machine that packing as a EAR file (which i really don't know what are they following this approach).....

Yes the jar is used by the EAR files inside the application, but i don't want to pack my classes as EAR or WAR in my local development machines ....

let me know if you have any questions
Niv Tyagi
Greenhorn

Joined: Oct 14, 2009
Posts: 21

You will need resourceBundle.jar added to META-INF/MANIFEST.MF file inside the ear file.
Not sure how you are building your ear file but make sure the above file and an entry for resourceBundle.jar.
eg.
Manifest-Version: 1.0
Class-Path:abce.jar, axy.jar,resourceBundle.jar
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Is there any way to set this class-path as we are setting in META-INF files, in the application which is not packed as a EAR or as a WAR file???

because in my local machine i was deployed directly pointing to the application root folder ...
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Mohammed Yousuff wrote:Is there any way to set this class-path as we are setting in META-INF files, in the application which is not packed as a EAR or as a WAR file???

because in my local machine i was deployed directly pointing to the application root folder ...


Exploded deployment should still be able to pickup the jar
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
So you mean to say adding meta-inf folder with required class path in a Exploded deployment will still work ???

in my experiance i was never saw a META-INF folder in a Exploded deployment... is that valid to have such things ?
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Yes it should still work regardless of whether the package is exploded or archived. At least from my experience I have found this to be true
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
deepak i have tried by adding below content in Manifest.MF file.

Manifest-Version: 1.0
Class-Path:lib/coreXYZ.jar


i have placed my coreXYZ.jar was inside WEB-INF/lib folder and tried , its not working ... when my servers starts it says that class not found error...

i also tried with below content also by adding WEB-INF folder infront of it ....

Manifest-Version: 1.0
Class-Path:WEB-INF/lib/coreXYZ.jar

is i am missing any thing here.... my biggest confusion is in war file what ever jar files which we add inside web-Inf/lib should be available when the application is running ??? which happens in Tomcat.....

but i have no idea why weblogic can't do ???

finally thank so much for all your comments
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Are you updating the entry manually ? Have you tried to write an ant task that uses the weblogic task ? The weblogic task can take with it a manifest or something like that. This was a long time back so I dont remember the exact details
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Deepak if we create manually or by using weblogic task going to be the same right?

Any way thank you so much for your help again.....


At last i was stilll wondering why weblogic was not picking up the jar which i placed in side WEB-INF/lib folder, i know this works in Tomcat .... but not with weblogic......

this really confuse me more
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Do we have Application specific class-path?