How to resolve SLF4J, LOG4j2 issue in OSGi Application? - spring-boot

I have an OSGi Application that uses log4j 2.17.1, slf4j-api-2.0.3.jar, and slf4j-reload4j-2.0.3.jar. The web server is running Tomcat 8.0.53. I'm getting this log4j2 error in the debug log when starting the application, and I'm not getting any logs although the application is running.
DEBUG StatusLogger Not in a ServletContext environment, thus not loading WebLookup plugin.
DEBUG StatusLogger Unable to retrieve WatchEventService from ClassLoader org.company.dao.webcontainer.tomcat.WebAppClassLoader#140c9f39
java.lang.NullPointerException
at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:354)
at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)
at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)
at org.apache.logging.log4j.core.util.WatchManager.getEventServices(WatchManager.java:164)
at org.apache.logging.log4j.core.util.WatchManager.<init>(WatchManager.java:137)
at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:140)
at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:46)
at org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:95)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:254)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:218)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:140)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:123)
at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:309)
at org.apache.log4j.LogManager$PrivateManager.getContext(LogManager.java:244)
at org.apache.log4j.LogManager.getRootLogger(LogManager.java:89)
at org.slf4j.reload4j.Reload4jLoggerFactory.<init>(Reload4jLoggerFactory.java:66)
at org.slf4j.reload4j.Reload4jServiceProvider.initialize(Reload4jServiceProvider.java:35)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:152)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:139)
at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:422)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:408)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.cxf.common.logging.LogUtils.<clinit>(LogUtils.java:103)
at org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser.<clinit>(AbstractBeanDefinitionParser.java:65)
at org.apache.cxf.jaxrs.spring.NamespaceHandler.init(NamespaceHandler.java:27)
at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:131)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1406)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1401)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:168)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:138)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:94)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:181)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:609)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:510)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4900)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5363)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.company.dao.webcontainer.tomcat.TomcatWrapper.startWebApp(TomcatWrapper.java:187)
at org.company.dao.webcontainer.tomcat.TomcatWrapper.prepareAllWebApps(TomcatWrapper.java:141)
at org.company.dao.webcontainer.tomcat.TomcatWrapper.startServer(TomcatWrapper.java:208)
at org.company.dao.webcontainer.tomcat.Application.start(Application.java:30)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
I have org.apache.logging.log4j.core.util in the 'Export-Package' of the MANIFEST.MF file. Am I missing anything?
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Dao Logging
Bundle-SymbolicName: org.company.dao.logging;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: org.company.dao.logging.Activator
Require-Bundle: org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: bin/,
lib/slf4j-api-2.0.3.jar,
lib/log4j-slf4j-impl-2.17.1.jar,
lib/log4j-1.2-api-2.17.1.jar,
lib/log4j-api-2.17.1.jar,
lib/log4j-core-2.17.1.jar,
lib/commons-logging-1.2.jar
Export-Package: org.apache.commons.logging,
org.apache.commons.logging.impl,
org.apache.log4j,
org.apache.log4j.bridge,
org.apache.log4j.builders,
org.apache.log4j.builders.appender,
org.apache.log4j.builders.filter,
org.apache.log4j.builders.layout,
org.apache.log4j.builders.rewrite,
org.apache.log4j.builders.rolling,
org.apache.log4j.component.helpers,
org.apache.log4j.config,
org.apache.log4j.helpers,
org.apache.log4j.jmx,
org.apache.log4j.layout,
org.apache.log4j.legacy.core,
org.apache.log4j.or,
org.apache.log4j.or.jms,
org.apache.log4j.pattern,
org.apache.log4j.rewrite,
org.apache.log4j.spi,
org.apache.log4j.varia,
org.apache.log4j.xml,
org.apache.logging.log4j,
org.apache.logging.log4j.core,
org.apache.logging.log4j.core.appender,
org.apache.logging.log4j.core.appender.db,
org.apache.logging.log4j.core.appender.db.jdbc,
org.apache.logging.log4j.core.appender.mom,
org.apache.logging.log4j.core.appender.mom.jeromq,
org.apache.logging.log4j.core.appender.mom.kafka,
org.apache.logging.log4j.core.appender.nosql,
org.apache.logging.log4j.core.appender.rewrite,
org.apache.logging.log4j.core.appender.rolling,
org.apache.logging.log4j.core.appender.rolling.action,
org.apache.logging.log4j.core.appender.routing,
org.apache.logging.log4j.core.async,
org.apache.logging.log4j.core.config,
org.apache.logging.log4j.core.config.arbiters,
org.apache.logging.log4j.core.config.builder.api,
org.apache.logging.log4j.core.config.builder.impl,
org.apache.logging.log4j.core.config.composite,
org.apache.logging.log4j.core.config.json,
org.apache.logging.log4j.core.config.plugins,
org.apache.logging.log4j.core.config.plugins.convert,
org.apache.logging.log4j.core.config.plugins.processor,
org.apache.logging.log4j.core.config.plugins.util,
org.apache.logging.log4j.core.config.plugins.validation,
org.apache.logging.log4j.core.config.plugins.validation.constraints,
org.apache.logging.log4j.core.config.plugins.validation.validators,
org.apache.logging.log4j.core.config.plugins.visitors,
org.apache.logging.log4j.core.config.properties,
org.apache.logging.log4j.core.config.status,
org.apache.logging.log4j.core.config.xml,
org.apache.logging.log4j.core.config.yaml,
org.apache.logging.log4j.core.filter,
org.apache.logging.log4j.core.impl,
org.apache.logging.log4j.core.jackson,
org.apache.logging.log4j.core.jmx,
org.apache.logging.log4j.core.layout,
org.apache.logging.log4j.core.layout.internal,
org.apache.logging.log4j.core.lookup,
org.apache.logging.log4j.core.message,
org.apache.logging.log4j.core.net,
org.apache.logging.log4j.core.net.ssl,
org.apache.logging.log4j.core.osgi,
org.apache.logging.log4j.core.parser,
org.apache.logging.log4j.core.pattern,
org.apache.logging.log4j.core.script,
org.apache.logging.log4j.core.selector,
org.apache.logging.log4j.core.time,
org.apache.logging.log4j.core.time.internal,
org.apache.logging.log4j.core.tools,
org.apache.logging.log4j.core.tools.picocli,
org.apache.logging.log4j.core.util,
org.apache.logging.log4j.core.util.datetime,
org.apache.logging.log4j.internal,
org.apache.logging.log4j.message,
org.apache.logging.log4j.simple,
org.apache.logging.log4j.spi,
org.apache.logging.log4j.status,
org.apache.logging.log4j.util,
org.apache.logging.slf4j,
org.slf4j,
org.slf4j.event,
org.slf4j.helpers,
org.slf4j.impl,
org.slf4j.spi
edit
Updating log4j to 2.19.0 cleared the error but I'm getting messages like this now
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [bundleresource://8.fwk600746945:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
Here's all of the slf4j jars in my OSGi Bundle
root#8be4d7b90d60:/opt/core_server/default/plugins# find . -name "*slf4j*"
./com.company.platform.analytics.agent.model-2.0.0-SNAPSHOT/target/lib/slf4j-reload4j-2.0.3.jar
./com.company.platform.analytics.agent.model-2.0.0-SNAPSHOT/target/lib/slf4j-api-2.0.3.jar
./com.github.codegerm:org.cg.eventbus-1.0.9/target/lib/slf4j-reload4j-2.0.3.jar
./com.github.codegerm:org.cg.eventbus-1.0.9/target/lib/slf4j-api-2.0.3.jar
./com.company.platform.internal.agent-2.0.0-SNAPSHOT/target/lib/slf4j-reload4j-2.0.3.jar
./com.company.platform.internal.agent-2.0.0-SNAPSHOT/target/lib/slf4j-api-2.0.3.jar
./com.company.platform.data.common-2.0.0-SNAPSHOT/target/lib/slf4j-reload4j-2.0.3.jar
./com.company.platform.data.common-2.0.0-SNAPSHOT/target/lib/slf4j-api-2.0.3.jar
./com.github.codegerm:org.cg.services.core-1.0.12/target/lib/slf4j-reload4j-2.0.3.jar
./com.github.codegerm:org.cg.services.core-1.0.12/target/lib/slf4j-api-2.0.3.jar
./com.company.platform.configuration.management:com.company.platform.configuration.management-2.0.0-SNAPSHOT/target/lib/slf4j-reload4j-2.0.3.jar
./com.company.platform.configuration.management:com.company.platform.configuration.management-2.0.0-SNAPSHOT/target/lib/slf4j-api-2.0.3.jar
./org.cg.dao.logging_1.0.0/lib/log4j-slf4j-impl-2.19.0.jar
./org.cg.dao.logging_1.0.0/lib/slf4j-api-2.0.3.jar
./com.company.platform.ingestion-2.0.0-SNAPSHOT/target/lib/slf4j-reload4j-2.0.3.jar
./com.company.platform.ingestion-2.0.0-SNAPSHOT/target/lib/slf4j-api-2.0.3.jar
./com.company.platform.ingestion-2.0.0-SNAPSHOT/target/lib/jcl-over-slf4j-1.7.14.jar
./com.company.platform.security-2.0.0-SNAPSHOT/target/lib/slf4j-reload4j-2.0.3.jar
./com.company.platform.security-2.0.0-SNAPSHOT/target/lib/slf4j-api-2.0.3.jar
./com.company.platform.security-2.0.0-SNAPSHOT/target/lib/jcl-over-slf4j-1.7.14.jar
edit-2 Replacing log4j-slf4j-impl-2.19.0.jar with log4j-slf4j2-impl-2.19.0.jar fixed the "SLF4J: No SLF4J providers were found" issue.

Thanks to #Piotr!
I had to upgrade log4j to 2.19.0 then use log4j-slf4j2-impl instead of log4j-slf4j-impl to bind with slf4j 2.0.3.
All is good now!

Related

EmbeddedKafkaBroker Error with EmbeddedKafkaContextCustomizer.java:71

We used KafkaEmbedded with spring-kafka-test 2.1.4.RELEASE earlier.
While upgrading spring-kafka-test to 2.4.13.RELEASE, we required to move from KafkaEmbedded to EmbeddedKafkaBroker. This is giving below error. We are using EmbeddedKafka annotation and spring boot starter parent version is 2.0.0.RELEASE, spring-kafka version is 2.1.4.RELEASE.
Tried different versions of spring-kafka-test.
java.lang.NoClassDefFoundError: org/springframework/core/log/LogAccessor
at org.springframework.kafka.test.EmbeddedKafkaBroker.<clinit>(EmbeddedKafkaBroker.java:92)
at org.springframework.kafka.test.context.EmbeddedKafkaContextCustomizer.customizeContext(EmbeddedKafkaContextCustomizer.java:71)
at org.springframework.boot.test.context.SpringBootContextLoader$ContextCustomizerAdapter.initialize(SpringBootContextLoader.java:336)
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:626)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:366)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:138)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:107)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:242)
at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance(AbstractTestNGSpringContextTests.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:510)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:211)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:170)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
Caused by: java.lang.ClassNotFoundException: org.springframework.core.log.LogAccessor
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
37 more
Your versions are mis-matched. Boot 2.0.x and Spring for Apache Kafka 2.4.x are no longer supported, but 2.4.x requires Boot 2.2.x or later. See the matrix on the project page:
https://spring.io/projects/spring-kafka#overview
Also see
https://spring.io/projects/spring-kafka#support
and
https://spring.io/projects/spring-boot#support
The current (OSS) supported Boot versions are 2.7.x and 3.0.x, and Spring for Apache Kafka 2.9.x and 3.0.x.
You also must use the same version for spring-kafka and spring-kafka-test; they cannot be different.

