-
1. Re: Sharing class in 2 war applications
peterj Jan 21, 2010 6:38 PM (in response to mrhaneef)You cannot share classes within a WAR with any other applications - this is according to the spec. What you need to do is place the shared classes into a JAR. You cna then place the JAR into the server's lib directory, or place both your WARs and the JAR into an exploded EAR (that is what I would do).1 of 1 people found this helpful -
2. Re: Sharing class in 2 war applications
mrhaneef Feb 23, 2010 10:24 AM (in response to peterj)Hi,
Thanks for reply, I did loaded the applications with EAR and in exploded form,
but the new web application is still not using the old web applications classes.
Is there a special setting I am missing. It would be nice to have a reference of
loading the applications with EAR. I am using jboss 4.2.2
-
3. Re: Sharing class in 2 war applications
peterj Feb 23, 2010 12:39 PM (in response to mrhaneef)I am not sure what you have done. I do not know what this statement:
"I did loaded the applications with EAR and in exploded form,"
has to do with what I posted previously. Did you include the old classes in your app or did you not? Also, it would help if you were specific. In other words, which class is not being found by the new app, and exactly where is the class located within the EAR. I assume that the EAR is the new app.
-
4. Re: Sharing class in 2 war applications
mrhaneef Feb 23, 2010 1:15 PM (in response to peterj)I created a new EAR app and add both new and old web applications to EAR.
In eclipse I give the old application as ference to the new one and
its not giving any errors, but when I deploy them (in EAR) the new app
is not find the classes in the old one.
new app:
import com.xx.yy.data.Values;
public class PServlet extends ServletBase {
}
Old apps has the class
com.xx.yy.data.Values;
Thanks
-
5. Re: Sharing class in 2 war applications
peterj Feb 23, 2010 1:27 PM (in response to mrhaneef)You never posted this:
"exactly where is the class located within the EAR"
Also, please post the full contents of the EAR. Since you have an exploded EAR, use dir or ls to get a file listing including subdirectories.
-
6. Re: Sharing class in 2 war applications
mrhaneef Feb 23, 2010 1:42 PM (in response to peterj)testEAR.ear
abOld.war
public
WEB-INF
classes
com
xx
yy
data
Values
lib
abNew.warhelp
WEB-INF
classes
com
xx
yy
servlets
lib
META-INFapplication.xml
-
7. Re: Sharing class in 2 war applications
peterj Feb 23, 2010 2:51 PM (in response to mrhaneef)1 of 1 people found this helpfulAs I stated in my first post:
"You cannot share classes within a WAR with any other applications"
-
8. Re: Sharing class in 2 war applications
mrhaneef Feb 23, 2010 3:23 PM (in response to peterj)I guess there is no real solution to this problem other then making the
common jar between to war. does enterprise version of jboss supports
the sharing of resouces? It would be good to have this feature controlled
by user/developer. Thanks for all your help.
-
9. Re: Sharing class in 2 war applications
peterj Feb 23, 2010 3:34 PM (in response to mrhaneef)As I said in my first post, the inability to share classes between WARs is part of the Java EE spec. Paying for the enterprise version will not change that. The correct way to share classes is to place them in a JAR within the EAR; I menitoned that in my first post also.