Webapp fails with "JBAS011232: Only one JAX-RS Application Class allowed" after adding a maven dependency to hadoop-azure - maven

I have a webapp that runs fine in JBoss EAP 6.4. I want to add some functionality to my webapp so that it can process Parquet files that reside in AzureBlob storage. I add a single dependency to my pom.xml:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-azure</artifactId>
<version>3.1.0</version>
</dependency>
If I now try to start my webapp, it fails at start up:
09:29:43,703 ERROR [org.jboss.msc.service.fail] (MSC service thread
1-10) MSC000001: Failed to start service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
JBAS018733: Failed to process phase POST_MODULE of deployment
"myApp-0.0.1-SNAPSHOT.war" at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)
[jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
... Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011232: Only one JAX-RS Application Class allowed.
com.sun.jersey.api.core.ResourceConfig
com.sun.jersey.api.core.DefaultResourceConfig
com.sun.jersey.api.core.PackagesResourceConfig
com.mycompany.myapp.rest.RestApplication
com.sun.jersey.api.core.ClassNamesResourceConfig
com.sun.jersey.api.core.ScanningResourceConfig
com.sun.jersey.api.core.servlet.WebAppResourceConfig
com.sun.jersey.api.core.ApplicationAdapter
com.sun.jersey.server.impl.application.DeferredResourceConfig
com.sun.jersey.api.core.ClasspathResourceConfig at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:206)
at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:104)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] ...
5 more
09:29:43,709 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) JBAS014612: Operation ("deploy") failed -
address: ([("deployment" => "myApp-0.0.1-SNAPSHOT.war")]) - failure
description: {"JBAS014671: Failed services" =>
{"jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
JBAS018733: Failed to process phase POST_MODULE of deployment
"myApp-0.0.1-SNAPSHOT.war"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011232: Only one JAX-RS Application Class allowed.
com.sun.jersey.api.core.ResourceConfig
com.sun.jersey.api.core.DefaultResourceConfig
com.sun.jersey.api.core.PackagesResourceConfig
com.mycompany.myapp.rest.RestApplication
com.sun.jersey.api.core.ClassNamesResourceConfig
com.sun.jersey.api.core.ScanningResourceConfig
com.sun.jersey.api.core.servlet.WebAppResourceConfig
com.sun.jersey.api.core.ApplicationAdapter
com.sun.jersey.server.impl.application.DeferredResourceConfig
com.sun.jersey.api.core.ClasspathResourceConfig"}}
The message "JBAS011232: Only one JAX-RS Application Class allowed" seems to be caused by my webapp trying to use both RestEasy and Jersey. JBoss uses RestEasy by default. Apparently, hadoop-azure must have a Jersey application class. How can I eliminate this problem by indicating that I don't want to use the Jersey-based application class?

hadoop-azure pulls in hadoop-common, which pulls in Jersey. In the version of hadoop-azure you're using, hadoop-common is in compile <scope>. In new version, it is in provided scope. So you can just upgrade the hadoop-azure dependency to the latest one. If you need hadoop-common to compile, then you can redeclare hadoop-common and put it in provided scope.

Related

Spring Boot application breaks after upgrade to Apache Derby 10.15 -- why?

During a round of SOUP upgrades in a Spring Boot application, I bumped Apache Derby from 10.14.1.0 to 10.15.1.3. Now the tests fail with this beauty (snipped, full stacktrace here):
Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource':
Invocation of init method failed
Caused by: java.lang.IllegalStateException:
Failed to replace DataSource with an embedded database for tests.
If you want an embedded database please put a supported one on the
classpath or tune the replace attribute of #AutoConfigureTestDatabase.
What is going here? Do I need to change any configuration?
Apache Derby requires Java 9 from 10.15.x on which Spring Boot does currently not support.
See also spring-boot#16433.
I just want to answer with what it took me to get Derby 15.2.0 to work with Spring Boot 2.4.4 with derby in embedded mode, on top of Java 11. Spring Boot 2.4.4 works out of the box with Derby 14, although you will get some warning as spring boot starts. Upgrading apache derby to 15.2.0 fixed that for me.
In pom, both derby and derbytools dependencies defined:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
Then in your apps properties file:
spring.datasource.driver-class-name=org.apache.derby.iapi.jdbc.AutoloadedDriver
Instead of:
spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver
After that, I now get a good startup of Spring Boot with no warnings or anything that raises concerns.

JSF 2.3 on EAP 7

I would like to upgrade to JSF 2.3 on an Jboss EAP 7.
I followed this guide:
https://docs.jboss.org/author/display/WFLY10/JSF+Configuration#JSFConfiguration-ConfiguringaJSFapptouseanondefaultJSFimplementation
I splitted the JSF 2.3 jar following this guide:
How to install one jar variant of JSF (javax.faces.jar) on WildFly
However, when I start EAP 7 I get this error:
2017-04-30 12:55:00,280 WARN (JSFDependencyProcessor.java:75) = WFLYJSF0005: Unknown JSF version 'mojarra-2.3.0'. Default version 'mojarra-2.3.0' will be used instead.
2017-04-30 12:55:00,281 ERROR (ServiceControllerImpl.java:1955) = MSC000001: Failed to start service jboss.deployment.unit."monitoring.war".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.unit."monitoring.war".DEPENDENCIES: WFLYSRV0153: Failed to process phase DEPENDENCIES of deployment "monitoring.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0014: Default JSF implementation slot 'mojarra-2.3.0' is invalid
at org.jboss.as.jsf.deployment.JSFDependencyProcessor.deploy(JSFDependencyProcessor.java:80)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
Does anybody successfully upgraded EAP 7 to JSF 2.3?
I made a mistake by misreading the place where to put all the needed jars.
For instance, the module javax.faces.api I put in the folder:
EAP_HOME/modules/system/layers/base/javax/faces/api/JSF_IMPL
Instead, it needed to go to:
EAP_HOME/modules/javax/faces/api/JSF_IMPL.
It was specified like this in the guide, but for other modules (Oracle JDBC Driver...) I needed to put stuff directly under the base folder. Apparently, for JSF, this needs to be in the root of the modules folder...
Now it is loaded correctly and, when I use LOG.info(FacesContext.class.getPackage().getImplementationVersion()); it prints 2017-05-02 08:59:47,872 INFO (Web.java:66) = 2.3.0

Error running CXF REST web service on Apache Tomee

I'm trying to build a RESTful web service using the "org.apache.cxf.archetype:cxf-jaxrs-service" maven archetype. When I deploy it on Apache Tomee I get the following error:
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'services': Invocation of init method failed; nested exception is org.apache.cxf.service.factory.ServiceConstructionException
...
...
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:219)
...
...
Caused by: java.lang.ClassCastException: Cannot cast org.apache.cxf.management.jmx.InstrumentationManagerImpl to org.apache.cxf.management.InstrumentationManager*
My guess is I'm missing some configuration but I thought the archetype would 'just work'.
Any ideas?
this error means you have a conflict between cxf in the webapp (WEB-INF/lib) and tomee. You either have to configure the classloading to do that or (recommanded and expected by EE) just remove CXF from the webapp since it is in tomee and tomee does the job for you.
Side note: you will also likely need to clean up the web.xml since tomee will handle the deployment without the need to register a servlet.

org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype

I am migrating my java web application from Jboss 7.1.1 Final to Wildfly 10,using :
spring 4.2.0,
hibernate 5.0.7,
jpa 2.1
and Mysql database.
I getting the following error while trying to run my code.
2016-07-20 19:30:50,176 ERROR [org.jboss.msc.service.fail]
(ServerService Thread Pool -- 61) MSC000001: Failed to start service
jboss.persistenceunit."ccp-ear-1.0-SNAPSHOT.ear/ccp-entities-1.0-SNAPSHOT.jar#ccpPU":
org.jboss.msc.service.StartException in service
jboss.persistenceunit."ccp-ear-1.0-SNAPSHOT.ear/ccp-entities-1.0-SNAPSHOT.jar#ccpPU":
java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
at
org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745) at
org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by:
java.util.ServiceConfigurationError:
org.hibernate.integrator.spi.Integrator: Provider
org.hibernate.envers.boot.internal.EnversIntegrator not a subtype at
java.util.ServiceLoader.fail(ServiceLoader.java:239) at
java.util.ServiceLoader.access$300(ServiceLoader.java:185) at
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:324)
at
org.hibernate.integrator.internal.IntegratorServiceImpl.(IntegratorServiceImpl.java:40)
at
org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:213)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:365)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.(EntityManagerFactoryBuilderImpl.java:166)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:160)
at
org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:135)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67)
at
org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167)
... 7 more
You need to delete the hibernate.cfg.xml and move the configuration from this file to persistence.xml.
Then You have also to remove all hibernate files from WEB-INF/lib folder, because WildFly has its own ones and this situation also possibly made a conflict.
More details on this problem in this link : JBoss Community Forum
I also had a similar issue with Wildfly 10.0.0.Final. In my project also we have all hibernate related libraries within the project's lib directory. But the jboss provided libraries caused conflicts so i have removed the content within the tag <module xmlns="urn:jboss:module:1.3" name="org.hibernate"> in module.xml file available in JBOSS_HOME\modules\system\layers\base\org\hibernate\main directory. Also i have removed the dependencies of hibernate libraries in jboss-deployment-struture.xml as,
<exclusions>
<module name="org.hibernate" slot="main"/>
</exclusions>
After these changes i can able overcome the conflict issues related to hibernate.Hope this will help.
Please note jboss-deployment-struture.xml change alone has not resolved my issue the change mentioned on module.xml file is mandatory.

