Jboss 7 migration - ValidationException: Unable to find provider: HibernateValidator - jboss

my work place is migrating from Jboss 6 to Jboss 7.
We use v 5.1.3 Hibernate Validator, and when we tried to deploy our web application in the Jboss 7 server, and it threw an exception.
09:23:56,031 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 4) WFLYCTL0013: Operation ("read-attribute") failed - address: ([
("deployment" => "ROOT.war"),
("subsystem" => "jaxrs"),
("rest-resource" => "org.apache.cxf.rs.security.oauth.services.RequestTokenService")
]): javax.validation.ValidationException: RESTEASY008520: Unable to load Validation support
Caused by: javax.validation.ValidationException: Unable to find providerclass org.hibernate.validator.HibernateValidator
I am not overly familiar with ether Jboss and Hibernate Validator, and tried googling the issue with little success.

Look here https://coredump.su/questions/35063076/how-can-i-disable-javaxvalidationapi-in-jboss-64. Try add this to your jboss-deployment-structure.xml:
<exclude-subsystems>
<subsystem name="jaxrs"/>
</exclude-subsystems>
<exclusions>
<module name="javaee.api"/>
<module name="javax.validation.api"/>
<module name="javax.faces.api"/>
<module name="org.hibernate.validator"/>
</exclusions>
Maybe you have conflict with jboss modules.

Related

Cannot use MongoDB driver "mongodb-driver-sync" in OSGi Project: Unable to resolve

