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

Chris Pratt thechrispratt at gmail.com
Sun Dec 18 19:11:23 CET 2011


In your pom file you are only including the slf4j-api.jar file. You need to
add one of the implementation files like slf4j-log4j12.jar and any
supporting jars like log4j-1.2.16.jar as well.
  (*Chris *)
On Dec 18, 2011 8:02 AM, "Thorsten" <oack-os at hotmail.com> wrote:

> 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>
>>
>
> _______________________________________________
> 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/ad6b915c/attachment-0001.html>


More information about the slf4j-user mailing list