6 Replies Latest reply on Apr 15, 2011 11:28 AM by Randall Hauch

    Cannot compile ModeShape Examples Getting Started

    Hendy Irawan Newbie

      I got this error:

       

      ceefour@annafi:~/code/modeshape-examples$ mvn compile
      [INFO] Scanning for projects...
      Downloading: http://repo1.maven.org/maven2/org/modeshape/modeshape-parent/2.5.0.Beta1/modeshape-parent-2.5.0.Beta1.pom
      [ERROR] The build could not read 1 project -> [Help 1]
      [ERROR]   
      [ERROR]   The project org.modeshape.examples:getting_started:2.5.0.Beta1 (/home/ceefour/code/modeshape-examples/pom.xml) has 1 error
      [ERROR]     Non-resolvable parent POM: Could not find artifact org.modeshape:modeshape-parent:pom:2.5.0.Beta1 in central (http://repo1.maven.org/maven2) and 'parent.relativePath' points at wrong local POM @ line 3, column 11 -> [Help 2]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
      [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
      

       

      I can understand what it means. But since it's Maven, shouldn't it download the required artifacts by itself ?

        • 1. Re: Cannot compile ModeShape Examples Getting Started
          Hendy Irawan Newbie

          I added this to examples/pom.xml :

           

          <repositories>
          <repository>
          <id>jboss</id>
          <url>http://repository.jboss.org/nexus/content/groups/public/</url>
          </repository>
          </repositories>
          

           

          and now it's compiling.

          • 2. Re: Cannot compile ModeShape Examples Getting Started
            Hendy Irawan Newbie

            The build is successful, but I cannot run it:

             

             

            ceefour@annafi:~/code/modeshape-examples/sequencers/target/modeshape-example-sequencers-basic$ ./run.sh 
            SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
            SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
            Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
                    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230)
                    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
                    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112)
                    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275)
                    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248)
                    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261)
                    at org.modeshape.common.util.Logger.getLogger(Logger.java:82)
                    at org.modeshape.graph.ExecutionContext.getLogger(ExecutionContext.java:205)
                    at org.modeshape.graph.connector.base.Connection.execute(Connection.java:101)
                    at org.modeshape.graph.Graph.execute(Graph.java:286)
                    at org.modeshape.graph.Graph$5.process(Graph.java:229)
                    at org.modeshape.graph.request.RequestBuilder.verifyWorkspace(RequestBuilder.java:72)
                    at org.modeshape.graph.Graph.useWorkspace(Graph.java:380)
                    at org.modeshape.graph.Graph.getCurrentWorkspace(Graph.java:355)
                    at org.modeshape.graph.Graph.getCurrentWorkspaceName(Graph.java:340)
                    at org.modeshape.graph.Graph$Batch.<init>(Graph.java:3073)
                    at org.modeshape.graph.Graph.batch(Graph.java:3039)
                    at org.modeshape.repository.ModeShapeConfiguration.changes(ModeShapeConfiguration.java:537)
                    at org.modeshape.repository.ModeShapeConfiguration.repositorySourceDefinition(ModeShapeConfiguration.java:1177)
                    at org.modeshape.jcr.JcrConfiguration.repositorySource(JcrConfiguration.java:458)
                    at org.modeshape.example.sequencer.SequencingClient.main(SequencingClient.java:74)
            Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
                    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
                    at java.security.AccessController.doPrivileged(Native Method)
                    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                    at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
                    ... 21 more
            
            
            • 3. Re: Cannot compile ModeShape Examples Getting Started
              Randall Hauch Master

              You have to add a dependency on the particular logging system and SLF4J binding JAR. See this page for details.

              • 4. Re: Cannot compile ModeShape Examples Getting Started
                Hendy Irawan Newbie

                I think so.

                 

                However the Getting Started Guide doesn't mention that:

                 

                1. I should add any repository
                2. I should add any dependencies

                 

                Since Getting Started seems to assume the reader can be unaware of Maven, it's unfair to expect them to do the above.

                 

                I'd like to modify the example and pull request, but it seems not in modeshape github ?

                • 5. Re: Cannot compile ModeShape Examples Getting Started
                  Hendy Irawan Newbie

                  Actually the example already depended on slf4j-log4j12 and log4j, however they are scope=test and thus need to be changed to:

                   

                   

                      <!-- 
                      Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for testing) 
                      -->
                      <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                      </dependency>
                      <dependency>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-log4j12</artifactId>
                        <scope>runtime</scope>
                      </dependency>
                      <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <scope>runtime</scope>
                      </dependency>
                  
                  

                   

                  Where can I commit the fixes to the examples ?

                  • 6. Re: Cannot compile ModeShape Examples Getting Started
                    Randall Hauch Master

                    You did the right thing by logging issues (MODE-1149, MODE-1150, and MODE-1151) and submitting pull-requests. I'm going through them now.