2 Replies Latest reply on Feb 20, 2010 12:21 AM by jaikiran pai

    EJB 3.0 tutorial build with Maven cannot start JBoss

    Csaba Toth Newbie

      Windows 7 64 bit

      Maven 2.2.1

      EJB3 tutorials

       

      I'm at the first example (stateless), and I want to build it. For previous issues see: http://community.jboss.org/thread/148367?tstart=0

       

      So JBoss seems to run fine if I start it from a command prompt with the run.bat file.

      But during the build Maven wants to start it also. If there's one already running, the build complains about it and stops. Otherwise it tries to start it:

      "C:\Users\ctoth\Documents\HIPLAB\Java\ejb3-tutorials\source\stateless>mvn install -e -PRunSingleTutorial

      + Error stacktraces are turned on.
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] Building EJB3.0 Stateless Bean Tutorial
      [INFO]    task-segment: [install]
      [INFO] ------------------------------------------------------------------------
      [INFO] [enforcer:enforce {execution: enforce-banned-dependencies}]
      [INFO] [resources:resources {execution: default-resources}]
      [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] Copying 2 resources
      [INFO] skip non existing resourceDirectory C:\Users\ctoth\Documents\HIPLAB\Java\ejb3-tutorials\source\stateless\META-INF
      [INFO] [compiler:compile {execution: default-compile}]
      [INFO] Nothing to compile - all classes are up to date
      [INFO] [resources:testResources {execution: default-testResources}]
      [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
      [INFO] skip non existing resourceDirectory C:\Users\ctoth\Documents\HIPLAB\Java\ejb3-tutorials\source\stateless\src\test\resources
      [INFO] [compiler:testCompile {execution: default-testCompile}]
      [INFO] No sources to compile
      [INFO] [surefire:test {execution: default-test}]
      [INFO] No tests to run.
      [INFO] [jar:jar {execution: default-jar}]
      [INFO] Building jar: C:\Users\ctoth\Documents\HIPLAB\Java\ejb3-tutorials\source\stateless\target\jboss-ejb3-tutorial-stateless.jar
      [INFO] Preparing source:jar
      [WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
      [INFO] [enforcer:enforce {execution: enforce-banned-dependencies}]
      [INFO] [source:jar {execution: attach-sources}]
      [INFO] Building jar: C:\Users\ctoth\Documents\HIPLAB\Java\ejb3-tutorials\source\stateless\target\jboss-ejb3-tutorial-stateless-sources.jar
      [INFO] [enforcer:enforce {execution: enforce-property}]
      [INFO] [jboss-as-control:start {execution: start-jbossas}]
      Starting server "all", with command (start timeout is 120 seconds ):
      C:\Program Files\Java\jdk1.6.0_18\bin\java -cp C:\jboss\bin\run.jar;C:\Program Files\Java\jdk1.6.0_18\lib\tools.jar -Xms128m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dorg.jboss.resolver.warning=true -XX:MaxPermSize=256m -Dsun.rmi.dgc.server.gcInterval=3600000 -Xmx512m -Dxb.builder.useUnorderedSequence=true  org.jboss.Main -c all -b localhost -g DefaultPartition
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Could not start JBossAS

       

      Embedded error: Server failed to start; see logs. exit code: 1
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Could not start JBossAS
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
          at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
          at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
          at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
          at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Could not start JBossAS
          at org.jboss.maven.plugins.as.control.mojo.JbossAsControlStartMojo.execute(JbossAsControlStartMojo.java:101)
          at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
          at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
          ... 17 more
      Caused by: java.io.IOException: Server failed to start; see logs. exit code: 1
          at org.jboss.jbossas.servermanager.ServerController.waitForServer(ServerController.java:178)
          at org.jboss.jbossas.servermanager.ServerController.startServer(ServerController.java:113)
          at org.jboss.jbossas.servermanager.ServerManager.startServer(ServerManager.java:163)
          at org.jboss.maven.plugins.as.common.JbossAsRuntimeDelegate.startJbossAs(JbossAsRuntimeDelegate.java:72)
          at org.jboss.maven.plugins.as.control.mojo.JbossAsControlStartMojo.execute(JbossAsControlStartMojo.java:97)
          ... 19 more
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 14 seconds
      [INFO] Finished at: Fri Feb 19 16:52:06 CST 2010
      [INFO] Final Memory: 91M/427M
      [INFO] ------------------------------------------------------------------------
      "


      I couldn't find anything else with "JbossAsControlStartMojo" (exception throw place) but the Maven source code itself. Am I screwed?

      My question is that where is the log file? (My log states: "see logs. exit code: 1".

      Are these Maven logs? I couldn't find any. I could find some logs in JBoss, the ones in the all directory were empty, and the ones in the default directory showed those occasion when I started JBoss manually from the command prompt with run bat.

        • 1. Re: EJB 3.0 tutorial build with Maven cannot start JBoss
          Csaba Toth Newbie

          Note: I issued the command what I can see in the quoted output, namely (notice that I modified the command a little bit to overcome the spaces in the 'Program Files' directory):

           

          "C:\Program Files\Java\jdk1.6.0_18\bin\"java -cp "C:\jboss\bin\run.jar;C:\Program Files\Java\jdk1.6.0_18\lib\tools.jar" -Xms128m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dorg.jboss.resolver.warning=true -XX:MaxPermSize=256m -Dsun.rmi.dgc.server.gcInterval=3600000 -Xmx512m -Dxb.builder.useUnorderedSequence=true  org.jboss.Main -c all -b localhost -g DefaultPartition

           

          Can it happen that those spaces cause the problems? My JDK is in the Program Files folder and it appears in two places in this command.

           

          So if I start JBoss with my modified command it starts also.

          What can be the problem?

          • 2. Re: EJB 3.0 tutorial build with Maven cannot start JBoss
            jaikiran pai Master

            tothc wrote:

             

            Can it happen that those spaces cause the problems? My JDK is in the Program Files folder and it appears in two places in this command.

             

            Yes, installing Java or JBoss in a folder containing a space in its path can cause problems. It's always recommended to install Java and JBoss in folders which do not have space in their path name. You can just "move" your existing JDK installation to some other folder (ex: C:\Java\jdk1.6.0_18) and then set JAVA_HOME appropriately to point to this new location.

             

            Also, before running the tutorials, just make sure that you JBoss installation boots fine outside of the tutorials. So just start it once:

             

            JBOSS_HOME/bin/run.bat -c all
            

             

            You can see the logs on the console as well as JBOSS_HOME/server/[servername]/log/server.log (and boot.log).