Integrating jersey library in JBoss Application

I am trying to HBase Java Client into Jboss Web Application. When I created proof of concept (POC), an standalone application, for HBase access, it did not require to integrate jersey libraries.
But when I am integrating same POC module in Jboss Web App, it threw following exception.
13:37:20,261 WARN [org.jboss.modules] (http--0.0.0.0-8080-2) Failed to define class org.apache.hadoop.hdfs.web.resources.UserProvider in Module "deployment.HFPlatform.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link org/apache/hadoop/hdfs/web/resources/UserProvider (Module "deployment.HFPlatform.ear:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
at org.jboss.modules.Module.loadModuleClass(Module.java:517)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
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.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:499) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:305) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-2.3.2.Final.jar:]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
.
.
.
Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/spi/inject/InjectableProvider
at java.lang.ClassLoader.defineClass1(Native Method) [classes.jar:1.6.0_65]
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) [classes.jar:1.6.0_65]
at java.lang.ClassLoader.defineClass(ClassLoader.java:621) [classes.jar:1.6.0_65]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [classes.jar:1.6.0_65]
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
To fix following class issue, I added jersey jar.
Caused by: java.lang.NoClassDefFoundError: com/sun/jersey/spi/inject/InjectableProvider
Then it start giving following problem
13:56:11,021 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."HFPlatform.ear".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."HFPlatform.ear".POST_MODULE: Failed to process phase POST_MODULE of deployment "HFPlatform.ear"
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$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_65]
at java.lang.Thread.run(Thread.java:695) [classes.jar:1.6.0_65]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed. com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.WebAppResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.api.core.ApplicationAdapter org.apache.hadoop.hbase.rest.ResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.api.core.DefaultResourceConfig
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:209)
at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:101)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
Please help me to solve this problem. Standalone HBase works without jersey but this does not work with JBoss.
Exception is saying you have more than one JAX-RS provider.
By default Jboss comes with resteasy jars. Remove resteasy jars from you classpath. it should work.
OR
check any other JAX-RS provider jar is in your classpath.

