You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Christian Beikov <ch...@gmail.com> on 2012/09/06 22:06:33 UTC
MyFaces CODI within EAR
Hello!
I am trying to package the codi jsf 2 bundle 1.0.5 within my ear but I
am getting some exceptions like:
java.lang.NoClassDefFoundError: javax/faces/bean/ViewScoped
I have placed the bundle in EAR/lib since I have 2 Webapps that use CODI.
Is it even possible to use CODI in such a scenario? Could you please
provide some details on how CODI is supposed to be packaged within an EAR?
Regards,
Christian
Re: MyFaces CODI within EAR
Posted by Christian Beikov <ch...@gmail.com>.
No problem Mark ;)
I am using 7.1.0 since 7.1.1 comes with a buggy mojarra version. The
class loading things are well documented in the wiki and I also think
that this behavior is intended, but anyway, give it a try and report it
to them.
I would be more happy, if there was a 7.1.2 release with version
updates, but that will probably not come until weld 2 is out <.<
Regards,
Christian
Am 07.09.2012 14:24, schrieb Mark Struberg:
> Sorry Christian, saw your mail only now.
>
> You solution makes perfect sense. Didn't know JBoss AS tries to start CDI with not having all the ClassPath in place. I sense some more problems will hit you in this case. What JBossAS version do you use exactly? I would report this issue to the JBoss team. Guess they are happy about such a feedback!
>
> LieGrue,
> strub
>
>
>
>
> ----- Original Message -----
>> From: Christian Beikov <ch...@gmail.com>
>> To: users@myfaces.apache.org
>> Cc:
>> Sent: Friday, September 7, 2012 7:36 AM
>> Subject: Re: MyFaces CODI within EAR
>>
>> Well, it took me some time, but I figured out that JBoss AS does not add the JSF
>> stuff to the classpath when starting CODI. The solution for JBoss AS7 to get
>> CODI working when located in EAR/lib finally is:
>>
>> Add a jboss-deployment-structure.xml file to EAR/META-INF that looks like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <jboss-deployment-structure>
>> <!-- Make sub deployments isolated by default, so they cannot see each
>> others
>> classes without a Class-Path entry -->
>> <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
>> <!-- This corresponds to the top level deployment. For a war this is the
>> war's module, for an ear -->
>> <!-- This is the top level ear module, which contains all the classes in
>> the EAR's lib folder -->
>> <deployment>
>> <!-- This allows you to define additional dependencies, it is the
>> same
>> as using the Dependencies: manifest attribute -->
>> <dependencies>
>> <module name="org.w3c.css.sac" />
>> <module name="net.sourceforge.cssparser" />
>> <module name="com.sun.jsf-impl" />
>> <module name="javax.api" />
>> <module name="javax.faces.api" />
>> <module name="javax.xml.bind.api" />
>> <module name="javax.xml.jaxp-provider" />
>> <module name="com.google.guava" />
>> </dependencies>
>> </deployment>
>> </jboss-deployment-structure>
>>
>> This will make everything that is somehow jsf specific available for the CODI
>> jar. Hope this might help someone else.
>>
>> Regards,
>> Christian
>>
>> Am 06.09.2012 22:29, schrieb Mark Struberg:
>>> Hi christian!
>>>
>>> Yes, this is perfectly possible. You just have to move all your JSF deps
>> which are needed by CODI to a shared jar (in an EAR lib).
>>> myfaces-api.jar myfaces-impl.jar, el, etc. All the stuff which is
>> (transitively) required on the classpath.
>>> I have this scenario running over here with 12 webapps in an EAR (with
>> ClassLoader isolation).
>>>
>>> LieGrue,
>>> strub
>>>
>>>
>>>
>>>
>>> ----- Original Message -----
>>>> From: Christian Beikov <ch...@gmail.com>
>>>> To: MyFaces Discussion <us...@myfaces.apache.org>
>>>> Cc:
>>>> Sent: Thursday, September 6, 2012 10:06 PM
>>>> Subject: MyFaces CODI within EAR
>>>>
>>>> Hello!
>>>>
>>>> I am trying to package the codi jsf 2 bundle 1.0.5 within my ear but I
>> am
>>>> getting some exceptions like:
>>>>
>>>> java.lang.NoClassDefFoundError: javax/faces/bean/ViewScoped
>>>>
>>>> I have placed the bundle in EAR/lib since I have 2 Webapps that use
>> CODI.
>>>> Is it even possible to use CODI in such a scenario? Could you please
>> provide
>>>> some details on how CODI is supposed to be packaged within an EAR?
>>>>
>>>> Regards,
>>>> Christian
>>>>
Re: MyFaces CODI within EAR
Posted by Mark Struberg <st...@yahoo.de>.
Sorry Christian, saw your mail only now.
You solution makes perfect sense. Didn't know JBoss AS tries to start CDI with not having all the ClassPath in place. I sense some more problems will hit you in this case. What JBossAS version do you use exactly? I would report this issue to the JBoss team. Guess they are happy about such a feedback!
LieGrue,
strub
----- Original Message -----
> From: Christian Beikov <ch...@gmail.com>
> To: users@myfaces.apache.org
> Cc:
> Sent: Friday, September 7, 2012 7:36 AM
> Subject: Re: MyFaces CODI within EAR
>
> Well, it took me some time, but I figured out that JBoss AS does not add the JSF
> stuff to the classpath when starting CODI. The solution for JBoss AS7 to get
> CODI working when located in EAR/lib finally is:
>
> Add a jboss-deployment-structure.xml file to EAR/META-INF that looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jboss-deployment-structure>
> <!-- Make sub deployments isolated by default, so they cannot see each
> others
> classes without a Class-Path entry -->
> <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
> <!-- This corresponds to the top level deployment. For a war this is the
> war's module, for an ear -->
> <!-- This is the top level ear module, which contains all the classes in
> the EAR's lib folder -->
> <deployment>
> <!-- This allows you to define additional dependencies, it is the
> same
> as using the Dependencies: manifest attribute -->
> <dependencies>
> <module name="org.w3c.css.sac" />
> <module name="net.sourceforge.cssparser" />
> <module name="com.sun.jsf-impl" />
> <module name="javax.api" />
> <module name="javax.faces.api" />
> <module name="javax.xml.bind.api" />
> <module name="javax.xml.jaxp-provider" />
> <module name="com.google.guava" />
> </dependencies>
> </deployment>
> </jboss-deployment-structure>
>
> This will make everything that is somehow jsf specific available for the CODI
> jar. Hope this might help someone else.
>
> Regards,
> Christian
>
> Am 06.09.2012 22:29, schrieb Mark Struberg:
>> Hi christian!
>>
>> Yes, this is perfectly possible. You just have to move all your JSF deps
> which are needed by CODI to a shared jar (in an EAR lib).
>> myfaces-api.jar myfaces-impl.jar, el, etc. All the stuff which is
> (transitively) required on the classpath.
>>
>> I have this scenario running over here with 12 webapps in an EAR (with
> ClassLoader isolation).
>>
>>
>> LieGrue,
>> strub
>>
>>
>>
>>
>> ----- Original Message -----
>>> From: Christian Beikov <ch...@gmail.com>
>>> To: MyFaces Discussion <us...@myfaces.apache.org>
>>> Cc:
>>> Sent: Thursday, September 6, 2012 10:06 PM
>>> Subject: MyFaces CODI within EAR
>>>
>>> Hello!
>>>
>>> I am trying to package the codi jsf 2 bundle 1.0.5 within my ear but I
> am
>>> getting some exceptions like:
>>>
>>> java.lang.NoClassDefFoundError: javax/faces/bean/ViewScoped
>>>
>>> I have placed the bundle in EAR/lib since I have 2 Webapps that use
> CODI.
>>> Is it even possible to use CODI in such a scenario? Could you please
> provide
>>> some details on how CODI is supposed to be packaged within an EAR?
>>>
>>> Regards,
>>> Christian
>>>
>
Re: MyFaces CODI within EAR
Posted by Christian Beikov <ch...@gmail.com>.
Well, it took me some time, but I figured out that JBoss AS does not add
the JSF stuff to the classpath when starting CODI. The solution for
JBoss AS7 to get CODI working when located in EAR/lib finally is:
Add a jboss-deployment-structure.xml file to EAR/META-INF that looks
like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<!-- Make sub deployments isolated by default, so they cannot see
each others
classes without a Class-Path entry -->
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this
is the
war's module, for an ear -->
<!-- This is the top level ear module, which contains all the
classes in
the EAR's lib folder -->
<deployment>
<!-- This allows you to define additional dependencies, it is
the same
as using the Dependencies: manifest attribute -->
<dependencies>
<module name="org.w3c.css.sac" />
<module name="net.sourceforge.cssparser" />
<module name="com.sun.jsf-impl" />
<module name="javax.api" />
<module name="javax.faces.api" />
<module name="javax.xml.bind.api" />
<module name="javax.xml.jaxp-provider" />
<module name="com.google.guava" />
</dependencies>
</deployment>
</jboss-deployment-structure>
This will make everything that is somehow jsf specific available for the
CODI jar. Hope this might help someone else.
Regards,
Christian
Am 06.09.2012 22:29, schrieb Mark Struberg:
> Hi christian!
>
> Yes, this is perfectly possible. You just have to move all your JSF deps which are needed by CODI to a shared jar (in an EAR lib).
> myfaces-api.jar myfaces-impl.jar, el, etc. All the stuff which is (transitively) required on the classpath.
>
> I have this scenario running over here with 12 webapps in an EAR (with ClassLoader isolation).
>
>
> LieGrue,
> strub
>
>
>
>
> ----- Original Message -----
>> From: Christian Beikov <ch...@gmail.com>
>> To: MyFaces Discussion <us...@myfaces.apache.org>
>> Cc:
>> Sent: Thursday, September 6, 2012 10:06 PM
>> Subject: MyFaces CODI within EAR
>>
>> Hello!
>>
>> I am trying to package the codi jsf 2 bundle 1.0.5 within my ear but I am
>> getting some exceptions like:
>>
>> java.lang.NoClassDefFoundError: javax/faces/bean/ViewScoped
>>
>> I have placed the bundle in EAR/lib since I have 2 Webapps that use CODI.
>> Is it even possible to use CODI in such a scenario? Could you please provide
>> some details on how CODI is supposed to be packaged within an EAR?
>>
>> Regards,
>> Christian
>>
Re: MyFaces CODI within EAR
Posted by Christian Beikov <ch...@gmail.com>.
I am working on JBoss AS 7, so do I really need to package the jsf api
and impl within the EAR/lib?
If I understand you right, I should have something like:
EAR
- lib
- jsf-api.jar
- jsf-impl.jar
- myfaces-extcdi-jsf2-bundle.jar
- WAR1
- WAR2
Regards,
Christian
Am 06.09.2012 22:29, schrieb Mark Struberg:
> Hi christian!
>
> Yes, this is perfectly possible. You just have to move all your JSF deps which are needed by CODI to a shared jar (in an EAR lib).
> myfaces-api.jar myfaces-impl.jar, el, etc. All the stuff which is (transitively) required on the classpath.
>
> I have this scenario running over here with 12 webapps in an EAR (with ClassLoader isolation).
>
>
> LieGrue,
> strub
>
>
>
>
> ----- Original Message -----
>> From: Christian Beikov <ch...@gmail.com>
>> To: MyFaces Discussion <us...@myfaces.apache.org>
>> Cc:
>> Sent: Thursday, September 6, 2012 10:06 PM
>> Subject: MyFaces CODI within EAR
>>
>> Hello!
>>
>> I am trying to package the codi jsf 2 bundle 1.0.5 within my ear but I am
>> getting some exceptions like:
>>
>> java.lang.NoClassDefFoundError: javax/faces/bean/ViewScoped
>>
>> I have placed the bundle in EAR/lib since I have 2 Webapps that use CODI.
>> Is it even possible to use CODI in such a scenario? Could you please provide
>> some details on how CODI is supposed to be packaged within an EAR?
>>
>> Regards,
>> Christian
>>
Re: MyFaces CODI within EAR
Posted by Mark Struberg <st...@yahoo.de>.
Hi christian!
Yes, this is perfectly possible. You just have to move all your JSF deps which are needed by CODI to a shared jar (in an EAR lib).
myfaces-api.jar myfaces-impl.jar, el, etc. All the stuff which is (transitively) required on the classpath.
I have this scenario running over here with 12 webapps in an EAR (with ClassLoader isolation).
LieGrue,
strub
----- Original Message -----
> From: Christian Beikov <ch...@gmail.com>
> To: MyFaces Discussion <us...@myfaces.apache.org>
> Cc:
> Sent: Thursday, September 6, 2012 10:06 PM
> Subject: MyFaces CODI within EAR
>
> Hello!
>
> I am trying to package the codi jsf 2 bundle 1.0.5 within my ear but I am
> getting some exceptions like:
>
> java.lang.NoClassDefFoundError: javax/faces/bean/ViewScoped
>
> I have placed the bundle in EAR/lib since I have 2 Webapps that use CODI.
> Is it even possible to use CODI in such a scenario? Could you please provide
> some details on how CODI is supposed to be packaged within an EAR?
>
> Regards,
> Christian
>