NoSuchMethodError deploying EAR - ejb

I'm encountering this issue while deploying my ear to my local JBoss 5.1 server which leads to a deployment error ...
One of my war is the problem but i don't managed to find a solution.
11:39:54,796 ERROR [[/pro-service]] Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) fr.mymaven.socle.log.LogbackConfigListener
java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
DEPLOYMENTS IN ERROR:
Deployment "vfszip:/D:/jtb/servers/jboss-eap-5.1/jboss-as/server/mezzo-cpcpro/deploy/produit-acps-ear-1.0.0-SNAPSHOT.ear/" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: URL file:/D:/jtb/servers/jboss-eap-5.1/jboss-as/server/mezzo-cpcpro/tmp/a643z2x-5nmmgf-gw7mzuun-1-gw7n0stq-ag/produit-acps-front-1.0.0-SNAPSHOT.war/ deployment failed
My EAR contains 2 WARs, when i deploy each war alone, it works.
The EAR structure :
jboss-seam-2.2.1.Final.jar (EJB)
WAR1
- META-INF
- WEB-INF
- Templates
- Scripts
- ... ect
WAR2
- META-INF
- WEB-INF
META-INF
lib
It's driving me crazy, any help will be greatly appreciated !
Regards,
F Jouatte

Could you please check if your 2 WAR files have the same version of slf4j library?
Also consider moving common libraries to EAR level.

Related

Karaf wants optional imports?

I'm trying to use org.eclipse.persistence.moxy 2.7.4 in Karaf.
Karaf 4.2.6 is saying:
Error executing command: Error executing command on bundles:
Error starting bundle 71: Unable to resolve HelloWorld [71](R 71.0): missing requirement [HelloWorld [71](R 71.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.codemodel) Unresolved requirements: [[HelloWorld [71](R 71.0)] osgi.wiring.package; (osgi.wiring.package=com.sun.codemodel)]
I think this is because moxy's META-INF includes:
Manifest-Version: 1.0
Bundle-SymbolicName: org.eclipse.persistence.moxy
Require-Bundle: org.eclipse.persistence.core;bundle-version="2.7.4";visibility:=reexport,org.eclipse.persistence.asm;bundle-version="7.0.0" ;resolution:=optional
Bundle-ManifestVersion: 2
Bundle-Vendor: Eclipse.org - EclipseLink Project
Import-Package: com.sun.xml.bind;resolution:=optional,com.sun.xml.bind.annotation;resolution:=optional,com.sun.xml.bind.api;resolution:=optional,com.sun.xml.bind.api.impl;resolution:=optional,com.sun.codemodel;resolution:=optional;version="[2.2.11,3)"
Bundle-Name: EclipseLink MOXy
Bundle-Version: 2.7.4.v20190115-ad5b7c6b2a
Note com.sun.codemodel;resolution:=optional;version="[2.2.11,3)
But it says "resolution:=optional". So why is this an unresolved requirement, and how can I make karaf treat it as optional?
Note that here, it's not moxy that complains about not finding that package, but your own service. Check your Import-Package in your META-INF/MANIFEST.MF, it's possible that if you use maven-bundle-plugin, the dependency is scanned thanks to your pom.xml and then inferred in your Import-Package clause.

Need to provide addtional jars to for xsbt-web-plugin container

I am trying to run my war file using xsbt-web-plugin. My war itself does not contain tomcat-jdbc-pool jar and javax-servlet-api. I tried using container configuration. But sbt complains configuration does not exist.
If I use provided configuration, webapp-runner fails.
I am sure I am missing something. But unable to figure it out.
WARNING: Failed to register in JMX: [javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.jdbc.pool.DataSourceFactory]]
What version of xsbt-web-plugin are you using? Can you post the contents of your sbt build configuration?
The Tomcat plugin in xsbt-web-plugin relies on webapp-runner, which does not appear to bundle the tomcat-jdbc library. You can add it via containerLibs in Tomcat:
enablePlugins(TomcatPlugin)
containerLibs in Tomcat += "org.apache.tomcat" % "tomcat-jdbc" % "8.5.15"

JHipster prod profile Grunt build error on Eclipse

I'm doing an app with JHipster 1.4.0 using Eclipse.
In dev profile, no problem, but when i switched to prod profile, there's an error in build :
Description : Plugin execution not covered by lifecycle configuration: com.github.trecloux:yeoman-maven-plugin:0.2:build (execution: run-grunt, phase: generate-resources)
Resource : pom.xml
Path : /myapp
Location : line 444
Type : Maven Project Build Lifecycle Mapping Problem
I'm new to Eclipse and i didn't find a solution on forums. If someone can help...
Thanks !
I just had a same issue, and this was because I had another process using the same port number as Grunt (port 9001).
Can you check your Grunt error message? I had:
Running "connect:test" (connect) task
Fatal error: Port 9001 is already in use by another process.

Error during deploy of WAR in JBOSS 5.1

I don't understand why I get an error during deploying of my webapp. At first time the deploy works but from the second I get this error:
DEPLOYMENTS IN ERROR:
Deployment "vfszip:/C:/jboss/deploy/TestServlet.war/" is in error due to the following reason(s): org.
jboss.deployers.spi.DeploymentException: Web mapping already exists for deployment URL file:/C:/jboss/tmp/a6q5r3z-z5l3qt-hfcant4w-1-hfclha33-ta/TestServlet.war/
I read in several threads on the web that I have to add into WEB-INF folder the jboss-web.xml file. So i added with the following content, but I still get the same error:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC
"-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
<context-root>/TestServlet</context-root>
</jboss-web>
The AS is JBOSS 5.1
Change <context-root>/TestServlet</context-root> to <context-root>TestServlet</context-root>. '/' is not required here. Please try that. And one more thing, do you have ROOT.war in Jboss

java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException in JBoss AS 7

I am testing JBoss AS 7 prior to deployment with a .war file of an app running in a different server.
I get this error when I try to log onto the database via the app:
SEVERE [] (http--0.0.0.0-8080-4) java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException from [Module "deployment.app.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.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
In some forums, they suggest adding the commons-codec jar, but I already have it in JBoss, right? (in here: jboss-as-7.1.1.Final/modules/org/apache/commons/codec/main/commons-codec-1.4.jar)
OSGi is not activated, frankly I have no idea to what purpose it serves, but when I try to activate it it messes with my war as it fails to deploy...
I have JDK, but no JRE if that's any help.
JBoss AS 7 does not use OSGi by default for modular class loading. It uses JBoss Modules so this has nothing to do with OSGi.
What you need to do if you want to use the commons-codec provided with JBoss AS 7 is add a dependency to your deployment.
Modules are not visible by your artefact classes automatically. You have three possibilities:
Define a global module in your standalone.xml
http://javahowto.blogspot.de/2012/09/how-to-create-global-modules-in-jboss.html
This module will be used by all artefacts you are deploying on Jboss.
Put it into your war artefact, into the lib folder. You can do that with Maven.
Define an explicit dependency within your Manifest. https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7
Section Dependencies: Manifest Entries

Resources