X-Gsm7Bit charset in JBoss 7.2 - java

I am in the process of migrating from JBoss AS 5 to JBoss 7.2. We have an SMS application based on SMPP protocol. EAR contains a war and and ejb jar and three utility jars under lib folder. One of the SMPP requirement is to encode data in X-GSM7Bit before sending to the service provider.
I have created a module named charset and my ear has declared a dependency on it. However, at runtime it doesnt seem to be loaded at all.
This is what I have done as of now:
Create a module named charset
Create jboss-deployment-structure.xml in ear
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<dependencies>
<module name="com.quwic.msc" export="true"/>
<module name="charset" services="import" export="true"/>
</dependencies>
</deployment>
<sub-deployment name="MSCWeb.war">
<dependencies>
<module name="deployment.MSC.ear.MSCEJB.jar" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Could someone please point out what could be missing. Module charset contains a META-INF/services/java.nio.charset.spi.CharsetProvider file pointing to the implementing class.
Thanks,
Atique

Related

Wildfly logging module exclusion does not work for a large web app

I've written a small web app which disables Wildfly 10.1's slf4j implementation and uses its own logging libraries (logback). It works fine because LoggerFactory.getILoggerFactory() resolves to ch.qos.logback.classic.LoggerContext as result.
But then I use the same code for a larger application (with 52 jar files in WEB-INF/lib/) LoggerFactory.getILoggerFactory() still resolves to a JBoss implementation org.slf4j.impl.Slf4jLoggerFactory, as by default.
How can I investigate what exactly retains server's logging instead of the one of mine? (And fix the situation of course.)
Maven dependencies used: "slf4j-api" 1.6.1, "logback-classic" and "logback-core" 0.9.28.
File jboss-deployment-structure.xml, which is known to be located properly in both cases:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.apache.common.logging"/>
<module name="org.apache.log4j"/>
<module name="org.jboss.log4j"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.logging"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
I know it's a old topic but i had a similar problem.
So, i will describe the problem and what i done to solve it.
I'm using spring-boot in my web application and running with jboss wildfly 10.
When i try to integrate sentry and logback on my project, the application reads the file logback.xml but use another logging system.
I realized that wildfly was ignoring logback and using jboss-logging instead.
So, i disabled the jboss logging module and than, my application started using logback and everything worked fine.
But this is how i disabled logging sub-system:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
The link when i found my anwser:

NoClassDefFoundError: org/hibernate/exception/ConstraintViolationException

We are migrating to Wildfly 10 from WebSphere and using the newer Hibernate 5 jars or, I should say, attempting to use them. Upon deployment of an ear, we are getting the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'xxxEndPoint' defined in class path resource
[config/context-ep-xxx.xml]: Instantiation of bean failed; nested
exception is java.lang.NoClassDefFoundError:
org/hibernate/exception/ConstraintViolationException
It almost appears as though the hibernate jar file hibernate-core-5.0.1.Final.jar is not part of the classpath even though it's required. We even created an explicit deploy in the jboss-deployment-structure.xml file to no avail.
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
<module name="javax.persistence.api" />
<module name="org.javassist" />
</exclusions>
<dependencies>
<module name="org.hibernate" slot="main" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Also, we are not using maven.
Any help would be appreciated.
Open the ear file (you can change it to a .zip if necessary or use 7zip). Double check that the expected hibernate jars are included in the ear you are trying to deploy. If not, try adding it to the ear along with updating the manifest.

Need to exclude apache httpcomponent from jboss 6.4 module

