Re: Multiple Struts2 WAR in a single EAR

2008-06-12 Thread Hugo de Paix de Coeur
Thanks for your advices...

Sure, the first configuration I tried was to put struts jars in each
.war/WEB-INF/lib.

For those interested, a good link on classloaders : 
https://glassfish.dev.java.net/nonav/javaee5/docs/DG/beade.html

But it doesn't work with Glassfish in this configuration because of xwork as 
I've already
pointed out :

--
[#|2008-06-12T11:22:06.192+0200|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=20;_ThreadName=httpWorkerThread-4848-0;_RequestID=48141413-1d12-4d21-918f-3950921f55ab;|WebModule[/ProjectB]PWC1270:
Exception starting filter Struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - 
jar:file:/Users/hugo/local/glassfish/domains/dev/applications/j2ee-apps/AgaVision/ProjectB_war/WEB-INF/lib/struts2-core-2.0.11.1.jar!/struts-default.xml:30:72

 skipped stackTrace 

Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name 
xwork has already been loaded by bean -
jar:file:/Users/hugo/local/glassfish/domains/dev/applications/j2ee-apps/AgaVision/ProjectA_war/WEB-INF/lib/struts2-core-2.0.11.1.jar!/struts-default.xml:30:72
- bean -
jar:file:/Users/hugo/local/glassfish/domains/dev/applications/j2ee-apps/AgaVision/ProjectB_war/WEB-INF/lib/struts2-core-2.0.11.1.jar!/struts-default.xml:30:72
--

It seems there are problems like this as stated in this interesting
forum entry : http://forums.java.net/jive/thread.jspa?messageID=260375

But I tried both class loader configuration in sun-web.xml descriptors  with 
the same result (see
stacktrace above).

---
Default sun-web.xml : 


Modified sun-web.xml :

This configuration use firstly the childs classloaders before to
delegate.
---

Tips :
- I've searched for other remaining struts jars but have not found any.
- I deploy directly from Eclipse, or export the ear from Eclipse and
  deploy it manually (Only 2 xwork references in the ear : 1 in each
  .war/WEB-INF/lib)   

I'm stuck with only one struts project by application for now...

On Wed, Jun 11, 2008 at 03:12:07PM +0200, Marc Ende wrote:
> In general it isn't a good idea to put those custom libs (like 
> struts.jar, spring.jar) etc. in classloaders of the main
> appserver. They should be in the applications-classloader so you can 
> avoid classloader-issues like leaks.
> 
> If you've got the first error it sounds to me that you've got the xwork 
> libs on ear level. If it's in web-inf/lib it shouldn't "see"
> each other. The classloaders _should_ be seperated. I'm not sure if 
> glassfish handles it correctly but I would think so.
> May be you've got another xwork.jar somewhere else, which is loaded at 
> first (such thing can happen if you build using maven and forgets to run 
> a clean before final build.)
> 
> If you've got two identically xwork.jars (or struts.jars) in the 
> classpath or in parent classpaths they will be considered as two
> different types/versions. So I would think that you'll have a xwork.jar 
> somewhere in your parent classpath.
> 
> The second error occures if the loaded classes from lib/ext didn't find 
> the dependent classes within the current and in one of the parent 
> classloaders (up to the bootclassloader). If the javax.servlet.Filter is 
> loaded by a seperate classloader (which might be a child of the 
> classloader (which loads the classes from lib/ext) it wouldn't  be found 
> by the lib/ext classes.
> 
> 
> Hugo de Paix de Coeur schrieb:
> >In fact, this was my second question, so I ask it now :)
> >
> >I have had problems with deploying *struts*.jar in this special
> >configuration (2 war in an ear).
> >- I tries to put them in each .war WEB-INF/lib
> >  => "Error : xwork...ObjectFactory already loaded in bean projectA" at 
> >  projectB deployment.
> >- I tries to put them in glassfish domain lib/ext
> >  => "Error : ClassLoader : Can't find javax.servlet.Filter"
> >
> >So, they are for now in the glassfish "main" lib.. but there are
> >problems too .. at runtime.
> >
> >What is the correct installation scheme for struts.jar with this
> >configuration ?
> >
> >Thx...
> >
> >On Wed, Jun 11, 2008 at 02:31:13PM +0200, Marc Ende wrote:
> >  
> >>Hello,
> >>
> >>do you deploy the struts.jar in the ear or in the WEB-INF/lib folders of 
> >>the war-files?
> >>if they're in the WEB-INF/lib folders they should be seperate.
> >>
> >>Marc
> >>
> >>
> >>Hugo de Paix de Coeur schrieb:
> >>
> >>>Hello,
> >>>
> >>>I'm currently trying to deploy two Struts2 enabled .war in a single
> >>>.ear on Glassfish.
> >>>
> >>>My problem is : I've no isolation between the 2 projects at the action
> >>>dispatcher level.
> >>>
> >>>
> >>>Project A WAR struts.xml : 
> >>>
> >>>
> >>>
> >>>
> >>>   
> >>>   /jsp/index.jsp
> >>>   
> >>>

