How to find missing classes in a webapp running in JBoss EAP 7.4? - jboss

My webapp running on JBoss EAP 7.4 is having problems locating certain classes. When I run, I see the following in the log:
2022-08-02 14:30:52,387 WARN [org.jboss.modules.define] (default
task-2) Failed to define class
org.apache.phoenix.schema.MetaDataSplitPolicy in Module
"deployment.dbp.rest-1.1.0-SNAPSHOT.war" from Service Module Loader:
java.lang.NoClassDefFoundError: Failed to link
org/apache/phoenix/schema/MetaDataSplitPolicy (Module
"deployment.dbp.rest-1.1.0-SNAPSHOT.war" from Service Module Loader):
Failed to link
org/apache/phoenix/schema/SplitOnLeadingVarCharColumnsPolicy (Module
"deployment.dbp.rest-1.1.0-SNAPSHOT.war" from Service Module Loader):
org/apache/phoenix/compat/hbase/CompatSteppingSplitPolicy
MetaDataSplitPolicy and SplitOnLeadingVarCharColumnsPolicy are present in our war file, but CompatSteppingSplitPolicy is not. The /usr/lib/phoenix/phoenix-hbase-compat-2.4.1-5.1.2.jar file contains CompatSteppingSplitPolicy. Adding external modules directories in JBoss EAP 6/7 tells how the classpath be extended to deployed content reference directories and files external to the installation. I modified my .bashrc accordingly, and the log file now includes:
module.path = /opt/jboss-eap-7.4/modules:/usr/lib/phoenix/phoenix-hbase-compat-2.4.1-5.1.2.jar:/usr/lib/phoenix/*
Unfortunately, I still get the same error. What can I do to fix it?

why not adding the jar in your war ? otherwise you need to add a dependency on that module in your war

Related

How do I ignore/upgrade a module in JBoss Wildfly 9?

I just downloaded Wildfly 9.0.0.CR2 with Java 7 on Mac 10.9.5. I notice by default, Wildfly 9 includes a bouncycastle module (modules/system/layers/base/org/bouncycastle/main/bcprov-jdk15on-1.52.jar) . I would like to install another bouncycastle module in Wildfly (bcprov-jdk16-1.46.jar). Is there a way I can disable the one that JBoss has included? When I tried to delete the module Jboss included (the modules/system/layers/base/org/bouncycastle/ folder), I get the error upon JBoss startup
08:36:19,086 ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0055: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0085: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:131)
at org.jboss.as.server.ServerService.boot(ServerService.java:350)
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:271)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0083: Failed to load module org.jboss.as.weld
at org.jboss.as.controller.parsing.ExtensionXml.parseExtensions(ExtensionXml.java:155)
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_4(StandaloneXml.java:433)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:144)
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:106)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123)
... 3 more
You might have a look at this discussion, it is almost the same thing you want to do (opposite direction w.r.t. versions):
BouncyCastle 1.51 loading in war on Wildfly 8.0
The long and the short of it is, you can create a custom module (or, I think, another slot for the existing module?) and reference that one in your jboss-deployment-structure.xml instead of the default module wildfly is bringing with it.
If you don't want/need BC as a module, you could also just include it in the lib folder of your EAR/WAR and it will be loadable from there.
Our deployment structure looks essentially like this:
my.ear
+ lib/ <-- dependencies for multi-submodule deployment
+ META-INF/ <-- application.xml defines submodule(s) e.g. web.war,
<-- also jboss-deployment-structure.xml to include/export wildfly core modules for your EAR
+ web.war <-- our core deployment
And we include e.g. a different version of hibernate than in wildfly. I expect you can include a different BC version in your ear as well.
See also:
https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly
Custom module tutorial:
http://middlewaremagic.com/jboss/?p=1933
Similar issue with resolution: https://developer.jboss.org/thread/175395
WildFly uses modular classloading and as such not everything is on classpath of every module.
Deployment itself is just another module that gets extra dependencies based on what deployment descriptors tell server should be added.
When it comes to bouncycastle, there are modules that themselves require it, but that doesn't mean they will expose this dependency to your deployment.
There was a bug in 8.0 that caused that BC was exposed to user deployment in case when user deployment was using web services. This was fixed since than.
Given that you use WildFly 9 that shouldn't a problem anymore.
As other suggested, you can create new module with different name or at least different slot name, which you can than include via your jboss-deployment-structure.xml
Just btw, bcprov-jdk16-1.46 is much older than what is provided in WildFly.

Jboss log manager error

I am trying to start up JBoss with parameters in Windows but getting some errors. If I remove parameters than JBoss startup iwht no errors. Could some one please take a look.
environment variables:
JAVA_HOME=C:\Java\jdk1.6.0_45
JBOSS_HOME=C:\bin\jboss-eap-6.1
Path=C:\Java\jdk1.6.0_45\bin;C:\WINDOWS\system32;
start up jboss with following parameters:
set "JAVA_OPTS=%JAVA_OPTS%
-Djava.rmi.server.hostname=myhost
-Dcom.sun.management.jmxremote.port=myport
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=C:\Java\jdk\jre\lib\management\jmx.password
-Dcom.sun.management.jmxremote.access.file=C:\Java\jdk\jre\lib\management\jmx.access
"
Error:
WARNING: failed to load the specified log manager class org.jboss.logmanager.LogManager
Error: Operation <"parallel-extension-add"> failed - address:<[]>
java.lang.RuntimeException: failed initializing module org.jboss.as.logging
==========================================================================
so to fix the error above. I have added logmanager parameter below.
start up jboss using parameters:
set "JAVA_OPTS=%JAVA_OPTS%
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Djava.rmi.server.hostname=myhost
-Dcom.sun.management.jmxremote.port=myport
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=C:\Java\jdk\jre\lib\management\jmx.password
-Dcom.sun.management.jmxremote.access.file=C:\Java\jdk\jre\lib\management\jmx.access
​"
ERROR:
Could not load Logmanager "org.jboss.logmanager.LogManager"
java.lang.ClassNotFoundException: org.jboss.logmanager.logManager
==========================================================================
so to fix error above. I have added -xbootclasspath parameter.
start up jboss using parameters:
set "JAVA_OPTS=%JAVA_OPTS%
-Djava.util.logging.manager=org.jboss.logmanager.LogManager"
-Xbootclasspath:C:\bin\jboss-eap-6.1\modules\system\layers\base\org\jboss\logmanager\main\jboss-logmanager-1.4.0.Final-redhat-1.jar
-Djava.rmi.server.hostname=myhost
-Dcom.sun.management.jmxremote.port=myport
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=C:\Java\jdk\jre\lib\management\jmx.password
-Dcom.sun.management.jmxremote.access.file=C:\Java\jdk\jre\lib\management\jmx.access
​"
ERROR:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
and now I have no idea what to do. I have tried reinstalling jdk but no luck.
when I enter "java -version" in CMD. Than I get result: "1.6.0_45". So I know jdk is set up. but when I start Jboss than jdk is not initialization.
To resolve this, do the following:
Go to the JBOSS_HOME location on the file system e.g. c:\jboss\appserver\jboss-eap-6.3, look in the bin folder and open the configuration file named, standalone.conf, in a text editor.
At the top of the file, add the following line - JBOSS_MODULES_SYSTEM_PKGS="org.jboss.logmanager".
Scroll-down the file, to where JVM options are specified and add the following two options:
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.jboss.logmanager.LogManager" JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:$JBOSS_HOME/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-1.5.2.Final-redhat-1.jar"
Note: You may need to modify the exact path to the logmanager jar file, as the one on your jboss installation may differ from what applies here. The JBoss EAP version being used in this case was 6.3.0GA. A different version may have a different path to the logmanager jar file.
Simply save the modified 'standalone.conf' file, with these couple of changes, and re-attempt starting up of the JBoss App server (either on the CLI or within Eclipse).
Note: For fixing the issue for a JBoss EAP appserver instance running just within Eclipse, simply open the server's launch configuration and add the 2 JVM options to the VM arguments of the launch configuration, as shown in the screenshot below:
Voila! The startup issue with regards to failure to load the LogManager, should be resolved.
Check this blogpost for details and screenshots - http://obinnakalu.blogspot.com/2014/10/jboss-enterprise-application-platform.html
Although this is an old post, but if someone is still facing the issue:
-Xbootclasspath:C:\bin\jboss-eap-......
Above line replaces bootclasspath and now jvm will use only the specified jar to boot.
Use -Xbootclasspath\a:C:\bin\jboss-eap-......
instead. This will append the mentioned jar to existing bootclasspath.
For Jboss 7.1.1 I have solved this issue by adding following lines in standalone.conf.bat. All the jars are taken from JBoss 7.1.1 modules folder
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Xbootclasspath/p:E:/jboss-logmanager-1.2.2.GA.jar;E:/jboss-logmanager-log4j-1.0.0.GA.jar;E:/log4j-1.2.16.jar"

java.lang.ClassNotFoundException for a class in external JAR

I have a maven project in Eclipse Java EE IDE for Web Developers.
When running Tomcat, I'm getting an error for a class that I can see that I have included.
My question is - do I have to add these JARs to an additional place because of Tomcat Apache?
Error:
SEVERE: Servlet /Resource threw load() exception
java.lang.ClassNotFoundException: org.odata4j.jersey.producer.resources.ODataApplication
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:240)
at com.sun.jersey.core.reflection.ReflectionHelper.classForNameWithException(ReflectionHelper.java:220)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:711)
And here is the class in my Library:
UPDATE:
My Web Deployment Assembly looks like:
The issue you are seeing is due to the fact that tomcat is looking at the wrong directory. It is currently most likely pointed at your src/main/webapp directory of your project. This does not jive with how maven works. Maven downloads the dependencies, but will only include them in the target build. You need to have the tomcat server look at target/myapp-0.0.1, or build to a war and deploy that way. The easiest solution as of now, would be for you to use the tomcat plugin. After setting it up, you can use an imbedded server, and just use the following command 'mvn tomcat:run'.
Maven Tomcat Plugin Docs
UPDATE:
I looked at the properties settings, and you should actually be able to edit the "Web Deployment Assembly" settings for your project (under project properties). Check screenshot for how I have mine setup. Notice how Maven Dependencies is mapped.
http://imgur.com/ofxryns

Error deploying application to Glassfish 3

When I try to deploy my application named shopping-1 to Glassfish 3 I get the following error:
'Publishing to GlassFish Server Open Source Edition 3 (Java EE 6)2 at localhost...'has encountered a problen.
cannot Deploy shopping-1
Deployment Error for module: shopping-1: Exception while loading the app :
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
org.apache.catalina.LifecycleException:
java.lang.ClassNotFoundException:
org.springframework.web.servlet.DispatcherServlet
How do I track down and fix this issue?
apparently the shopping-1.war file doesn't include the archive containing the DispatcherServlet class.
unzip -l shopping-1.war | grep spring (on Linux) will give you the list of all spring-related included jar files
First run appserver admin-list applications
Check if there are any deployed applications on the server.
Undeploy by running them if there are.
Stop the application server.
Open the location folder where you have the war file for deployment
Check that there is only one war file at a time in it.
7.Start the application server
Deploy the war.
Should work fine.

weblogic 11g R1

I have prepared my ejb jars and war using weblogic.appc
weblogic 11g R1, all compilations were fine, I have prepared ear and deployed in weblogi server .I am getting belows erorr. afte deployment and ear status went to failed state.
I am not att all using this oracle.help.OHW file. don't know it is refered
Can any suggest how comeout of this problem.
[HTTP:101216]Servlet: "OHW" failed to preload on startup in Web application: "cbcm". javax.servlet.ServletException: [HTTP:101249][ServletContext#13514259[app:cbcm module:cbcm path:/cbcm spec-version:null]]: Servlet class oracle.help.OHW for servlet OHW could not be loaded because the requested class was not found in the classpath . java.lang.ClassNotFoundException: oracle.help.OHW. at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:551) at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985) at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878) at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153) at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200) at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27) at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205) at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58) at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161) at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116) at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:140) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844) at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253) at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68) at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Check your web.xml within your WAR, there is a servlet and servlet-mapping for the Oracle help files and this servlet most likely.
Comment out those.
I received the same error as "failed to preload on startup in Web application:".
Below is how I am able to resolve the error.
in your web.xml, check if following property is present
<load-on-startup>0</load-on-startup>
this property is to load your bundled artifacts during the server restart itself. This was the cause of the issue because there were some jar file which weblogic server required to load before the loading of our bundled artifacts. Now since server is not yet started completely and all the libraries required to our application is not yet loaded, hence server is throwing "failed to preload on startup in Web application:".
The solution to this is remove load-on-startup from web.xml and That's it!!