java.lang.ClassNotFoundException: javax.naming.Referenceable

I have been trying to use activeMQ from an OSGi bundle and I have been running into some issues. I have been getting the one above now and I'm not sure what I need to do. Normally when I get this error it just means that you didn't import the package that you needed, but I have already added the javax.naming package in my manifest file.
This is what my manifest file looks like.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.activemq.test
Bundle-SymbolicName: com.activemq.test
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Activator: com.activemq.test.App
Import-Package: javax.jms,
javax.naming,
org.osgi.framework
Require-Bundle: ActiveMQExportTest;bundle-version="1.0.0"
I am running the activeMQ helloworld application that they provide on their website. It works great when I run it normally, but if you wrap it into an osgi bundle it starts to fail.
Edit: I don't know if it's relevant, but the Required-Bundle is the activeMQ-all jar wrapped in a plugin to expose the packages that I need.
Stack Trace. If you need something else, let me know.
[7/30/13 9:14:17:782 CDT] 00000018 LogService-64-com.ibm.ws.org.apache.aries.proxy.1.0.2 E CWWKE0701E: FrameworkEvent ERROR Bundle:com.ibm.ws.org.apache.aries.proxy.1.0.2(id=64) java.lang.ClassFormatError: Unexpected error from weaving hook.
at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:74)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:600)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:219)
at org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.visit(AbstractWovenProxyAdapter.java:228)
at org.objectweb.asm.ClassVisitor.visit(Unknown Source)
at org.objectweb.asm.commons.SerialVersionUIDAdder.visit(Unknown Source)
at org.apache.aries.proxy.impl.weaving.SyntheticSerialVerUIDAdder.visit(SyntheticSerialVerUIDAdder.java:60)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.apache.aries.proxy.impl.weaving.WovenProxyGenerator.getWovenProxy(WovenProxyGenerator.java:54)
at org.apache.aries.proxy.impl.weaving.ProxyWeavingHook.weave(ProxyWeavingHook.java:87)
at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.call(WovenClassImpl.java:140)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1239)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1222)
at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.callHooks(WovenClassImpl.java:182)
at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:68)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:600)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at com.ibm.activemq.test.App$HelloWorldProducer.run(App.java:73)
at java.lang.Thread.run(Thread.java:780)
Caused by: java.lang.NoClassDefFoundError: javax.naming.Referenceable
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:632)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:607)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:568)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:492)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:465)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:464)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:219)
at org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.checkInterfacesForSerializability(AbstractWovenProxyAdapter.java:308)
at org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.visit(AbstractWovenProxyAdapter.java:231)
at org.objectweb.asm.ClassVisitor.visit(Unknown Source)
at org.objectweb.asm.commons.SerialVersionUIDAdder.visit(Unknown Source)
at org.apache.aries.proxy.impl.weaving.SyntheticSerialVerUIDAdder.visit(SyntheticSerialVerUIDAdder.java:60)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.apache.aries.proxy.impl.weaving.WovenProxyGenerator.getWovenProxy(WovenProxyGenerator.java:54)
at org.apache.aries.proxy.impl.weaving.ProxyWeavingHook.weave(ProxyWeavingHook.java:87)
at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.call(WovenClassImpl.java:140)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1239)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1222)
at org.eclipse.osgi.internal.baseadaptor.weaving.WovenClassImpl.callHooks(WovenClassImpl.java:182)
at org.eclipse.osgi.internal.baseadaptor.weaving.WeavingHookConfigurator.processClass(WeavingHookConfigurator.java:68)
... 40 more
Caused by: java.lang.ClassNotFoundException: javax.naming.Referenceable
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
... 68 more
If anyone has any suggestions, I would gladly take them. Thanks!
Normally when you have a static reference to a class/interface that is missing you get NoClassDefFoundError, wheras the checked exception ClassNotFoundException usually happens when somebody calls Class.forName or one of its variants.
My suspicion is that the exception doesn't even come from the bundle whose manifest you have shown above. I.e. one of your dependencies may use reflection to load a class that depends on javax.naming.Reference but that bundle does not import the package.
Perhaps if you post a full stack trace it might shed some light on the problem. Please update your question with this information, and I will update this answer if I see anything.