Re: Multiple Struts2 WAR in a single EAR

2008-06-11 Thread Marc Ende
In general it isn't a good idea to put those custom libs (like 
struts.jar, spring.jar) etc. in classloaders of the main
appserver. They should be in the applications-classloader so you can 
avoid classloader-issues like leaks.


If you've got the first error it sounds to me that you've got the xwork 
libs on ear level. If it's in web-inf/lib it shouldn't "see"
each other. The classloaders _should_ be seperated. I'm not sure if 
glassfish handles it correctly but I would think so.
May be you've got another xwork.jar somewhere else, which is loaded at 
first (such thing can happen if you build using maven and forgets to run 
a clean before final build.)


If you've got two identically xwork.jars (or struts.jars) in the 
classpath or in parent classpaths they will be considered as two
different types/versions. So I would think that you'll have a xwork.jar 
somewhere in your parent classpath.


The second error occures if the loaded classes from lib/ext didn't find 
the dependent classes within the current and in one of the parent 
classloaders (up to the bootclassloader). If the javax.servlet.Filter is 
loaded by a seperate classloader (which might be a child of the 
classloader (which loads the classes from lib/ext) it wouldn't  be found 
by the lib/ext classes.



Hugo de Paix de Coeur schrieb:

In fact, this was my second question, so I ask it now :)

I have had problems with deploying *struts*.jar in this special
configuration (2 war in an ear).
- I tries to put them in each .war WEB-INF/lib
  => "Error : xwork...ObjectFactory already loaded in bean projectA" at 
projectB deployment.
- I tries to put them in glassfish domain lib/ext
  => "Error : ClassLoader : Can't find javax.servlet.Filter"

So, they are for now in the glassfish "main" lib.. but there are
problems too .. at runtime.

What is the correct installation scheme for struts.jar with this
configuration ?

Thx...

On Wed, Jun 11, 2008 at 02:31:13PM +0200, Marc Ende wrote:
  

Hello,

do you deploy the struts.jar in the ear or in the WEB-INF/lib folders of 
the war-files?

if they're in the WEB-INF/lib folders they should be seperate.

Marc


Hugo de Paix de Coeur schrieb:


Hello,

I'm currently trying to deploy two Struts2 enabled .war in a single
.ear on Glassfish.

My problem is : I've no isolation between the 2 projects at the action
dispatcher level.


Project A WAR struts.xml : 






/jsp/index.jsp




Project B WAR struts.xml : 






/jsp/index.jsp



/jsp/login.jsp






1- I can call 'http://localhost:8080/ProjectA/Login.action' and this is 
the 'com.web.projectB.Login' class that is executed (even if no Login 
action is specified in Project A) because they share the namespace '/'.


2- If I call 'http://localhost:8080/ProjectA/Index.action', this is the 
'com.web.projectB.Index' class that is executed (last struts.xml to be 
parsed ?)


I've no clues to resolve this problem (the use of different namespaces 
doesn't resolve the problem either)

Any idea ?

 
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Multiple Struts2 WAR in a single EAR

2008-06-11 Thread Hugo de Paix de Coeur
In fact, this was my second question, so I ask it now :)