Problems once migrate jsf 1.2 to jsf 2.2.12

I am migrating project from jsf 1.2 to jsf 2.2.12. After built successful, I deployed to the jboss 7 server and got error message like that:
14:14:10,255 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."myproject-war.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myproject-war.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myproject-war.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]
Caused by: java.lang.RuntimeException: Error getting reflective information for class org.richfaces.taglib.ColumnsTag with ClassLoader ModuleClassLoader for Module "deployment.myproject-war.war:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "javax.faces.webapp.UIComponentClassicTagBase.getParent()Ljavax/servlet/jsp/tagext/Tag;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/richfaces/taglib/ColumnsTag, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/servlet/jsp/tagext/Tag have different Class objects for the type ervlet/jsp/tagext/Tag; used in the signature
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_80]
at java.lang.Class.privateGetDeclaredFields(Class.java:2509) [rt.jar:1.7.0_80]
at java.lang.Class.getDeclaredFields(Class.java:1819) [rt.jar:1.7.0_80]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 10 more
14:14:10,286 INFO [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "myproject-war.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myproject-war.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myproject-war.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"myproject-war.war\""}}
14:14:10,484 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment myproject-war.war in 198ms
14:14:10,486 INFO [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."myproject-war.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myproject-war.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myproject-war.war"
[2015-09-30 02:14:10,579] Artifact myproject-war:war exploded: Error during artifact deployment. See server log for details.
[2015-09-30 02:14:10,579] Artifact myproject-war:war exploded: java.lang.Exception: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myproject-war.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myproject-war.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"myproject-war.war\""}}
Could you have any idea for this one?
Here are my system detail:
Server: jboss7
Current libs: jsf 1.2, richfaces 3.3.3
Migration libs: jsf 2.2.17
Build: maven
Best regards,
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "javax.faces.webapp.UIComponentClassicTagBase.getParent()Ljavax/servlet/jsp/tagext/Tag;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/richfaces/taglib/ColumnsTag, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for interface javax/servlet/jsp/tagext/Tag have different Class objects for the type ervlet/jsp/tagext/Tag; used in the signature
java.lang.LinkageError is sign of classpath pollution with multiple different versioned libraries. You'd best let Maven produce a WAR file and then inspect its /WEB-INF/lib for any libraries which doesn't belong there (i.e. libraries which are supposed to be already provided by the target server, such as Java EE, JSP, Servlet, JSF, etc.. in your case with JBoss AS). Then fix the Maven pom.xml accordingly to mark exactly those as provided.
The particular one you got suggests a duplicated javax.servlet.jsp.* API. You'll in /WEB-INF/lib most likely have a jsp-api.jar or another JAR which covers this (e.g. javaee.jar). In that case, you need to mark exactly that dependency in pom.xml as provided. Or, if it's actually jsp-api, then just remove it altogether and use a single javaee-api or javaee-web-api dependency with version 6.0 and scope provided which covers the entire Java EE 6 (Web profile) already, exactly as done by JBoss AS 7.

Resources