log4j2 2.10.0 will not deploy on jboss EAP 7 - jboss

Needed to update our log4j2 from 2.7 to 2.10.0 to get JMS retries working.
When I try to deploy the ear with the 2.10.0 files, jboss is complaining with the following error:
Caused by: java.util.ServiceConfigurationError:
org.apache.logging.log4j.util.PropertySource: Provider
org.apache.logging.log4j.util.EnvironmentPropertySource not a subtype"},
We are also excluding the default jboss logger from our app
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<module name="org.apache.log4j" />
<module name="org.apache.commons.logging"/>
<module name="org.apache.commons.logging" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.logmanager.log4j" />
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
These are the jars in my ear's lib folder for logging:
lib/log4j-api.jar
lib/log4j-core.jar
lib/log4j-slf4j-impl.jar
lib/log4j-web.jar
lib/slf4j-api.jar
lib/slf4j-ext.jar
Any suggestions? Maybe there is another new file I have to exclude?

Related

wildfly did not find jar inside war

After changing ear to war, wildfly 10 cant find the jar file from jboss-deployment-structure.xml from sub-deployment section. There is no gui.ejb.jar in war after project buildin and I copy it to war manually. I try to root folder and to WEB-INF lib. Help please how to fix it.
Caused by:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
WFLYSRV0166: Sub deployment gui.ejb.jar in
jboss-deployment-structure.xml was not found. Available sub
deployments: at
org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:288)
at
org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:190)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="webservices"/>
<subsystem name="jaxrs"/>
</exclude-subsystems>
<exclusions>
<module name="org.apache.commons.logging"/>
<module name="org.apache.log4j"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.logmanager.log4j"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.apache.cxf.impl"/>
<module name="org.apache.cxf"/>
<module name="org.apache.cxf.services-sts"/>
<module name="org.apache.cxf.ws-security"/>
<module name="org.apache.cxf.ws-policy"/>
<module name="org.apache.xerces"/>
<module name="org.apache.xalan"/>
</exclusions>
<dependencies>
<module name="com.sun.xml.bind" export="true"services="export"/>
<module name="javax.xml.ws.api" export="true"/>
<module name="javax.jws.api" export="true"/>
<module name="org.slf4j" export="true"/>
</dependencies>
</deployment>
<sub-deployment name="gui.ejb.jar">
<exclusions>
<module name="org.apache.xerces"/>
<module name="org.apache.xalan"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
</exclusions>
<dependencies>
<module name="com.sun.xml.bind" export="true"services="export"/>
<module name="javax.xml.ws.api" export="true" />
<module name="javax.jws.api" export="true" />
<module name="org.slf4j" export="true"/>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
A WAR deployment does not have a sub-deployment. You can remove the <sub-deployment/> element and it will be inherited from the main deployment element.
As a side note it looks a bit weird to both include and exclude the org.slf4j module. If you're attempting to use you're own slf4j binding you'd need to keep it excluded and include an slf4j-api and binding library.

wsdl file not deployed in jboss eap 7

I have been trying to migrating from jboss eap 5.1 to jboss eap 7. My .war file has been deployed successfully but not my .wsdl file. I have used jboss-deployment-structure.xml with the below code:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclude-subsystems>
<subsystem name="webservices" />
</exclude-subsystems>
<exclusions>
<module name="javaee.api" />
<module name="javax.ws"/>
</exclusions>
<dependencies>
<module name="javax.jws.api" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
Is there anything I have missed out?

Jboss configuration to load EAR jars for xerces and xalan

I have jars within my ear lib which need to be preferred over the application server similar jars like xalan, xerces etc. Weblogic allows this to done as below and the application works fine now in weblogic - with the configuration below
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.oracle.com/technology/weblogic/920/weblogic-application.xsd">
<xml>
<parser-factory>
<saxparser-factory> org.apache.xerces.jaxp.SAXParserFactoryImpl </saxparser-factory>
<document-builder-factory> org.apache.xerces.jaxp.DocumentBuilderFactoryImpl </document-builder-factory>
<transformer-factory> org.apache.xalan.processor.TransformerFactoryImpl </transformer-factory>
</parser-factory>
</xml>
<prefer-application-packages>
<package-name>org.opensaml.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.xalan.*</package-name>
</prefer-application-packages>
</weblogic-application>
I need to do the same with jboss so that it excluded the similar jars which are present within its own library. I have tried the below
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="deployment.javaee.api" />
</dependencies>
<exclusions>
<module name="javaee.api" />
</exclusions>
</deployment>
<module name="deployment.javaee.api">
<dependencies>
<module name="javaee.api" export="true">
<imports>
<exclude path="org/opensaml/**" />
<exclude path="org/apache/xerces/**" />
<exclude path="org/apache/xalan/**" />
</imports>
</module>
</dependencies>
</module>
</jboss-deployment-structure>
Still it seems to pick up the jboss jars for xerces , xalan and opensaml. In case you have done such things before in JBOSS, your suggestion will be really appreciated.

Cannot access Seam Components within JAR from WAR in [JBOSS 7.1.1.FINAL and SEAM 2.2.1.CR2]

