difference between .jar and exploded directory

Posted on 2003-04-01
Medium Priority
Last Modified: 2013-12-10
Hello, I'm using WL6.1sp3 and I have an application declared in config.xml as follows:

<Application Deployed="true" Name="xxx" Path="./config/prov/applications/myAppli">
  <EJBComponent DeploymentOrder="6" Name="commun" Targets="artemisServer" URI="commun"/> ...
  <EJBComponent DeploymentOrder="8" Name="usecases" Targets="artemisServer" URI="usecases"/> ...

I use two exploded directories under /config/prov/applications/myAppli : commun/*.class and usecases/*.class

The EJBs in usecases depend on classes found in /commun. They are not in the classpath and the manifest class- path is empty for both modules.

When I start the server everything works fine, both modules deploy OK.

Now, if I pack the content of /usecases into a jar - usecases.jar, it won't deploy anymore !!! reason : it tells me it cannot find classes from /commun !

So where is the difference between the exploded and the jar format?
Does anyone have an idea?

here is a trace:

####<Mar 21, 2003 3:54:50 PM GMT+01:00> <Error> <Management> <s02c10> <artemisServer> <main> <system> <> <140002> <InvocationTargetException setting attribute Deployed on MBean prov:Location=artemisServer,Name=artemis_business,Type=ApplicationConfig to value true. Method: public void weblogic.management.mbeans.custom.Application.setDeployed(boolean) throws weblogic.management.DeploymentException,weblogic.management.UndeploymentException>

Unable to deploy EJB: /users/applix/artemis5/util512/server/./config/prov/applications/.wlnotdelete/ wl_comp65472.jar from usecases.jar:

java.lang.NoClassDefFoundError: commun/utils/AbstractInjecteur at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:486) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111) at java.net.URLClassLoader.defineClass(URLClassLoader.java:248) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:297) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286) at java.lang.ClassLoader.loadClass(ClassLoader.java:290) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at weblogic.ejb20.deployer.BeanInfoImpl.loadClass(BeanInfoImpl.java:304) at weblogic.ejb20.deployer.BeanInfoImpl.<init>(BeanInfoImpl.java:155) at weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.<init>(ClientDrivenBeanInfoImpl.java:157) at weblogic.ejb20.deployer.SessionBeanInfoImpl.<init>(SessionBeanInfoImpl.java:103) at weblogic.ejb20.deployer.BeanInfoImpl.createBeanInfoImpl(BeanInfoImpl.java:334) at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeBeanInfos(MBeanDeploymentInfoImpl.java:395) at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:126) at weblogic.ejb20.deployer.Deployer.deploy(Deployer.java:903) at weblogic.j2ee.EJBComponent.deploy(EJBComponent.java:31) at weblogic.j2ee.Application.deploy(Application.java:258) at weblogic.j2ee.J2EEService.deployApplication(J2EEService.java:190) at weblogic.management.mbeans.custom.Application.setLocalDeployed(Application.java:366) at weblogic.management.mbeans.custom.Application.setDeployed(Application.java:300) at java.lang.reflect.Method.invoke(Native Method) at weblogic.management.internal.DynamicMBeanImpl.invokeSetter(DynamicMBeanImpl.java:1401) at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:894) at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:847) at weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(ConfigurationMBeanImpl.java:296) at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1358) at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1333) at weblogic.management.internal.ConfigurationMBeanImpl.updateConfigMBeans(ConfigurationMBeanImpl.java:393) at weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(ConfigurationMBeanImpl.java:299) at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1358) at com.sun.management.jmx.MBeanServerImpl.setAttribute(MBeanServerImpl.java:1333) at weblogic.management.internal.MBeanProxy.setAttribute(MBeanProxy.java:322) at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:204) at $Proxy9.setDeployed(Unknown Source) at weblogic.management.mbeans.custom.ApplicationManager.autoDeploy(ApplicationManager.java:907) at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:857) at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:748) at weblogic.management.mbeans.custom.ApplicationManager.update(ApplicationManager.java:206) at weblogic.management.mbeans.custom.ApplicationManager.startAdminManager(ApplicationManager.java:278) at weblogic.management.mbeans.custom.ApplicationManager.start(ApplicationManager.java:152) at java.lang.reflect.Method.invoke(Native Method) at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636) at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621) at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557) at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525) at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468) at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209) at $Proxy5.start(Unknown Source) at weblogic.management.Admin.startApplicationManager(Admin.java:1238) at weblogic.management.Admin.finish(Admin.java:644) at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524) at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207) at weblogic.Server.main(Server.java:35)
Question by:adi24
  • 3
  • 3
  • 2

Expert Comment

ID: 8295283
You need to put this jar under WEB-INF/lib directory.
have you done that ?

Expert Comment

ID: 8320456
Check your classpath to see if you are looking for usecases.jar. If so that means if u unjar it into a directory it will not be able to find the class you are looking for.


Author Comment

ID: 8325172
Hello and thank you both for helping me!

For findsandeep:
I'm not sure I understand :
Primo, the two jars I have are EJBComponents so I must have them in the /applications/myApplication directory so that they can deployed.
Secondo, I want to hot redeploy them
Terzo, putting the jar under WEB-INF/lib will allow the web-application to see this jar, but will not solve my deployment problem
Maybe I am wrong, but I don't see any link between the deployment of an EJB module and /WEB-INF/lib

For syd108:
I did not put my two jars into the classpath because I want to hot redeploy them. I checked once again to make sure and they are not in the classpath.
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.


Expert Comment

ID: 8325492
Hi Adi.

1. There is a difference in between putting your ejb jar under applications or under /WEB-INF/lib(with xml in /WEB-INF). If you jar is a part of ur webapp u need to do second.
2. But as ur requirement says u need to hot deploy that ejb. then those need to be independent and inside applications directory itself. But still you need to put ur ejb classes under /WEB-INF/lib, so that ur web-app  can ejb classes, as that is loaded by another class loader.

To achive to deploy and call ejb from ur web-app.

1. EJB.jar should come under applications. and it should contain all the classes, as it loaded from a different classes loader, it can not see classes from any other web-app.

2. To call this EJB from web-app. web-app should atleast have client classes of ejb, (Remote etc).

Author Comment

ID: 8353121
Hello findsandeep - cool name btw :-)

I don't think we are talking exactly about the same thing. I do not want to call EJBs from my WebAppllication. I didn't mention the webApp in my question - let's forget it, suppose it does not exist.
I'll try to restate my question more clearly:
I have in the /applications/myApplications two ejb.jars;
when trying to deploy them, ejb1.jar deploys fine, but ejb2.jar whose classes depend on classes of ejb1.jar fails to deploy
- and this happens only if i use jars - when performing the same operation in exploded mode it works fine !
That is the aim of my question : "why do classes in /ejb2 see classes in /ejb1 at deployment, but classes in ejb2.jar do not see classes in ejb1.jar? with nothing else changed in my configuration"

Accepted Solution

findsandeep earned 60 total points
ID: 8353861
Hi Adi,
   See when you put number of ejb jars in applications directory, All at those are loaded by different classloaders and they can not see each others's classes. So for example if both have some class called A.java. the class A in ejb1.jar is different from Class A in ejb2.jar.

But if you deploy them in exploded from and putting under same applications
<Application Deployed="true" Name="xxx" Path="./config/prov/applications/myAppli">

all the classes of ejb1 and ejb2 are loaded by same classloader responsible to load application xxx. and both are able to see each other classes.

But if you deploy them independently both will not be able to see each others classes.

Please read this article


Expert Comment

ID: 8354310
Ok this is what you need to do. Add the two jar files in a ear file and then try deploying them. (When using ear files you should be able to specify the class path in the manifest file)

This way you can overcome the class loader problem and also the re-deployment issue


Author Comment

ID: 8354419
For finds&deep:
Yes, now I understand and it makes sense. I knew that all classes in exploded mode are loaded by the same classloader and I supposed that for jars it's the same thing -> because at the bea site they say a thousand times that there is absolutely no difference between exploded and packed mode for a component !!! Thank you for your answer(s).

For Syd: I know that in an EAR with manifest class-path it would work, but I cannot apply this to my project. Thank you anyways!

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question