how to add old version of ehcache probe to grails project

I'm trying to add the ehcache-probe to a grails project.
I tried to add the jar as described here
I have conflicts with sl4j dependencies:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/melicloud/deploy/ml-build/ROOT/WEB-INF/lib/slf4j-jdk14-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/melicloud/deploy/ml-build/ROOT/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
and without them it jumps with other error:
SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
I also tried to add as maven2 dependency in BuildConfig.groovy to get an old version without sl4j:
repositories {
...
mavenRepo "http://www.terracotta.org/download/reflector/releases"
...
}
...
dependencies {
...
compile('org.terracotta:ehcache-probe:1.6')
...
}
But the dependency is not resolved
==== http://www.terracotta.org/download/reflector/releases: tried
http://www.terracotta.org/download/reflector/releases/org/terracotta/ehcache-probe/1.6/ehcache-probe-1.6.pom
-- artifact org.terracotta#ehcache-probe;1.6!ehcache-probe.jar:
http://www.terracotta.org/download/reflector/releases/org/terracotta/ehcache-probe/1.6/ehcache-probe-1.6.jar
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.terracotta#ehcache-probe;1.6: not found
::::::::::::::::::::::::::::::::::::::::::::::
EDIT: I also tried this: http://jira.grails.org/browse/GRAILS-6800 (deleting in _Events.groovy the grails slf4j dependencies and adding the ehcache-probe ones) but now I have a
SEVERE: Error listenerStart
EDIT 2: I tried this http://mythinkpond.wordpress.com/2011/07/01/tomcat-6-infamous-severe-error-listenerstart-message-how-to-debug-this-error/ and now I can see what it is:
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Now I know I can't use the last version of ehcache-probe, Have any thought of where to download a previous version?
Can you give any pointer in solving this?
thanks in advance