Problem: I have an ejb-jar-1.jar which defines EJBs and Entities. The project structure is listed below. During deployment all EJBs are successfully bootstraped > started and their JNDI locations are printed in a log file. There's a class in my WAR file which needs to access a NAMED QUERY defined on an Entity which resides inside ejb-jar-1.jar. When this piece of code is run it throws an illegalArgumentException saying NAMED QUERY cannot be found. On a different note I also cannot get reference to SEAM components that were started when ejb-jar1.jar was deployed. I printed the JNDI tree from app-war.war file and it does not have any JNDI resources from ejb-jar-1.jar. So, I believe this is a context issue where JNDI resources available in ejb-jar-1.jar cannot be seen from app-war.war.
Any suggestions on how to access JNDI resources available in ejb-jar-1.jar from app-war.war?
Deployement Info
* JBOSS 7.1.1.FINAL
* Uses seam framework: jboss-seam-2.2.1.CR2.jar
* Uses Hibernate 3.4.0.GA
main-ear.ear
|__META-INF
| |____jboss-deployment-structure.xml
| |____application.xml
| |____jboss-app.xml
| |____MANIFEST.MF
|__lib
| |____somejar.jar
| |____somejar.jar
|__ejb-jar-1.jar
|__ejb-jar-2.jar
|__jboss-seam-2.2.1.CR2.jar
|__commons-lang-2.4.jar
|__commons-codec-1.1.jar
|__jasypt-1.6.jar
|__app-war.war
jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclusions>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="org.hibernate" slot="main"/>
<module name="org.hibernate.validator" slot="main"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.collections"/>
<module name="org.apache.commons.codec"/>
<module name="org.picketlink" slot="main"/>
<module name="org.picketbox" slot="main"/>
<module name="org.javassist" slot="main"/>
<module name="org.dom4j" slot="main"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2" export="true"/>
<module name="com.sun.jsf-impl" slot="1.2" export="true"/>
<module name="org.javassist" slot="1" export="true"/>
<module name="org.apache.commons.logging" export="true"/>
</dependencies>
</deployment>
<sub-deployment name="app-war.war">
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="deployment.main-ear.ear.ejb-jar-1.jar" />
<module name="deployment.main-ear.ear.ejb-jar-2.jar" />
<module name="deployment.main-ear.ear.jboss-seam-2.2.1.CR2.jar"/>
</dependencies>
</sub-deployment>
<module name="deployment.main-ear.ear.jasypt-1.6.jar" />
<module name="deployment.main-ear.ear.commons-codec-1.1.jar" />
<module name="deployment.main-ear.ear.commons-lang-2.4.jar" />
</jboss-deployment-structure>
application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/javaee/application_6.xsd"
version="6">
<description>myapp</description>
<display-name>myapp</display-name>
<initialize-in-order>true</initialize-in-order>
<library-directory>lib</library-directory>
<module>
<ejb>ejb-jar-1.jar</ejb>
</module>
<module>
<ejb>ejb-jar-2.jar</ejb>
</module>
<module>
<ejb>jboss-seam-2.2.1.CR2.jar</ejb>
</module>
<module>
<web>
<web-uri>app-war.war</web-uri>
<context-root>/app</context-root>
</web>
</module>
</application>
Bit late but oh well...for EE6 you need to use JNDI portable syntax, eg. add following annotations to all beans in the secondary module
#JndiName("java:app/NameOfModule/NameOfBean")
Think you need seam.properties in your jar in META-INF

JBoss AS 7.1 dependency conflicts due the xfire-1.2.6 dependencies wss4j-1.5.1 and xmlsec 1.3.0

I'm trying to deploy legacy code on JBoss AS 7.1 but I'm struggling with conflicting dependencies due wss4j and xmlsec
I've created a jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding
some dependencies -->
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.logmanager.log4j" />
<module name="org.slf4j" />
<module name="javaee.api" />
<module name="org.apache.santuario.xmlsec" />
</exclusions>
<dependencies>
<module name="javaee.api">
<imports>
<exclude-set>
<path name="org/apache/xml/security/**" />
<path name="org/apache/ws/security/**" />
</exclude-set>
</imports>
</module>
</dependencies>
</deployment>
But this results in:
Caused by: java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V
at org.apache.ws.security.WSSConfig.<init>(WSSConfig.java:81) [wss4j-1.5.1.jar:]
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:95) [wss4j-1.5.1.jar:]
at org.apache.ws.security.WSSConfig.<clinit>(WSSConfig.java:47) [wss4j-1.5.1.jar:]
at org.apache.ws.security.WSSecurityEngine.<clinit>(WSSecurityEngine.java:51) [wss4j-1.5.1.jar:]
at org.apache.ws.security.handler.WSHandler.<clinit>(WSHandler.java:62) [wss4j-1.5.1.jar:]
at com.realdolmen.forens2.service.kbo.impl.KBOConsultServiceImpl.signRequest(KBOConsultServiceI
And when I change the path names to:
<exclude-set>
<path name="org/apache/xml/security" />
<path name="org/apache/ws/security" />
</exclude-set>
It results in:
Caused by: java.lang.NoSuchMethodError: org.apache.xml.security.keys.KeyInfo.init()V
at org.apache.xml.security.Init.init(Unknown Source) [xmlsec-1.3.0.jar:]
at org.apache.ws.security.WSSConfig.<init>(WSSConfig.java:72) [wss4j-1.5.1.jar:]
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:95) [wss4j-1.5.1.jar:]
and what's really driving me crazy is that the correct versions appear in the stacktrace.
I've rewritten the legacy code with CXF..