We are developing an OSGi application running on Apache Karaf. Our application uses Apache Camel and MongoDB.
First we successfully used a quite old version of "mongo-java-driver" (3.12.11): By adding this dependency to the modules pom.xml and to the osgi feature repository we were able to start our application and connect to MongoDB:
pom.xml (maven module1)
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.11</version>
</dependency>
feature.xml:
<repository>mvn:org.apache.camel.karaf/apache-camel/3.18.4/xml/features</repository>
<feature name="module1" description="An OSGi module" version="1.0.1-SNAPSHOT">
<feature>scr</feature>
<feature prerequisite="true">aries-blueprint</feature>
<feature>camel-core</feature>
<feature>camel-blueprint</feature>
<feature>camel-cxf</feature>
<feature>camel-xslt-saxon</feature>
<feature>camel-jetty</feature>
<feature>camel-rabbitmq</feature>
<feature>camel-openapi-java</feature>
<feature>camel-jackson</feature>
<capability>osgi.service;objectClass=org.apache.aries.blueprint.NamespaceHandler;osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint;effective:=active;
</capability>
<bundle dependency="true">mvn:org.mongodb/mongo-java-driver/3.12.11</bundle>
<bundle>mvn:my.own.project/module1/1.0.1-SNAPSHOT</bundle>
</feature>
But that driver is legacy, quite old and missing important features, so we would like to use a modern driver, namely mongodb-driver-sync (version 4.8.2).
We replaced the previous driver with "mongodb-driver-sync":
pom.xml (maven module1)
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.8.2</version>
</dependency>
feature.xml:
<repository>mvn:org.apache.camel.karaf/apache-camel/3.18.4/xml/features</repository>
<feature name="module1" description="An OSGI module" version="1.0.1-SNAPSHOT">
<feature>scr</feature>
<feature prerequisite="true">aries-blueprint</feature>
<feature>camel-core</feature>
...
<!-- <bundle dependency="true">mvn:org.mongodb/mongo-java-driver/3.12.11</bundle>-->
<bundle dependency="true">mvn:org.mongodb/mongodb-driver-sync/4.8.1</bundle>
<bundle>mvn:my.own.project/module1/1.0.1-SNAPSHOT</bundle>
</feature>
This fails when starting the feature in Karaf:
Error executing command: Unable to resolve root: missing requirement [root] osgi.identity;
osgi.identity=mesh; type=karaf.feature; version="[1.0.1.SNAPSHOT,1.0.1.SNAPSHOT]";
filter:="(&(osgi.identity=mesh)(type=karaf.feature)(version>=1.0.1.SNAPSHOT)(version<=1.0.1.SNAPSHOT))"
[caused by: Unable to resolve mesh/1.0.1.SNAPSHOT: missing requirement [mesh/1.0.1.SNAPSHOT] osgi.identity; osgi.identity=mesh-vms-tso01; type=karaf.feature
[caused by: Unable to resolve mesh-vms-tso01/1.0.1.SNAPSHOT: missing requirement [mesh-vms-tso01/1.0.1.SNAPSHOT] osgi.identity; osgi.identity=mesh-vms-tso01; type=osgi.bundle; version="[1.0.1.SNAPSHOT,1.0.1.SNAPSHOT]"; resolution:=mandatory
[caused by: Unable to resolve mesh-vms-tso01/1.0.1.SNAPSHOT: missing requirement [mesh-vms-tso01/1.0.1.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=com.btc.mesh.core.camel)(version>=1.0.0)(!(version>=2.0.0)))"
[caused by: Unable to resolve mesh-core/1.0.1.SNAPSHOT:
missing requirement [mesh-core/1.0.1.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=com.mongodb)(version>=4.8.0)(!(version>=5.0.0)))"]]]]
I also tried version 4.1.0 because an older documentation mentioned that it is a valid OSGI bundle:
The mongodb-driver-sync artifact is a valid OSGi bundle whose symbolic
name is org.mongodb.driver-sync."
https://mongodb.github.io/mongo-java-driver/4.1/driver/getting-started/installation/
But we also had no luck. Does the symbolic name help in any way?
After version 4.3.x the documentation moved from mongodb.github.io to www.mongodb.com and the reference to OSGi has been removed. The MANIFEST file of all mentioned drivers looks quite similar including the bundle information. So, AFAIK , OSGi should work. Very confusing.
So, we need your help
Has anyone more information about a modern MongoDB driver which is ready for OSGI?
Or maybe we are doing something wrong when integrating the driver into our OSGI module?
Thanx

Drools compatibility with Java 11

When deploying an ear application containing a drools kie engine 7.20.0.Final on Wildfly 16.0.0.Final, I get a deployment failure exception that sun.reflect.ReflectionFactory class cannot be loaded. The application deploys fine with Java 8.
I understand that Java 11 has removed support for sun.reflect.Reflection. Does drools rely on it? The drools documentation only says the Java requirement is for Java 1.5 and nothing more.
Is drools compatible with Java 11?
Solved. Turns out the removal of sun.reflect from Java 11 was a red herring. the actual problem was with Wildfly 16 which didn't make the module available. Solution was to create a jboss-deployment-structure.xml as follows:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<system export="true">
<paths>
<path name="sun/reflect"/>
</paths>
</system>
</dependencies>
</deployment>
</jboss-deployment-structure>
See this post: Mockito, Java 9 and java.lang.ClassNotFoundException: sun.reflect.ReflectionFactory

I don't want to refer server side jars for my project, My primefaces+spring project has to use the jars that i added to lib folder

I'm working on Primefaces + Spring project.Recently we migrated the project from JSF 1.2 to 2.2 Version.Previously our project was using jsf Implementation and API jars from Project's lib folder but now it's using the jars located in,
**\wildfly-10.0.0.Final\modules\system\layers\base\com\sun\jsf-impl\main**
**\wildfly-10.0.0.Final\modules\system\layers\base\javax\faces\api\main**
and it is throwing Services which failed to start error while deploying on wildfly 10.x,
JBAS014777: Services which failed to start: service jboss.deployment.unit."abc.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."abc.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "abc.war"
How can configure my project to use lib jars.Which will helps in deployment.
Some dependencies are added implicitly by Wildfly 10. You can find a list of them here.
For the web subsystem these are:
javaee.api
com.sun.jsf-impl
org.hibernate.validator
org.jboss.as.web
org.jboss.logging
If you don't want one of them, like in your case com.sun.jsf-impl, you can exclude them using a jboss-deployment-structure.xml file as explained here.
In your case it might look like this:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="com.sun.jsf-impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Probably you may need more exclusions, but the principle should be clear.

Wildfly 8.2 fails to load jbossws-cxf-client module

I am working on a web application that contains a Soap client and that needs to have access to the cxf Client implmentation, because we have to use different certificates for different calls to the remote endpoint.
Wildfly comes with a module jbossws-cxf-client which has dependencies to all the different cxf modules required. There is a maven version of this module as well.
In the maven module pom file we have a dependency like so:
<dependency>
<groupId>org.jboss.ws.cxf</groupId>
<artifactId>jbossws-cxf-client</artifactId>
<version>4.3.2.Final</version>
<scope>provided</scope>
</dependency>
Note that the version has been matched with the version that is mentioned in the wildfly 8.2 release notes:http://wildfly.org/news/2014/11/20/WildFly82-Final-Released/
When deploying our application we get the following message from the log:
14:22:12,492 INFO [org.jboss.weld.Bootstrap] (weld-worker-1) WELD-000119: Not generating any bean definitions from nl.topicuszorg.lsp.service.MultipleCertificatePingStubServiceImpl because of underlying class loading error: Type org.apache.cxf.transport.Conduit from [Module "deployment.kdplus-lsphub-server-1.1-SNAPSHOT.war:main" from Service Module Loader] not found. If this is unexpected, enable DEBUG logging to see the full error.
14:22:12,689 INFO [org.apache.deltaspike.core.util.ProjectStageProducer] (MSC service thread 1-2) Computed the following DeltaSpike ProjectStage: Production
14:22:13,628 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."kdplus-lsphub-server-1.1-SNAPSHOT.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."kdplus-lsphub-server-1.1-SNAPSHOT.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type PingStubService with qualifiers #Default
at injection point [BackedAnnotatedField] #Inject nl.topicuszorg.lsp.service.PingPongServiceImpl.pingStubService
at nl.topicuszorg.lsp.service.PingPongServiceImpl.pingStubService(PingPongServiceImpl.java:0)
The real problem is logged as INFO, strangely enough. org.apache.cxf.transport.Conduit can not be loaded. This is part of the org.apache.cxf module, and should be loaded transitively by loading the jbossws-cxf-client module.
It should not be necessary, but we also implicitely declare the module dependencies in the jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<excludes>
</excludes>
<dependencies>
<module name="org.slf4j"/>
<module name="org.apache.cxf"/>
<module name="jbossws-cxf-client"/>
<module name="org.apache.cxf.impl"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
It seems the module is not loaded, I don't know why. I can not find a way to check which modules have been loaded.
What is going wrong here?
As it turned out I had to move my jboss-deployment-structure.xml from the META-INF to the WEB-INF directory.
Bummer...

How to enable a custom log4j with Jboss AS 7.1

I tried several options. But anything didn't work for me.
Previously I used the same log4j.xml (simple common config) with Tomcat 6,7 and I could able to control the root logging and the application logging with updating the log4j.xml.
When I deploy the same project with JBoss AS 7.1, It only gives me INFO level logging and my log4j.xml doesn't work at all. Sometime this can be fixed by updating some configuration files inside the JBoss server, but I like to know if there a portable way to do it or something similar. If this is bug or something with JBoss AS 7.1 I like to know about a quick fix anyway.
I haven't worked with JBoss before.
Thanks!
I had this problem and solved it by following method:
use your own log4j jar instead of one that provided by jboss. Do it by excluding jboss org.apache.log4j jar module from your application (exclude it in jboss-deployment-structure.xml) and add your own log4j jar file in lib folder of the .ear package.
Now put log4j.xml in the root folder of your module.
By this method you have full control on log4j (like standalone applications).
let me know if you need more help.
Sample jboss-deployment-structure.xml for excluding log4j.jar:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.apache.log4j" slot="main"/>
</exclusions>
</deployment>
<sub-deployment name="MyEjb.jar">
<exclusions>
<module name="org.apache.log4j"/>
</exclusions>
</sub-deployment>