8 Replies Latest reply on Nov 10, 2011 1:36 PM by Jonathan Fuerth

    Problem running under jboss on Linux

    Alan Midona Newbie

      Hi Guys,

       

      I have a very simple application based on the cdi example.   When I run this under jboss(-as-web-7.0.2.Final) on a Windows 7 machine, it works fine.  However, when I try to run the same .war file under the same jboss version on a Linux box (2.6.18-194.e15) I get the following error:

       

      ======

      Internal Server Error

      {

          "outcome" => "failed",

          "failure-description" => {"Failed services" => {"jboss.deployment.unit.\"owr-application-0.0.1-SNAPSHOT.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"owr-application-0.0.1-SNAPSHOT.war\".WeldService: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:

      Exception 0 :

      java.lang.RuntimeException: could not initialize ErraiService instance

          at org.jboss.errai.cdi.server.Util.lookupErraiService(Util.java:142)

          at org.jboss.errai.cdi.server.CDIExtensionPoints.afterBeanDiscovery(CDIExtensionPoints.java:264)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

          at java.lang.reflect.Method.invoke(Unknown Source)

          at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)

          at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)

          at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)

          at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)

          at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)

          at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)

          at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)

          at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)

          at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:88)

          at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:52)

          at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:43)

          at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:380)

          at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)

          at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

          at java.lang.Thread.run(Unknown Source)

      Caused by: com.google.inject.ProvisionException: Guice provision errors:

       

      1) Error injecting constructor, java.lang.ArrayIndexOutOfBoundsException: -1

        at org.jboss.errai.bus.server.service.ErraiServiceConfiguratorImpl.(ErraiServiceConfiguratorImpl.java:49)

        while locating org.jboss.errai.bus.server.service.ErraiServiceConfiguratorImpl

        while locating org.jboss.errai.bus.server.service.ErraiServiceConfigurator

          for parameter 1 at org.jboss.errai.bus.server.service.ErraiServiceImpl.(ErraiServiceImpl.java:51)

        at org.jboss.errai.bus.server.service.ErraiServiceImpl.class(ErraiServiceImpl.java:51)

        while locating org.jboss.errai.bus.server.service.ErraiServiceImpl

        while locating org.jboss.errai.bus.server.service.ErraiService

       

      1 error

          at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:987)

          at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013)

          at org.jboss.errai.container.ServiceFactory.create(ServiceFactory.java:35)

          at org.jboss.errai.cdi.server.Util.lookupErraiService(Util.java:136)

          ... 26 more

      Caused by: java.lang.ArrayIndexOutOfBoundsException: -1

          at java.util.ArrayList.remove(Unknown Source)

          at org.jboss.errai.bus.server.service.metadata.JBossVFSDIr$1$1.next(JBossVFSDIr.java:61)

          at org.jboss.errai.bus.server.service.metadata.JBossVFSDIr$1$1.next(JBossVFSDIr.java:65)

          at org.jboss.errai.bus.server.service.metadata.JBossVFSDIr$1$1.next(JBossVFSDIr.java:52)

          at org.reflections.Reflections.scan(Reflections.java:199)

          at org.reflections.Reflections.(Reflections.java:91)

          at org.jboss.errai.bus.server.service.metadata.MetaDataScanner.(MetaDataScanner.java:64)

          at org.jboss.errai.bus.server.service.metadata.MetaDataScanner.createInstance(MetaDataScanner.java:90)

          at org.jboss.errai.bus.server.service.metadata.MetaDataScanner.createInstance(MetaDataScanner.java:82)

          at org.jboss.errai.bus.server.service.ErraiServiceConfiguratorImpl.(ErraiServiceConfiguratorImpl.java:54)

          at org.jboss.errai.bus.server.service.ErraiServiceConfiguratorImpl$$FastClassByGuice$$b6139751.newInstance()

          at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40)

          at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60)

          at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)

          at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

          at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)

          at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)

          at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)

          at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)

          at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)

          at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)

          at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)

          at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)

          at com.google.inject.Scopes$1$1.get(Scopes.java:65)

          at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)

          at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)

          at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)

          at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)

          at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)

          ... 29 more

      "}},

          "rolled-back" => true

      }

      ======

       

      Any ideas guys? Is there another library or something that I need to include?

       

      Thanks,

       

      Alan.

        • 1. Re: Problem running under jboss on Linux
          Jonathan Fuerth Master

          Hi Alan,

           

          Sorry to hear you're having trouble deploying to JBoss on Linux! We'll be glad to help you get to the bottom of this.

           

          I've just tried the errai-cdi-quickstart on a linux system. It deployed and ran properly on JBoss AS 7.

           

          Here are the steps I took:

           

          $ mvn archetype:generate -DarchetypeGroupId=org.jboss.errai.archetypes -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=2.0-SNAPSHOT -DarchetypeRepository=https://repository.jboss.org/nexus/content/groups/public

          [ in response to the prompts, I called my project test-errai-on-linux ]

          $ cd test-errai-on-linux/

          $ mvn clean install -Pjboss7

          $ cd ..

          $ tar zxf ~/Downloads/jboss-as-web-7.0.2.Final.tar.gz

          $ cd jboss-as-web-7.0.2.Final

          $ cp ../test-errai-on-linux/target/test-errai-on-linux.war standalone/deployments/

          $ bin/standalone.sh

           

          And then I told Firefox to go to http://localhost:8080/test-errai-on-linux/ and the app was there (the button worked too)

           

          Clearly the two of us are getting different results here. We're very interested to track down and fix this issue. Can you try the above steps on your Linux system, as a baseline test?

           

          Cheers,

           

          Jonathan

          • 2. Re: Problem running under jboss on Linux
            Alan Midona Newbie

            Hi Jonathan,

             

            I'm having trouble with the maven build (I am a novice maven user, but I'm having to learn quickly ).  I Get the following:

             

            [ERROR] Failed to execute goal on project errai-test-on-linux: Could not resolve dependencies for project com.test:errai

            -test-on-linux:war:1.0-SNAPSHOT: The following artifacts could not be resolved: org.jboss.errai:errai-cdi-client:jar:2.0

            .pre0, org.jboss.errai:errai-javax-enterprise:jar:2.0.pre0, org.jboss.errai:errai-weld-integration:jar:2.0.pre0, org.jbo

            ss.errai:errai-cdi-jetty:jar:2.0.pre0: Failure to find org.jboss.errai:errai-cdi-client:jar:2.0.pre0 in http://192.168.2

            54.201:8081/nexus/content/repositories/thirdparty was cached in the local repository, resolution will not be reattempted

            until the update interval of thirdparty has elapsed or updates are forced -> [Help 1]

             

            Also, the way that I'm deploying is different.  I browse to the JBoss Admin page and add the war file that way.  Should this make any difference?

             

            Thanks for your help,

             

            Alan

            • 3. Re: Problem running under jboss on Linux
              Jonathan Fuerth Master

              Hi Alan,

               

              The trouble you've experienced with the Maven build is not your fault at all. It's just a terrible co-incidence: over the weekend, we apparently lost the 2.0.pre0 versions of a select few Errai modules. errai-cdi-client was among them.

               

              We're working on getting these back into the public repository, and also trying to discover where they went (I expect it will turn out to be some sort of a restore-from-old-backup problem, but that's purely a guess). The 2.0.pre0 artifacts should reappear within the next 3-4 hours. I will respond again when they are back.

               

              Thanks for your pateince as we work through this entirely related roadbump! :-/

               

              -Jonathan

               

              PS: in response to your question about deploying through the AS7 web console, that should be completely equivalent to copying the .war into the standalone/deployments directory.

              • 4. Re: Problem running under jboss on Linux
                Jonathan Fuerth Master

                Hi again, Alan.

                 

                It turns out the "missing" artifacts weren't missing at all. This was PEBKAC on my part. What happened was that I accidentally ran through the create, compile, deploy, test cycle for the errai-bus quickstart 2.0-SNAPSHOT. Then I realized my mistake and created an errai-cdi 2.0-SNAPSHOT quickstart which I then completely failed to compile.

                 

                So, with my apologies, can you please try this instead? I definitely ran through all the steps on the correct project this time.

                 

                $ mvn archetype:generate -DarchetypeGroupId=org.jboss.errai.archetypes -DarchetypeArtifactId=cdi-quickstart -DarchetypeVersion=1.3.0-SNAPSHOT -DarchetypeRepository=https://repository.jboss.org/nexus/content/groups/public

                [...]

                Define value for property 'groupId': : org.xyz.test

                Define value for property 'artifactId': : test-errai-cdi-13

                Define value for property 'version':  1.0-SNAPSHOT: :

                Define value for property 'package':  org.xyz.test: :

                Confirm properties configuration:

                [...]

                $ cd test-errai-cdi-13/

                $ vi pom.xml

                [ in vi, change the text inside the <errai.version> element to 1.3.0.GA then save and exit]

                $ mvn clean package -Pjboss7

                $ cp target/test-errai-cdi-13.war ~/jboss-as-web-7.0.2.Final/standalone/deployments/

                 

                Then browse to http://localhost:8080/test-errai-cdi-13/

                 

                Once again, thank you for your patience.

                 

                Cheers,

                Jonathan

                 

                PS: in the coming days, we will publish new cdi-quickstart 1.3.0* archetypes that depend on the correct versions of errai-cdi. This will eliminate the need to edit the pom.xml during the quickstart.

                • 5. Re: Problem running under jboss on Linux
                  Alan Midona Newbie

                  Hi Jonathan,

                   

                  The project built fine this time.  I did exactly as you asked and copied the .war file into /deployments folder.  However, JBoss didn't pick it up automatically.  So I tried loading it though the Admin page.  The error I got was exactly the same as above.

                   

                  Well at least it's consistent...and if yours is working fine, then it's suggesting that there is something wrong with my Linux/JBoss environment.

                   

                  BTW I'm using a remote VM. The command that I used to start Jboss was:

                   

                  bin/standalone.sh -p=OWRATE -pmanagement=OWRATE

                   

                  I also had to change the native interface management port to 9991 as 9999 was being used by something else.

                   

                  Cheers,

                   

                  Alan.

                  • 6. Re: Problem running under jboss on Linux
                    Jonathan Fuerth Master

                    Hi again Alan,

                     

                    Sorry for the delay. I looked into this yesterday, and I believe I found a bug in the way Errai scans the project metadata at runtime. Basically, if there are any empty directories, there is a small chance (based on the order of directory traversal) that this error will be encountered. Chances are, the order the files were scanned was differet when run on Windows than it was when run on Linux.

                     

                    We will certainly work to fix this bug soon. In the mean time, the only workaround I can suggest would be to try and locate any empty directories in your .war file and make them non-empty. This is still not guaranteed to work, because Errai actually recurses into the .jar files under WEB-INF/lib as well. So if any of THOSE had empty directories in them, you could still run into this problem. But I expect there's a pretty good chance that the empty directory is no in one of those .jars.

                     

                    You could try the following commands on linux to quickly locate empty directories:

                     

                    $ mkdir ~/errai-tmp

                    $ cd ~/errai-tmp

                    $ jar xf /path/to/your-errai-app.war

                    $ find . -type d -empty

                    [any output here indicates there are empty dirs in your .war]

                     

                    The following command will put an empty file called ".notempty" in every empty directory listed by the previous command:

                     

                    $ find . -type d -empty -exec touch {}/.notempty ';;'

                     

                    Then you could recreate the .war:

                     

                    $ jar cf /path/to/your-errai-app.war .

                     

                    Again, this is just a temporary workaround until we release a fixed version of Errai. There's no good reason for empty directories to present a problem.

                     

                    Cheers,

                     

                    Jonathan

                    • 7. Re: Problem running under jboss on Linux
                      Alan Midona Newbie

                      Hi Jonathan,

                       

                      Thanks for getting back to me.  I've had a quick check throught he .war file, and yes there are empty directories.  In fact, there appear to be lots of them.  I'm not sure why...as there are no empty directories in the corrisponding eclipse project!

                       

                      Unfortunately, I've been moved onto another project for a few weeks, so I'm not able to try your suggestion at the moment.  I will have a go when I get some free time.   If not, I will be returning to this project after the current one has been put to bed...hopefully by the end of the month.

                       

                      Thanks again for your help!

                       

                      Cheers,

                       

                      Alan.

                      • 8. Re: Problem running under jboss on Linux
                        Jonathan Fuerth Master

                        Hi Alan,

                         

                        I've fixed this bug in Errai 1.3.1 and published an update to the snapshot build. If you update your pom.xml to set errai.version to 1.3.1-SNAPSHOT and rebuild, you should be all set.

                         

                        Thanks again for your patience.

                         

                        -Jonathan