Broadleaf Jboss Setup ClassNoFound - jboss

When trying to do a broadleaf Jboss setup, I am getting the below error
I have checked the source code com.broadleafcommerce.customersegment.admin.dataimport.persistence.CustomerSegmentRecordPersistencePreProcessor is available in broadleaf-merchandising-group-1.2.1-GA.jar but strangely the class com.broadleafcommerce.dataimport.service.RecordPersistencePreProcessor is no where found, please help.
2018-01-02 21:51:54,565 WARN [org.jboss.modules] (MSC service thread 1-7) Failed to define class com.broadleafcommerce.customersegment.admin.dataimport.persistence.CustomerSegmentRecordPersistencePreProcessor in Module "deployment.admin.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/broadleafcommerce/customersegment/admin/dataimport/persistence/CustomerSegmentRecordPersistencePreProcessor (Module "deployment.admin.war" from Service Module Loader): com/broadleafcommerce/dataimport/service/RecordPersistencePreProcessor
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:713)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-01-02 21:51:54,565 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."admin.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."admin.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "admin.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Failed to link com/broadleafcommerce/customersegment/admin/dataimport/persistence/CustomerSegmentRecordPersistencePreProcessor (Module "deployment.admin.war" from Service Module Loader): com/broadleafcommerce/dataimport/service/RecordPersistencePreProcessor
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:713)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more

The issue that you are running into is the ServletContextInitializer scanning in Servlet 3.0+ containers. In Tomcat, you can control this with this guide: https://wiki.apache.org/tomcat/HowTo/FasterStartUp#JAR_scanning. Jboss is utilizing its class loader to check for ServletContextInitializer classes, and in some of the Broadleaf jars we link in at compile time some conditional classes that may not be available at runtime.
Are you using the Spring Boot project based on Broadleaf 5.2.x? You can try adding a web.xml that has an empty <absolute-ordering />: https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/key-aspects-and-configuration/app-server-configuration/using-a-web.xml
I would also question the use of Jboss at all. There is almost zero reason to ever use a full-blown JEE application server within a Spring application and frankly, you are asking for more issues as time goes on. You are trying to combine a fat .war (a Spring application built with Maven) with a fat application server (jboss). You should instead pair a fat .war file with a light servlet container (like Tomcat) or a light .war file (a JEE application) with a JEE application server.

Related

Failing to deploy Vaadin application on Tomcat 10

I have developed my Vaadin application (v.23) and trying to deploy it to Tomcat 10.1.5 on Ubuntu box. I created a production build according to the Vaadin documentation and got a WAR file.
I did place it to the webapps directory of the tomcat and tomcat did create a directory for my application with META-INF, WEB-INF and org/springframework/boot/loader subdirectories.
However, my application wasn't showing up. I restarted tomcat and got exception stack trace:
SEVERE [main] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing
jakarta.servlet.ServletException: This application requires Servlet 3 or 4 and the server you are running on (Apache Tomcat/10.1.5) supports Servlet 5+
at com.vaadin.servletdetector.ThrowIfServlet5.onStartup(ThrowIfServlet5.java:13)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5144)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:747)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:975)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1949)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:776)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:426)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1656)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1383)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:252)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:430)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:926)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:577)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
I reviewed Vaadin docs and didn't find any limitation for deployment to Tomcat 10. Why Vaadin barfs on servlet 5 is beyond my understanding.
Can anyone, please, tell me what to do to make it working?

Unable to run data-validator_2.11-0.12.1.jar on my local machine

I'm trying to use target data-validator, but when I run it in cmd, it shows me an error like:
D:\Spark\DemoTime>spark-submit --master local data-validator_2.11-0.12.1.jar --help
21/12/28 15:05:41 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Exception in thread "main" org.apache.spark.SparkException: No main class set in JAR; please specify one with --class.
at org.apache.spark.deploy.SparkSubmit.error(SparkSubmit.scala:972)
at org.apache.spark.deploy.SparkSubmit.prepareSubmitEnvironment(SparkSubmit.scala:492)
at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:898)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:180)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:203)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:90)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:1043)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:1052)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
But if I give the main class name, it shows like:
D:\Spark\DemoTime>spark-submit --class com.target.data_validator.Main data-validator_2.11-0.13.0.jar --help
Exception in thread "main" java.lang.NoClassDefFoundError: com/typesafe/scalalogging/Logger
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:42)
at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:955)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:180)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:203)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:90)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:1043)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:1052)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: com.typesafe.scalalogging.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 13 more
log4j:WARN No appenders could be found for logger (org.apache.spark.util.ShutdownHookManager).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I'm following the data-validator tool from target:
https://github.com/target/data-validator
But I'm unable to sort this thing out.
You can find the jar file at:
https://github.com/target/data-validator/releases
Hence I would request your help in running this tool.
Please let me know if you need anything else.
Thanks.
From the GitHub's README:
Assemble fat jar: sbt clean assembly
spark-submit --master local data-validator-assembly-0.13.0.jar --help
You need a fat jar of data-validator + its dependencies to be able to run it. You've only provided the data-validator simple jar.