We have recently migrated from jboss 6.1 eap to 6.4 eap, but facing problem of class loading.
In my project lib We need to use apache httpcore 4.4.1, but apache httpcore 4.3.3 is included in 6.4. This previously wasn't a problem when we were using jboss 6.1 because the resteasy-jaxrs module.xml did not export httpcore library.
Now with jboss 6.4 we are getting exception :
Caused by: java.lang.NoSuchMethodError: org.apache.http.util.Asserts.check(ZLjava/lang/String;Ljava/lang/Object;)V
Its because runtime my project is using jar available from jboss and which does not having this method with required signature.
Now I want to force my application to not to use jboss jar and use jar available from web-inf/lib folder.
I have try to exclude this via jboss-deployment-structure.xml but somehow it is not working and still it is using jar from jboss only.
below is snap from the jboss-deployment-structure.xml file.
<deployment>
<exclusions>
<module name="org.apache.httpcomponents" />
</exclusions>
<dependencies>
module name="org.apache.httpcomponents" />
</dependencies>
</deployment>
Can someone please help me on this what is missing here or is there any alternative for this...
Since you are using JBoss EAP, you can apply the CP07 patch for EAP 6.4 (so your version would be JBoss EAP 6.4.7) where this issue has been addressed. I would highly recommend applying the CP07 patch.
Alternatively, you can set <module name="org.apache.httpcomponents" export="false"/> in the $JBOSS_MODULES\org\jboss\resteasy\resteasy-jaxrs\main\module.xml.
However, I would recommend applying the patch as the recommended solution. This way you will not modify the configuration that is shipped with the product.
To resolve the issue we can take one of the below approach.
Change $JBOSS_MODULES\org\jboss\resteasy\resteasy-jaxrs\main\module.xml
as suggested by CoolBeans.
You can use below option if you have no control(or not authorized) to update the Jboss server configuration.
Add below xml configuration in your jboss-deployment-structure.xml file
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="resteasy"/>
<subsystem name="jaxrs"/>
</exclude-subsystems>
<!-- Exclusions allow you to prevent the server from automatically adding
some dependencies -->
<exclusions>
<module name="javax.ws.rs.api"/>
<module name="org.jboss.as.jaxrs"/>
<module name="org.jboss.resteasy.resteasy-atom-provider" />
<module name="org.jboss.resteasy.resteasy-cdi" />
<module name="org.jboss.resteasy.resteasy-jaxrs" />
<module name="org.jboss.resteasy.resteasy-jaxb-provider" />
<module name="org.jboss.resteasy.resteasy-jackson-provider" />
<module name="org.jboss.resteasy.resteasy-jackson2-provider" />
<module name="org.jboss.resteasy.resteasy-jsapi" />
<module name="org.jboss.resteasy.resteasy-multipart-provider" />
<module name="org.jboss.resteasy.async-http-servlet-30" />
<module name="org.jboss.resteasy.resteasy-hibernatevalidator-provider" />
<module name="org.jboss.resteasy.resteasy-jettison-provider" />
<module name="org.jboss.resteasy.resteasy-spring" />
<module name="org.jboss.resteasy.resteasy-yaml-provider" />
</exclusions>
<dependencies>
</dependencies>
</deployment>
</jboss-deployment-structure>
This worked for me, Hope this will work for other

JBoss 6 EAP, how can I change the module load order?

I'm running JBoss 6.1 EAP, one of the default modules has its own version of the org/omg/CORBA/ORB.class file, I want to use my own jar for that file. I've tried including it in my app's war file but it is still picking up the one from the JBoss module.
So the question is, what is the load order of modules in JBoss and how can I change it?
You need to include a jboss-deployment-structure.xml file with your artifact, and configure the file to exclude the container's CORBA impl.
Below is an example which will exclude log4j
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>

Unable to exclude logmanager module on JBoss 6 EAP

I'm trying to exclude all the logging modules from a jboss-deployment-structure.xml in JBoss 6 EAP.
My jboss-deployment-structure.xml is:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.log4j.logmanager" />
</exclusions>
</deployment>
</jboss-deployment-structure>
So after I deploy my .war with said configuration I get:
[ModuleClassLoader for Module "org.jboss.log4j.logmanager:main" from local module loader #10ab323 (roots: /home/me/dev/jboss-eap-6.0/modules)] whereas object of type "org.apache.log4j.ConsoleAppender" was loaded by [ModuleClassLoader for Module "deployment.myapp.war:main" from Service Module Loader].
So I generally want to make JBoss stop trying to load log4j and let my application load it.
Is it at all possible to disable the logmanager module ?
Thanks,
I was able to resolve this problem using this jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
</exclusions>
</deployment>
Which I have created under WEB-INF. You should also put your log4j.jar in WEB-INF/lib.

Categories

Resources