-
1. Re: @named bean methods not called from EL
jharting Jan 14, 2015 6:37 AM (in response to nandagopal1987)Hi Nandagopal,
JBoss AS 7.1.1 is pretty old. I suggest that you upgrade to WildFly 8.
-
2. Re: @named bean methods not called from EL
nandagopal1987 Jan 14, 2015 6:52 AM (in response to jharting)Thanks for the swift reply.
I understand that JBoss AS 7.1.1 is pretty old. I just want to understand the specification better.
So it should always be possible in an application to call a method from a @named bean from a jar via EL from a war.
Am i correct?
-
3. Re: @named bean methods not called from EL
mkouba Jan 14, 2015 7:20 AM (in response to nandagopal1987)Hi Nandagopal,
the @Named bean must be visible from the WAR. What's the structure of your application?
-
4. Re: @named bean methods not called from EL
nandagopal1987 Jan 14, 2015 7:56 AM (in response to mkouba)I hope you mean the deployment structure as in jboss-deployment-structure.xml !
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment ear-subdeployments-isolated="false">
<dependencies>
<module name="javax.faces.api" export="true" />
<module name="org.apache.log4j" export="true" />
<module name="org.dom4j" export="true" />
<module name="org.apache.commons.logging" export="true" />
<module name="org.apache.commons.collections" export="true" />
<module name="org.apache.commons.configuration" export="true" />
<module name="org.apache.xerces" export="true" />
<module name="org.apache.xalan" export="true" />
<module name="org.apache.commons.digester" export="true" />
<module name="org.apache.httpcomponents" export="true" />
</dependencies>
</deployment>
<sub-deployment name="J2EE-BillingDocumentWeb.war">
<dependencies>
<module name="org.richfaces" slot="4.3.1.Final" >
<imports>
<include path="**"/>
</imports>
</module>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
-
5. Re: @named bean methods not called from EL
mkouba Jan 14, 2015 8:04 AM (in response to nandagopal1987)No, I mean whether it's an EAR or a WAR, what and where are you modules (e.g. an EJB module or a shared lib in WEB-INF/lib), etc. I'm sorry for not being more specific.
-
6. Re: @named bean methods not called from EL
nandagopal1987 Jan 14, 2015 8:18 AM (in response to mkouba)It is a WAR and all my modules are EJB modules
Something like this
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee"
version="6"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd">
<module>
<ejb>Module1.jar</ejb>
</module>
<module>
<ejb>Module2.jar</ejb>
</module>
<module>
<web>
<web-uri>J2EE-BillingDocumentWeb.war</web-uri>
<context-root>BillingDocument</context-root>
</web>
</module>
</application>
-
7. Re: @named bean methods not called from EL
mkouba Jan 14, 2015 8:37 AM (in response to nandagopal1987)1 of 1 people found this helpfulSo your application is packaged as an EAR, an EL expression is declared in a WAR module and @Named bean is packaged in an EJB module. By default, WARs don't see the classes from EJB modules. You must have ear-subdeployments-isolated set to false (default, non-portable) or have a Class-Path entry in the MANIFEST.MF of the WAR (portable). See also https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7#ClassLoadinginAS7-EARClassLoading.
-
8. Re: @named bean methods not called from EL
nandagopal1987 Jan 14, 2015 9:12 AM (in response to mkouba)Thanks a lot for the quick reply .
Yes i do have the ear-subdeployments-isolated set to false, it was working previously as expected ( weld-core-1.1.5.AS71.Final).
It stopped working after I upgraded my weld version (weld-core-1.1.26.Final)
I don't understand why it should stop working! I guess there is no solution for this other than upgrading by application server ! or is there ?
I was confused because i was not sure whether it was technically allowed and correct to have @Named beans packaged in an EJB module.
Is it bad practice or is it perfectly normal ?
-
9. Re: @named bean methods not called from EL
mkouba Jan 14, 2015 9:43 AM (in response to nandagopal1987)It seems that WELD-1589 is related. However, it's only fixed in the JBoss EAP codebase. So you could either switch to Red Hat JBoss Enterprise Application Platform (supported version of AS7, has a free developer version) or upgrade to WildFly.
I was confused because i was not sure whether it was technically allowed and correct to have @Named beans packaged in an EJB module.
Is it bad practice or is it perfectly normal ?
I would say it's not a good idea but it should work.