9 Replies Latest reply on Sep 9, 2011 1:13 PM by Rob Cernich

    AS7 confusing deployment error

    jmorr003 Newbie

      I encountered a deployment error while trying to deploy a modifed quickstart bean-service to the switchyard-as7-0.2 runtime. After some trial an error I was able to narrow it down to a missing module dependency in the manifest of the bean-service jar. The error does not help determine that it was a missing module dependency, at least not with my limited JBoss AS7 experience. Here are the details to reproduce it.


      I added a slf4j logger to the OrderServiceBean


      package org.switchyard.quickstarts.bean.service;

      import javax.inject.Inject;

      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      import org.switchyard.component.bean.Reference;
      import org.switchyard.component.bean.Service;

      public class OrderServiceBean implements OrderService {
          private static final Logger logger = LoggerFactory




      Deployed it and received the following error:


      20:44:00,790 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."switchyard-quickstart-bean-service-0.2.0.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-quickstart-bean-service-0.2.0.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:switchyard-quickstart:bean-service:0.1.0}OrderService'.

      at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:90)

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

      at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)

      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_23]

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_23]

      at java.lang.Thread.run(Thread.java:662) [:1.6.0_23]

      Caused by: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:switchyard-quickstart:bean-service:0.1.0}OrderService'.

      at org.switchyard.component.bean.deploy.BeanComponentActivator.init(BeanComponentActivator.java:73)

      at org.switchyard.deploy.internal.Deployment.deployServices(Deployment.java:321)

      at org.switchyard.deploy.internal.Deployment.doStart(Deployment.java:119)

      at org.switchyard.deploy.internal.AbstractDeployment.start(AbstractDeployment.java:168)

      at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:99)

      at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:83)

      ... 5 more


      Finally figured out that I could fix it by adding the following to the manifest


           Dependencies: org.slf4j services export


      Attached is the bean-service code with the added slf4j logger to the OrderServiceBean, and the server.log showing this error and subsequent deployment with the slf4j dependency added to the manifest.

        • 1. Re: AS7 confusing deployment error
          Keith Babo Master

          My guess is that bean discovery is failing in the CDI layer, which results in the bean class for OrderService not being discovered, eventually leading to the deployment failing because the OrderService cannot be found.  So the error that you see is accurate, but I agree it's confusing in that it doesn't point to a root cause.  It would be much nicer if we saw an earlier error that indicated a given class could not be loaded based on CNFE or whatever.


          I have created a JIRA to track this : SWITCHYARD-440.


          BTW, did you find that you had to add "services export" to the dependency declaration?  I was able to deploy the app successfully with just this:


               Dependencies: org.slf4j


          Thanks for the the feedback.




          • 2. Re: AS7 confusing deployment error
            Tom Fennelly Master

            I just looked into this.  The SwitchYardCDIServiceDiscovery class is never called to process the bean if it contains the ref to the SL4J class.  So seems like this is something going wrong inside Weld.


            I'll look some more, but otherwise, I'll raise a raise a JIRA with the Weld project.

            • 3. Re: AS7 confusing deployment error
              Tom Fennelly Master

              The org.jboss.weld.bootstrap.BeanDeployer attempts to transform the OrderServiceBean class (org.jboss.weld.resources.ClassTransformer).  This fails because the sl4j classes are not available.  It debug logs this (lines 100 and 101 of BeanDeployer - IGNORING_CLASS_DUE_TO_LOADING_ERROR), so it sould appear in the logs so long as debug logging is turned on for org.jboss.weld.  I had a guess at configuring that in the logging.properties file (I assume this is the one), but it didn't appear.  I'm sure I'm just not configuring the logging properly.  Know how to configure sl4j logging on AS7?

              • 4. Re: AS7 confusing deployment error
                Keith Babo Master

                Check out standalone/configuration/standalone.xml.  There's a logging subsystem definition which you can tweak to set the CONSOLE appender to DEBUG and add a category entry for weld.

                • 5. Re: AS7 confusing deployment error
                  jmorr003 Newbie

                  Keith, regarding your earlier question about needing 'services export' with the 'Dependencies' entry, I didn't test it without 'services export' (I had just cut and pasted the entry from another example in the JBoss AS 7 documentation).

                  • 6. Re: AS7 confusing deployment error
                    Tom Fennelly Master

                    Ah right... I forgot the logging stuff was in there... duh.  Anyway... turn on debug logging for org.jboss.weld and you see the following exception in the logs...


                    09:28:47,210 DEBUG [org.jboss.weld.Bootstrap] (MSC service thread 1-4) catching: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.switchyard.quickstarts.bean.service.OrderServiceBean
                              at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:189) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
                              at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:96) [weld-core-1.1.2.AS7.jar:2011-07-06 12:26]
                    Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/Logger;
                              at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_26]
                    Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger from [Module "deployment.switchyard-quickstart-bean-service-0.3.0-SNAPSHOT.jar:main" from Service Module Loader]
                              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
                              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)


                    • 7. Re: AS7 confusing deployment error
                      jmorr003 Newbie

                      That exception does point nicely to the cause of the load failure. Like myself, I could see others new to Weld/JBoss AS 7 (and the way it resolves dependencies) would find an exception like this helpful at a higher log level. Should I suggest this as a change with the Weld project, or has that already been done?

                      • 8. Re: AS7 confusing deployment error
                        Tom Fennelly Master

                        Yeah.... you could make a case for it being an INFO log, but thn there's probably 1,000,000 other such issues that, if all logged as INFO, would make the logging unreadable.  Maybe start a weld forumm thread and ask them, before creating the JIRA.

                        • 9. Re: AS7 confusing deployment error
                          Rob Cernich Master

                          I agree with Tom regarding changing the log level.


                          I think a more interesting question is what is the best process for incorporating external dependencies into a SwitchYard application.  In this case, the dependency is registered through the manifest and  is provided by a module in AS7.


                          It may be beneficial to put together an article of "best practices" for incorporating external dependencies into a SwitchYard application.