Wildfly 9.0.2-Final ClassNotFoundException for Struts 1.x - java

While deploying app.war (Struts 1.x) on my Wildfly this information appears:
Cannot upload deployment: {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit.\"app.war\".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit.\"app.war\".POST_MODULE: WFLYSRV0153: Failed to
process phase POST_MODULE of deployment \"app.war\" Caused by:
java.lang.RuntimeException: WFLYSRV0177: Error getting reflective
information for class org.ajaxtags.tags.AjaxDisplayTag with
ClassLoader ModuleClassLoader for Module \"deployment.app.war:main\"
from Service Module Loader Caused by: java.lang.NoClassDefFoundError:
au/id/jericho/lib/html/Segment Caused by:
java.lang.ClassNotFoundException: au.id.jericho.lib.html.Segment from
[Module \"deployment.app.war:main\" from Service Module Loader]"}}
I have downloaded jericho-html-2.6.1-sources.jar and placed this as a module into ${wf-dir}\modules\system\layers\base\au\id\jericho\lib\html\main\ with an module.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="au.id.jericho.lib.html">
<resources>
<resource-root path="jericho-html-2.6.1-sources.jar"/>
</resources>
<dependencies>
</dependencies>
</module>
And there's still same issue...
Thanks for any help! :)

This was fixed by changing build system from Ant to Maven - looks like Wildfly has some problem while resolving directory conventions. On Glassfish 3.1.1 this worked with Ant

Related

ClassNotFoundException: java.net.http.HttpResponse in WF 18 / Java 11