I have had problems with deploying *struts*.jar in this special
configuration (2 war in an ear).
- I tries to put them in each .war WEB-INF/lib
  => "Error : xwork...ObjectFactory already loaded in bean projectA" at 
projectB deployment.
- I tries to put them in glassfish domain lib/ext
  => "Error : ClassLoader : Can't find javax.servlet.Filter"

So, they are for now in the glassfish "main" lib.. but there are
problems too .. at runtime.

What is the correct installation scheme for struts.jar with this
configuration ?

Thx...

On Wed, Jun 11, 2008 at 02:31:13PM +0200, Marc Ende wrote:
> Hello,
> 
> do you deploy the struts.jar in the ear or in the WEB-INF/lib folders of 
> the war-files?
> if they're in the WEB-INF/lib folders they should be seperate.
> 
> Marc
> 
> 
> Hugo de Paix de Coeur schrieb:
> >Hello,
> >
> >I'm currently trying to deploy two Struts2 enabled .war in a single
> >.ear on Glassfish.
> >
> >My problem is : I've no isolation between the 2 projects at the action
> >dispatcher level.
> >
> >
> >Project A WAR struts.xml : 
> >
> >
> >
> >
> > 
> > /jsp/index.jsp
> > 
> > 
> >
> >
> >Project B WAR struts.xml : 
> >
> >
> >
> >
> > 
> > /jsp/index.jsp
> > 
> > 
> > 
> > /jsp/login.jsp
> > 
> > 
> >
> >
> >
> >
> >1- I can call 'http://localhost:8080/ProjectA/Login.action' and this is 
> >the 'com.web.projectB.Login' class that is executed (even if no Login 
> >action is specified in Project A) because they share the namespace '/'.
> >
> >2- If I call 'http://localhost:8080/ProjectA/Index.action', this is the 
> >'com.web.projectB.Index' class that is executed (last struts.xml to be 
> >parsed ?)
> >
> >I've no clues to resolve this problem (the use of different namespaces 
> >doesn't resolve the problem either)
> >Any idea ?
> >
> >  
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Hugo de Paix de Coeur [Kabhal] 
Contacts: http://www.kabhal.org/~hugo

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Multiple Struts2 WAR in a single EAR

2008-06-11 Thread Marc Ende

Hello,

do you deploy the struts.jar in the ear or in the WEB-INF/lib folders of 
the war-files?

if they're in the WEB-INF/lib folders they should be seperate.

Marc


Hugo de Paix de Coeur schrieb:

Hello,

I'm currently trying to deploy two Struts2 enabled .war in a single
.ear on Glassfish.

My problem is : I've no isolation between the 2 projects at the action
dispatcher level.


Project A WAR struts.xml : 






/jsp/index.jsp




Project B WAR struts.xml : 






/jsp/index.jsp



/jsp/login.jsp






1- I can call 'http://localhost:8080/ProjectA/Login.action' and this is the 
'com.web.projectB.Login' class that is executed (even if no Login action is 
specified in Project A) because they share the namespace '/'.

2- If I call 'http://localhost:8080/ProjectA/Index.action', this is the 
'com.web.projectB.Index' class that is executed (last struts.xml to be parsed ?)

I've no clues to resolve this problem (the use of different namespaces doesn't 
resolve the problem either)
Any idea ?

  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Multiple Struts2 WAR in a single EAR

2008-06-11 Thread Hugo de Paix de Coeur
Hello,

I'm currently trying to deploy two Struts2 enabled .war in a single
.ear on Glassfish.

My problem is : I've no isolation between the 2 projects at the action
dispatcher level.


Project A WAR struts.xml : 





/jsp/index.jsp




Project B WAR struts.xml : 





/jsp/index.jsp



/jsp/login.jsp






1- I can call 'http://localhost:8080/ProjectA/Login.action' and this is the 
'com.web.projectB.Login' class that is executed (even if no Login action is 
specified in Project A) because they share the namespace '/'.

2- If I call 'http://localhost:8080/ProjectA/Index.action', this is the 
'com.web.projectB.Index' class that is executed (last struts.xml to be parsed ?)

I've no clues to resolve this problem (the use of different namespaces doesn't 
resolve the problem either)
Any idea ?

-- 
Kab

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]