4 Replies Latest reply on Nov 23, 2011 1:10 AM by Jason Porter

    Typed Loggers

    Marcio Barbosa Newbie

      I'm trying to build a simple project using solder's typped loggers, as explained in My Link


      My Interface:



      package poc.logging;

      import org.jboss.logging.Logger.Level;
      import org.jboss.seam.solder.logging.Log;
      import org.jboss.seam.solder.logging.MessageLogger;
      import org.jboss.seam.solder.messages.Message;

      @MessageLogger
      public interface PocLogger {

           @Log(level = Level.INFO)
           @Message("log message: %s")
           void logMessage(String message);

      }


      and the point of injection:



      public class Teste extends HttpServlet {
           
           @Inject private PocLogger log;


      but I get the following error from maven 3:


      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compil
      e (default-compile) on project poc.seam3: Compilation failure
      [ERROR] error: Cannot read poc.logging package files, cause : java.io.FileNotFoundExceptio
      n: poc.logging/PocLogger


      The same error occurs when I try to compile the seam-booking example (FileNotFound: BookingLog).


      Please help me, I'm stuck at this point.

        • 1. Re: Typed Loggers
          Jason Porter Master

          Do you have the source and target versions set to 1.6 and the annotation processor (solder-tools) in your pom?

          • 2. Re: Typed Loggers
            Marcio Barbosa Newbie

            Here is my pom.xml




            <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>
                 <groupId>poc</groupId>
                 <artifactId>poc.seam3</artifactId>
                 <packaging>war</packaging>
                 <version>0.0.1-SNAPSHOT</version>
            
                 <properties>
                      <seam.version>3.0.0.Final</seam.version>
                      <jpamodelgen.version>1.1.1.Final</jpamodelgen.version>
                 </properties>
            
                 <dependencies>
            
                      <!-- <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache-core</artifactId> 
                           <version>2.3.3</version> </dependency> -->
            
                      <!-- <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-ehcache</artifactId> 
                           <version>3.6.0.Final</version> </dependency> -->
            
                      <dependency>
                           <groupId>org.slf4j</groupId>
                           <artifactId>slf4j-log4j12</artifactId>
                           <version>1.6.1</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.hibernate</groupId>
                           <artifactId>hibernate-core</artifactId>
                           <version>3.6.8.Final</version>
                           <exclusions>
                                <exclusion>
                                     <groupId>dom4j</groupId>
                                     <artifactId>dom4j</artifactId>
                                </exclusion>
                           </exclusions>
                      </dependency>
            
                      <!-- Annotation processor for generating typed loggers -->
                      <dependency>
                           <groupId>org.jboss.seam.solder</groupId>
                           <artifactId>seam-solder-tooling</artifactId>
                           <scope>provided</scope>
                           <optional>true</optional>
                           <version>${seam.version}</version>
                      </dependency>
            
            <!-- 
                     <dependency>
                         <groupId>org.jboss.solder</groupId>
                         <artifactId>solder-tooling</artifactId>
                         <scope>provided</scope>
                         <optional>true</optional>
                         <version>3.1.0.Beta5</version>
                     </dependency>
             -->
             
                      <dependency>
                           <groupId>org.jboss.seam.solder</groupId>
                           <artifactId>seam-solder</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
                      <dependency>
                           <groupId>org.jboss.seam.faces</groupId>
                           <artifactId>seam-faces</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.jboss.seam.international</groupId>
                           <artifactId>seam-international</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.jboss.seam.servlet</groupId>
                           <artifactId>seam-servlet</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.jboss.seam.catch</groupId>
                           <artifactId>seam-catch</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.jboss.seam.config</groupId>
                           <artifactId>seam-config-xml</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.jboss.seam.security</groupId>
                           <artifactId>seam-security</artifactId>
                           <version>${seam.version}</version>
                      </dependency>
            
                      <dependency>
                           <groupId>javax.enterprise</groupId>
                           <artifactId>cdi-api</artifactId>
                           <scope>provided</scope>
                           <version>1.0-SP4</version>
                      </dependency>
            
                      <dependency>
                           <groupId>joda-time</groupId>
                           <artifactId>joda-time</artifactId>
                           <version>1.6</version>
                      </dependency>
            
                      <dependency>
                           <groupId>javax</groupId>
                           <artifactId>javaee-api</artifactId>
                           <version>6.0</version>
                           <scope>provided</scope>
                      </dependency>
            
                      <dependency>
                           <groupId>org.primefaces</groupId>
                           <artifactId>primefaces</artifactId>
                           <version>2.2.1</version>
                      </dependency>
            
                      <dependency>
                           <groupId>org.primefaces.themes</groupId>
                           <artifactId>cupertino</artifactId>
                           <version>1.0.2</version>
                      </dependency>
            
                 </dependencies>
            
                 <build>
                      <defaultGoal>package</defaultGoal>
                      <finalName>poc-seam3</finalName>
                      <plugins>
            
                           <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <configuration>
                                     <source>1.6</source>
                                     <target>1.6</target>
                                </configuration>
                           </plugin>
                      </plugins>
                 </build>
            
            </project>
            



            • 3. Re: Typed Loggers
              Marcio Barbosa Newbie

              Follow up: a team colleague just discovered that the compilation works using jdk 1.6. I was using jdk 1.7.

              • 4. Re: Typed Loggers
                Jason Porter Master

                Interesting. I'm not sure if this is a known problem or not. Seems like I remember something about annotation processors and JDK 1.7, but I don't recall all the details right now.