Jboss Deployment Failure - ClassNotFoundException

I encountered ClassNotFoundException during deploying a war file to my jboss server. I think it is related to log4j since it returns "Deployment error processing SCI for JAR: log4j-web-2.2.jar" error. However, the web app works properly on apache tomcat on eclipse. I have no idea of how to solve it. Thank you in advance.
Log:
12:32:52,002 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."WarTest.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."WarTest.war".INSTALL: Failed to process phase INSTALL of deployment "WarTest.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_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_91]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_91]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Deployment error processing SCI for JAR: log4j-web-2.2.jar
at org.jboss.as.web.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:186)
at org.jboss.as.web.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:121)
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.ClassNotFoundException: # from [Module "deployment.WarTest.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.jboss.as.web.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:183)
... 7 more
From the log it looks like jboss needs a jar in your WAR's WEB-INF/lib - this is what it mean when it says java.lang.ClassNotFoundException: # from [Module "deployment.WarTest.war:main" from Service Module Loader]
There is a detailed discussion here:
https://issues.apache.org/jira/browse/LOG4J2-890
If you're using Jakarta EE 9 or 10, you'll have to upgrade your version of Wildfly to a version that supports Jakarta EE > 9. In my case, I had the stable release of version 26 that supported Jakarta EE 8, and not 9. So I upgraded to the beta version (version 27) of Wildfly that came with support for Jakarta EE >= 9 out of the box. If you can't find the war file, generate it using the maven command mvn -e -U clean install

JBoss EAP 6.4 Jackson module classloading

I made a small project which looks like this
playboss.ear
lib
commonlib.jar
JsonDeserializer.class
testlib.jar
JsonMessage.class
Version.class
jackson-1.9.4.jar
playboss_ejb.jar
MessageTimer.class
JsonMessage has a member: *private Class msgVersion = Version.V0.class;
MessageTimer is just a Bean with a timeout which does nothing but deserializes an example String of JsonMessage using JsonDeserializer.
Everything works fine, i.e. the String is converted to JsonMessage!
Now I add a dependency to my project containing a JAX-RS API and model objects such that lib is extended.
lib
SomeAPI.jar
javax.ws.rs-api-2.0.jar
Now when I start the JBoss EAP 6.4 I get the following exception:
Caused by: java.lang.ClassNotFoundException: playground.testlib.Version$V0 from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader #9e89d68
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.7.Final-redhat-1]
at java.lang.Class.forName0(Native Method) [rt.jar:1.8.0_66]
at java.lang.Class.forName(Class.java:264) [rt.jar:1.8.0_66]
at org.codehaus.jackson.map.deser.std.ClassDeserializer.deserialize(ClassDeserializer.java:42) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4]
I figure that due to https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments the jax-rs module dependency is triggered and jackson gets loaded from modules.
My questions:
1) What is the recommended / best way to get my deserialization working again
2) I would like to understand how object mapping is done with jax-rs if the module classloader does obviously not see my model classes.

Deployment liferay plug-in project on liferay-portal-jboss-6.2-ce-ga2

I had a liferay plug-in project which is developed on eclipse luna ide, tomcat server, liferay sdk 6.2, i built it to war file, and now i want to deploy my project on liferay jboss. And here what i did:
1. I put my war file to deploy folder in liferay-portal-6.2-ce-ga2\deploy
2. I start jboss server liferay-portal-6.2-ce-ga2\jboss-7.1.1\bin\standalone.bat
And i got this error in log file
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."ciren-portlet.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ciren-portlet.war".PARSE: Failed to process phase PARSE of deployment "ciren-portlet.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_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS018014: Failed to parse XML descriptor "/C:/Users/ttcgcn123/Desktop/liferay-portal-6.2-ce-ga2/jboss-7.1.1/standalone/deployments/ciren-portlet.war/WEB-INF/web.xml" at [898,3]
at org.jboss.as.web.deployment.WebParsingDeploymentProcessor.deploy(WebParsingDeploymentProcessor.java:114)
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
And here my web.xml file
View web.xml
Download web.xml
Just a small addition here, you are required to login to your liferay portal using admin, and then select Admin > Control Panel.