In a JEE app deployed in Wildfly 18.0.1.Final with OpenJDK 64-Bit Server VM 11.0.15+9-LTS, I run into a ClassNotFoundException on java.net.http.HttpResponse (actually, one of the dependency is using it, and fails on java.net.http.HttpResponse$BodyHandler but I tried using java.net.http.HttpResponse directly in my code and ran into the same issue).
I tried to add the java.net.http module in WEB-INF/jboss-deployment-structure.xml in the WAR but it does not change a thing.
<jboss-deployment-structure>
<module name="deployment.java.net.http" />
</jboss-deployment-structure>
The stacktrace ends with:
Caused by: java.lang.NoClassDefFoundError: java/net/http/HttpResponse$BodyHandler at deployment.orbis-events-4u.war//io.apicurio.registry.rest.client.impl.RegistryClientImpl.<init>(RegistryClientImpl.java:67)
at deployment.orbis-events-4u.war//io.apicurio.registry.rest.client.impl.RegistryClientImpl.<init>(RegistryClientImpl.java:63)
at deployment.orbis-events-4u.war//io.apicurio.registry.rest.client.RegistryClientFactory.create(RegistryClientFactory.java:34)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.AbstractSchemaResolver.configure(AbstractSchemaResolver.java:84)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.DefaultSchemaResolver.configure(DefaultSchemaResolver.java:59)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.SchemaResolverConfigurer.configure(SchemaResolverConfigurer.java:75)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.AbstractKafkaSerDe.configure(AbstractKafkaSerDe.java:68)
at deployment.orbis-events-4u.war//io.apicurio.registry.serde.avro.AvroKafkaSerializer.configure(AvroKafkaSerializer.java:81)
at deployment.orbis-events-4u.war//org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:375)
... 62 more
Caused by: java.lang.ClassNotFoundException: java.net.http.HttpResponse$BodyHandler from [Module "deployment.orbis-events-4u.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 71 more
I'm very surprised that access to java.net.http module is not available out of the box.
Is there something I can do in the configuration of my app?
Is it a known WF issue?
The content of jboss-deployment-structure.xml I was using is incorrect.
Issue is solved with the following content:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="java.net.http"/>
</dependencies>
</deployment>

two web services SOAP not working with wildfly 9.0.2

So i have one SOAP application which works fine with Wildfly another one earlier was built on apache cxf and was running on tomcat but i had to make it work with Wildfly so i added a Jboss-deployment-structure as below.
<?xml version='1.0' encoding='UTF-8'?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"> <deployment>
<exclude-subsystems>
<subsystem name="webservices" />
</exclude-subsystems> </deployment> </jboss-deployment-structure>
After which both web services started working on same wildfly but i noticed that if deployed they work but when the server is restarted the One which was working fine with Jboss gives below error where as the Apache Cxf one is working fine.
2017-12-21 04:20:09,856 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /booking/ReservationService: java.lang.LinkageError: Failed to link com/sun/xml/messaging/saaj/soap/SOAPDocumentImpl (Module "deployment.CreateWS.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
Caused by: java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
... 62 more
Caused by: java.lang.ClassNotFoundException: com.sun.org.apache.xerces.internal.dom.DocumentImpl from [Module "deployment.CreateWS.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 66 more
where booking is the WS working with jboss and CreateWS is apache cxf one.
I resolved the issue by adding a manifest.mf file in META-INF folder with depedency to the webservice which stopped working and so whenever the server is restarted the old WS is loaded first and deployed.

Wildfly Deployment Fails at missing "jboss.deployment.unit"

Currently I try, for my first time, to use Wildfly with MongoDB and Hibernate OGM. When I deploy my Project to Wildfly, the following error occurs:
"{ \"WFLYCTL0080: Failed services\" => {\"jboss.deployment.unit.\\\"{MYAPP}.war\\\".STRUCTURE\" => \"org.jboss.msc.service.StartException in service jboss.deployment.unit.\\\"{MYAPP}.war\\\".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment \\\"{MYAPP}.war\\\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0168: Error loading jboss-deployment-structure.xml from {MYUSERDIR}/wildfly10/standalone/deployments/{MYAPP}.war/WEB-INF/jboss-deployment-structure.xml
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,1]
Message: Unexpected element '{http://www.jboss.com/xml/ns/javaee}jboss-web'\"},
\"WFLYCTL0412: Required services that are not installed:\" => [\"jboss.deployment.unit.\\\"{MYAPP}.war\\\".STRUCTURE\"],
\"WFLYCTL0180: Services with missing/unavailable dependencies\" => undefined }"
My jboss-deployment-structure.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate" slot="ogm" services="import" />
<module name="org.hibernate.ogm.mongodb" slot="main" services="import" />
</dependencies>
</deployment>
</jboss-deployment-structure>
This Jboss Document mentions to add Modules (which I did) to the Wildfly Folder and add an Entry to the Manifest.mf File which I created manually.
Does anybody have an idea, what to try next?
I would also appreciate a Recommendation for a good Tutorial.
Sidenotes:
NetBeans 8.2
Wildfly 10
MacOS
MongoDB on Ubuntu 16.04 VM
I googled a lot
The Tutorial I basically used

How to log with slf4j from within a jboss module?

How can I log to console / server.log from within a jboss module?
Say that I have a class:
public class MyClass {
private static final Logger logger = LoggerFactory.getLogger(MyClass.class);
private boolean done = false;
public void doSomething() {
logger.info("Look ma, I'm logging!");
done = true;
}
public boolean isDone() {
return done;
}
}
If I want to log from a deployed artifact (e.g., MyWebProject.war), all I have to do is:
Compile against slf4j-api
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
<scope>provided</scope>
</dependency>
Deploy
./jboss-cli.sh -c "deploy MyWebProject.war"
Profit
2015-10-19 11:04:02,445 INFO [com.myCompany.MyClass] (default task-13) Look ma, I'm logging!
But for the life of mine, I can't manage to do the same from within a jboss module.
Example: If MyWebProject.war uses MyModule.jar, and MyModule.jar is deployed as a jboss module:
${jbossHome}/modules/com/mycompany/mymodule/main
|____ MyModule.jar
|____ module.xml
Module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mycompany.mymodule">
<resources>
<resource-root path="MyModule.jar" />
</resources>
<dependencies>
<module name="org.slf4j" />
</dependencies>
</module>
If I move MyClass into MyModule.jar and use it from MyWebProject.war I can see the side effects (e.g., isDone() == true) but nothing is written to server.log.
What am I missing? Do I need any other module dependencies but slf4j?
For further reference, my problem had nothing to do with logging. The above recipe works as expected. In fact I've suffered because of a red herring: my original module.xml was never really used. I was actually loading a old class with the same name in another module. This old version of the class had no logging and should not be there to begin with.
Anyway, I think that the root cause of my problem (besides my lack of attention) was a small bug in jboss-cli.
I was deploying mymodule with the following command:
module add --name=com.mycompany.mymodule \
--resources=MyModule.jar \
--dependencies=org.slf4j \
--main-class=com.mycompany.mymodule.Main
This command was generating a module.xml like this:
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="com.mycompany.mymodule">
<main-class value="com.mycompany.mymodule.Main"/>
<resources>
<resource-root path="MyModule.jar"/>
</resources>
<dependencies>
<module name="org.slf4j"/>
</dependencies>
</module>
When I've finally managed to get my web project to try to load mymodule it failed with a stack trace such as:
18:45:59,999 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.module.service."deployment.MyWebProject.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.MyWebProject.war".main: WFLYSRV0179: Failed to load module: deployment.MyWebProject.war.war:main
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91)
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.modules.ModuleLoadException: Error loading module from C:\opt\server\wildfly-9.0.1.Final\modules\com\mycompany\mymodule\main\module.xml
at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:150)
at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:127)
at org.jboss.modules.LocalModuleFinder$1.run(LocalModuleFinder.java:150)
at org.jboss.modules.LocalModuleFinder$1.run(LocalModuleFinder.java:144)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.modules.LocalModuleFinder.findModule(LocalModuleFinder.java:144)
at org.jboss.modules.ModuleLoader.findModule(ModuleLoader.java:452)
at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:355)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:302)
at org.jboss.modules.ModuleLoader.preloadExportedModule(ModuleLoader.java:313)
at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:326)
at org.jboss.as.server.moduleservice.ServiceModuleLoader.preloadModule(ServiceModuleLoader.java:149)
at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:234)
at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:74)
... 5 more
Caused by: org.jboss.modules.xml.XmlPullParserException: Unexpected content of type 'element start' named 'main-class', text is: '<main-class value="com.mycompany.mymodule.Main"/>' (position: START_TAG seen ...n-class value="com.mycompany.mymodule.Main"/>... #5:54)
at org.jboss.modules.ModuleXmlParser.unexpectedContent(ModuleXmlParser.java:179)
at org.jboss.modules.ModuleXmlParser.parseMainClass(ModuleXmlParser.java:620)
at org.jboss.modules.ModuleXmlParser.parseModuleContents(ModuleXmlParser.java:445)
at org.jboss.modules.ModuleXmlParser.parseDocument(ModuleXmlParser.java:261)
at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:148)
... 18 more
Taking a look at module-1_1.xsd I've found out that the main-class element was expecting a name attribute instead of a value attribute. So I've manually changed the module.xml to:
<main-class name="com.mycompany.mymodule.Main"/>
After I've restarted WildFly and redeployed my web project everything worked as expected.

