Web Service application throws java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger
Issue
- A web service client is deployed in JBoss EAP 6. It is based out of Apache CXF 2.7.4.
- JBoss will start without error messages. When calling the web service via the client, the following below exception is encountered:
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
at examaple.com.logging.Slf4jLogger.internalLogFormatted(Slf4jLogger.java:139)
at example.com.logging.AbstractDelegatingLogger.internalLog(AbstractDelegatingLogger.java:355)
at example.com.logging.AbstractDelegatingLogger.doLog(AbstractDelegatingLogger.java:337)
at example.com.logging.AbstractDelegatingLogger.info(AbstractDelegatingLogger.java:237)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:445)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:540)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:252)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:205)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:156)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:156)
- The content of the manifest.mf shows the below content
Import-Package: org.slf4j.impl;version=1.5.8
- I tried to change to slf4j version 1.7.5 which is coming with cxf. But it gets to another error while starting up JBoss:
java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:107)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:295)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:152)
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:108)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
- Seems as if hibernate is using slf4j in a former version, 1.5.8, but cxf wants version 1.7.5.
Environment
- JBoss Enterprise Application Platform (EAP)
- 5.1.1
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