Moved to Spring 3.1.1 from Spring 3.0.5 now my App does not work

Moved to Spring 3.1.1 from Spring 3.0.5 now my App does not work can someone please tell me what is up? I removed all the 3.0.5 jars and added the 3.1.1 jars
2012-05-14 12:01:41,195 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.context.ApplicationContextException: Couldn't locate: org.springframework.ldap.core.support.BaseLdapPathContextSource. If you are using LDAP with Spring Security, please ensure that you include the spring-ldap jar file in your application; nested exception is java.lang.ClassNotFoundException: org.springframework.ldap.core.support.BaseLdapPathContextSource
at org.springframework.security.config.ldap.ContextSourceSettingPostProcessor.postProcessBeanFactory(ContextSourceSettingPostProcessor.java:34)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:664)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:446)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: org.springframework.ldap.core.support.BaseLdapPathContextSource
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
at org.springframework.security.config.ldap.ContextSourceSettingPostProcessor.postProcessBeanFactory(ContextSourceSettingPostProcessor.java:32)
... 21 more
May 14, 2012 12:01:41 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.context.ApplicationContextException: Couldn't locate: org.springframework.ldap.core.support.BaseLdapPathContextSource. If you are using LDAP with Spring Security, please ensure that you include the spring-ldap jar file in your application; nested exception is java.lang.ClassNotFoundException: org.springframework.ldap.core.support.BaseLdapPathContextSource
at org.springframework.security.config.ldap.ContextSourceSettingPostProcessor.postProcessBeanFactory(ContextSourceSettingPostProcessor.java:34)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
Have you done what it suggests and verified that spring-ldap is included with your app? That's clearly where the class in question lives. My guess is that you blindly removed all the jars named spring-* and added in all the 3.1 spring-* jar files, but spring-ldap isn't included with the base spring 3.1 distro. In fact, its versioning is completely separate, and it's presently at version 1.3.1.

Resources