[slf4j-user] Failed to load class "org.slf4j.impl.StaticLoggerBinder"

Thorsten oack-os at hotmail.com
Sun Dec 18 17:01:27 CET 2011


Hi,
in 2 classes I implement code like this:

===================
@Stateless
public class UserHandler {
	
	Logger logger = LoggerFactory.getLogger(UserController.class);

	@PersistenceContext(unitName = "open")
	private EntityManager em;

	public Userclient createUser(Userclient user) {
		em.persist(user);
		// Logging
		logger.info("User successfully created and persisted.");
		System.out.println("User successfully created and persisted.");
		return user;
	}
====================

but the error ist the same...


Am 18.12.2011 um 16:12 schrieb TJ Rothwell:

> you must add a logging implementation.
> 
> http://slf4j.org/manual.html#binding 
> 
> On Sun, Dec 18, 2011 at 4:07 AM, Thorsten <oack-os at hotmail.com> wrote:
> Hi guys,
> Got a little problem with the logging. My project is compiled with the help from maven. In my case i don't understand what ist going wrong! Maven is reporting that it can't load the specified class. I tried several variants in the pom.xml, but nothing help to get rid of the error. In this case I'm not shure how important the logging is for the whole project.
> 
> The error I got is:
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> 
> Can anybody help?
> 
> Greetings 
> Thorsten
> 
> The pom.xml and the Maven dependency tree is included with this E-Mail:
> 
> ====== pom.xml =======
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> 	http://maven.apache.org/xsd/maven-4.0.0.xsd">
> 
> 
> 	<modelVersion>4.0.0</modelVersion>
> 	<artifactId>demo-framework</artifactId>
> 	<name>demo-framework</name>
> 	<packaging>war</packaging>
> 	<url>http://maven.apache.org</url>
> 
> 
> 	<repositories>
> 		<repository>
> 			<id>jboss-public-repository-group</id>
> 			<name>Jboss Repository for Maven</name>
> 			<url>https://repository.jboss.org/nexus/content/groups/public/</url>
> 		</repository>
> 		<repository>
> 			<id>java-net</id>
> 			<name>Java.net Maven Repository</name>
> 			<url>http://download.java.net/maven/2</url>
> 		</repository>
> 	</repositories>
> 
> 
> 	<dependencyManagement>
> 		<dependencies>
> 			<dependency>
> 				<groupId>org.richfaces</groupId>
> 				<artifactId>richfaces-bom</artifactId>
> 				<version>${org.richfaces.bom.version}</version>
> 				<scope>import</scope>
> 				<type>pom</type>
> 			</dependency>
> 		</dependencies>
> 	</dependencyManagement>
> 	<dependencies>
> 		<!-- Logging -->
> 		
> 		<!-- the other slf4j jars -->
> 		<dependency>
> 			<groupId>org.slf4j</groupId>
> 			<artifactId>slf4j-api</artifactId>
> 			<version>1.6.0</version>
> 		</dependency>
> 		<!-- Glassfish -->
> 		<dependency>
> 			<groupId>org.glassfish</groupId>
> 			<artifactId>javax.ejb</artifactId>
> 			<version>3.1</version>
> 			<scope>provided</scope>
> 		</dependency>
> 		<!-- Database -->
> 		<dependency>
> 			<groupId>org.eclipse.persistence</groupId>
> 			<artifactId>javax.persistence</artifactId>
> 			<version>2.0.0</version>
> 		</dependency>
> 		<!-- Richfaces -->
> 		<dependency>
> 			<groupId>org.richfaces.ui</groupId>
> 			<artifactId>richfaces-components-ui</artifactId>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.richfaces.core</groupId>
> 			<artifactId>richfaces-core-impl</artifactId>
> 		</dependency>
> 		<!-- Java Server Faces -->
> 		<dependency>
> 			<groupId>com.sun.faces</groupId>
> 			<artifactId>jsf-api</artifactId>
> 		</dependency>
> 		<dependency>
> 			<groupId>com.sun.faces</groupId>
> 			<artifactId>jsf-impl</artifactId>
> 		</dependency>
> 		<dependency>
> 			<groupId>javax.servlet</groupId>
> 			<artifactId>servlet-api</artifactId>
> 			<scope>provided</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>javax.servlet.jsp</groupId>
> 			<artifactId>jsp-api</artifactId>
> 			<scope>provided</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>javax.el</groupId>
> 			<artifactId>el-api</artifactId>
> 			<scope>provided</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>javax.servlet</groupId>
> 			<artifactId>jstl</artifactId>
> 		</dependency>
> 		<!-- Transaction between Database and Message Que -->
> 		<dependency>
> 			<groupId>javax.transaction</groupId>
> 			<artifactId>jta</artifactId>
> 			<version>1.1</version>
> 			<scope>provided</scope>
> 		</dependency>
> 		<!-- Testing -->
> 		<dependency>
> 			<groupId>org.jboss.jsfunit</groupId>
> 			<artifactId>jboss-jsfunit-core</artifactId>
> 			<version>1.3.0.Final</version>
> 			<scope>test</scope>
> 		</dependency>
> 		<dependency>
> 			<groupId>org.jboss.jsfunit</groupId>
> 			<artifactId>jboss-jsfunit-analysis</artifactId>
> 			<version>1.3.0.Final</version>
> 			<scope>test</scope>
> 		</dependency>
> 	</dependencies>
> 	<!-- inherit from parent -->
> 	<parent>
> 		<groupId>org.open</groupId>
> 		<version>0.0.1-SNAPSHOT</version>
> 		<relativePath>../demo</relativePath>
> 		<artifactId>demo</artifactId>
> 	</parent>
> 
> 
> 	<properties>
> 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> 		<org.richfaces.bom.version>4.0.0.Final</org.richfaces.bom.version>
> 	</properties>
> 	<build>
> 		<finalName>demo-framework</finalName>
> 		<plugins>
> 			<plugin>
> 				<groupId>org.mortbay.jetty</groupId>
> 				<artifactId>maven-jetty-plugin</artifactId>
> 				<version>5.1.4</version>
> 				<configuration>
> 					<scanIntervalSeconds>10</scanIntervalSeconds>
> 					<!-- Configure the webapp -->
> 					<contextPath>/biggerstrongerbetterfaster</contextPath>
> 					<tmpDir>target/not/necessary</tmpDir>
> 					<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
> 					<overrideWebXml>src/main/resources/override-web.xml</overrideWebXml>
> 					<!-- configure the container -->
> 					<jettyConfig>/my/special/jetty.xml</jettyConfig>
> 					<connectors>
> 						<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
> 							<port>9090</port>
> 							<maxIdleTime>60000</maxIdleTime>
> 						</connector>
> 					</connectors>
> 					<userRealms>
> 						<userRealm implementation="org.mortbay.jetty.security.HashUserRealm">
> 							<name>Test Realm</name>
> 							<config>etc/realm.properties</config>
> 						</userRealm>
> 					</userRealms>
> 					<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
> 						<filename>target/yyyy_mm_dd.request.log</filename>
> 						<retainDays>90</retainDays>
> 						<append>true</append>
> 						<extended>false</extended>
> 						<logTimeZone>GMT</logTimeZone>
> 					</requestLog>
> 				</configuration>
> 			</plugin>
> 			<plugin>
> 				<groupId>org.apache.cactus</groupId>
> 				<artifactId>cactus.integration.maven2</artifactId>
> 				<version>1.8.1</version>
> 				<configuration>
> 					<srcFile>${project.build.directory}/${project.artifactId}.war</srcFile>
> 					<destFile>${project.build.directory}/${project.artifactId}-cactified.war</destFile>
> 					<testClasses>
> 						<directory>target/test-classes</directory>
> 						<includes>
> 							<include>**/**Test*.class</include>
> 						</includes>
> 					</testClasses>
> 					<libDependencies>
> 						<dependency>
> 							<groupId>commons-beanutils</groupId>
> 							<artifactId>commons-beanutils</artifactId>
> 						</dependency>
> 					</libDependencies>
> 				</configuration>
> 				<executions>
> 					<execution>
> 						<id>cactus-cactifywar</id>
> 						<phase>pre-integration-test</phase>
> 						<goals>
> 							<goal>cactifywar</goal>
> 						</goals>
> 					</execution>
> 				</executions>
> 			</plugin>
> 			<plugin>
> 				<groupId>org.codehaus.cargo</groupId>
> 				<artifactId>cargo-maven2-plugin</artifactId>
> 				<version>1.0-beta-2</version>
> 				<executions>
> 					<execution>
> 						<id>start-container</id>
> 						<phase>pre-integration-test</phase>
> 						<goals>
> 							<goal>start</goal>
> 						</goals>
> 					</execution>
> 					<execution>
> 						<id>stop-container</id>
> 						<phase>post-integration-test</phase>
> 						<goals>
> 							<goal>stop</goal>
> 						</goals>
> 					</execution>
> 				</executions>
> 				<configuration>
> 					<wait>false</wait>
> 					<timeout>20000</timeout>
> 					<container>
> 						<containerId>tomcat5x</containerId>
> 						<zipUrlInstaller>
> 							<url>http://apache.speedbone.de/tomcat/
> 								tomcat-5/v5.5.25/bin/apache-tomcat-5.5.27.zip</url>
> 							<installDir>${basedir}/install</installDir>
> 						</zipUrlInstaller>
> 					</container>
> 					<configuration>
> 						<deployables>
> 							<deployable>
> 								<location>cactifiedByMaven2.war</location>
> 								<pingURL>http://localhost:8080/test/</pingURL>
> 								<properties>
> 									<context>/test</context>
> 								</properties>
> 							</deployable>
> 						</deployables>
> 					</configuration>
> 				</configuration>
> 			</plugin>
> 			<plugin>
> 				<groupId>org.apache.maven.plugins</groupId>
> 				<artifactId>maven-surefire-plugin</artifactId>
> 				<configuration>
> 					<skip>true</skip>
> 				</configuration>
> 				<executions>
> 					<execution>
> 						<id>surefire-it</id>
> 						<phase>integration-test</phase>
> 						<goals>
> 							<goal>test</goal>
> 						</goals>
> 						<configuration>
> 							<skip>false</skip>
> 							<systemProperties>
> 								<property>
> 									<name>cactus.contextURL</name>
> 									<value>http://localhost:8080/test/</value>
> 								</property>
> 							</systemProperties>
> 						</configuration>
> 					</execution>
> 				</executions>
> 			</plugin>
> 			<plugin>
> 				<groupId>org.glassfish</groupId>
> 				<artifactId>maven-embedded-glassfish-plugin</artifactId>
> 				<version>3.1</version>
> 				<configuration>
> 					<goalPrefix>embedded-glassfish</goalPrefix>
> 					<app>demo-framework.war</app>
> 					<port>8080</port>
> 					<contextRoot>demo-framework</contextRoot>
> 					<autoDelete>true</autoDelete>
> 				</configuration>
> 			</plugin>
> 		</plugins>
> 	</build>
> </project>
> 
> 
> ======= mvn -f pom.xml dependency:tree =============
> [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ demo-framework ---
> [INFO] org.open:demo-framework:war:0.0.1-SNAPSHOT
> [INFO] +- org.slf4j:slf4j-api:jar:1.6.0:compile
> [INFO] +- org.glassfish:javax.ejb:jar:3.1:provided
> [INFO] |  +- org.glassfish:javax.transaction:jar:3.1:provided
> [INFO] |  \- org.glassfish:javax.annotation:jar:3.1:provided
> [INFO] +- org.eclipse.persistence:javax.persistence:jar:2.0.0:compile
> [INFO] +- org.richfaces.ui:richfaces-components-ui:jar:4.0.0.Final:compile
> [INFO] |  +- org.richfaces.ui:richfaces-components-api:jar:4.0.0.Final:compile
> [INFO] |  \- org.richfaces.core:richfaces-core-api:jar:4.0.0.Final:compile
> [INFO] +- org.richfaces.core:richfaces-core-impl:jar:4.0.0.Final:compile
> [INFO] |  +- net.sourceforge.cssparser:cssparser:jar:0.9.5:compile
> [INFO] |  |  \- org.w3c.css:sac:jar:1.3:compile
> [INFO] |  \- com.google.guava:guava:jar:r08:compile
> [INFO] +- com.sun.faces:jsf-api:jar:2.0.4-b09:compile
> [INFO] +- com.sun.faces:jsf-impl:jar:2.0.4-b09:compile
> [INFO] +- javax.servlet:servlet-api:jar:2.5:provided
> [INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
> [INFO] +- javax.el:el-api:jar:1.0:provided
> [INFO] +- javax.servlet:jstl:jar:1.2:compile
> [INFO] +- javax.transaction:jta:jar:1.1:provided
> [INFO] +- org.jboss.jsfunit:jboss-jsfunit-core:jar:1.3.0.Final:test
> [INFO] |  +- net.sourceforge.htmlunit:htmlunit:jar:2.8:test
> [INFO] |  |  +- commons-codec:commons-codec:jar:1.4:test
> [INFO] |  |  +- xerces:xercesImpl:jar:2.9.1:test
> [INFO] |  |  |  \- xml-apis:xml-apis:jar:1.3.04:test
> [INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:test
> [INFO] |  +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.8:test
> [INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.0.1:test
> [INFO] |  |  \- org.apache.httpcomponents:httpcore:jar:4.0.1:test
> [INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.0.1:test
> [INFO] |  +- org.apache.james:apache-mime4j:jar:0.6:test
> [INFO] |  +- commons-lang:commons-lang:jar:2.4:test
> [INFO] |  +- commons-collections:commons-collections:jar:3.2.1:test
> [INFO] |  +- commons-io:commons-io:jar:1.4:test
> [INFO] |  +- net.sourceforge.nekohtml:nekohtml:jar:1.9.14:test
> [INFO] |  +- xalan:xalan:jar:2.7.1:test
> [INFO] |  |  \- xalan:serializer:jar:2.7.1:test
> [INFO] |  \- cactus:cactus:jar:13-1.7.1:test
> [INFO] |     +- cactus:cactus-ant:jar:13-1.7.1:test
> [INFO] |     +- commons-httpclient:commons-httpclient:jar:2.0.2:test
> [INFO] |     +- aspectj:aspectjrt:jar:1.2.1:test
> [INFO] |     \- cargo:cargo:jar:0.5:test
> [INFO] |        \- ant:ant:jar:1.5.4:test
> [INFO] +- org.jboss.jsfunit:jboss-jsfunit-analysis:jar:1.3.0.Final:test
> [INFO] |  \- de.odysseus.juel:juel:jar:2.1.0:test
> [INFO] \- junit:junit:jar:4.8.1:test
> 
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user
> 
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20111218/a3121427/attachment-0001.html>


More information about the slf4j-user mailing list