Error deploying jar file on jboss-as-7.1.1

I have the following situation:
I have a java application with three projects:
Java Project
EJB Module
Web Project
using net beans, I build the three projects and upload them on the server.
The Java Project deploy successfully but the EJB Module which depends on the Java Project gives the following error:
12:35:00,811 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."MyApp.jar".POST_MODULE: org.jboss.msc.service$
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:1110) [rt.jar:1.6.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_20]
at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_20]
Caused by: java.lang.RuntimeException: Error getting reflective information for class gss.myapp.sessions.CardValidatorBean with ClassLoader ModuleClassLoader for Module "deplo$
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.NoClassDefFoundError: gss/commons/exceptions/BusinessEntityFindException
at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_20]
at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.6.0_20]
at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.6.0_20]
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
Caused by: java.lang.ClassNotFoundException: gss.commons.exceptions.BusinessEntityFindException from [Module "deployment.MyApp.jar: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.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 15 more
The exception clearly states that it could not find the class
gss.commons.exceptions.BusinessEntityFindException
Your ejb jar file MANIFEST.MF should contain the classpath it needs
e.g
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_25-b06 (Sun Microsystems Inc.)
Class-Path: your-java-project.jar
and make sure you include your your-java-project.jar in your server classpath.
You need add gss.commons.exceptions.BusinessEntityFindException class to JBoss:
I'll call YOUR_JAR.jar to the jar that contains gss/commons/exceptions/BusinessEntityFindException
1: Add a Module to JBoss
Stop your JBoss Server
Find YOUR_JAR.jar on your directory
Make the next directory on your JBoss: JBOSS_HOME/modules/org/gss/main
Put YOUR_JAR.jar on this directory
Make a file called module.xml and add:
<
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.gss">
<resources>
<resource-root path="YOUR_JAR.jar"/>
</resources>
</module>
*
2: Call your new module from your project:
On your web project make a file WEB-INF/jboss-deployment-structure.xml
add:
<
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.gss" meta-inf="export">
<imports>
<include path="META-INF" />
</imports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
start your Jboss Server

Categories

Resources