1 2 Previous Next 15 Replies Latest reply on May 21, 2011 10:25 PM by asermej

    Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish

    asermej
      This is something I have spent the last couple of days stuck on and I finally traced the problem back to seam faces.  I had been building and deploying my app using the new seam-faces module for a couple of weeks without problem while working in netbeans 7.0.  However, when I went to deploy the built some-app.war file to glassfish instead of deploying through netbeans I got the exception:

      WARNING: Failed to locate BeanManager using any of these providers:
      org.jboss.seam.solder.beanManager.BeanManagerUnavailableException: Failed to locate BeanManager using any of these providers:
           at org.jboss.seam.solder.beanManager.BeanManagerLocator.getBeanManager(BeanManagerLocator.java:91)
           at org.jboss.seam.faces.event.SeamPreNavigationHandler.handleNavigation(SeamPreNavigationHandler.java:37)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
      ...

      I ended up creating the smallest possible web app I could with the following pom.xml dependancies:

          <dependencies>
              <dependency>
                  <groupId>org.jboss.seam.solder</groupId>
                  <artifactId>seam-solder</artifactId>
                  <version>3.0.0.Final</version>
              </dependency>
              <dependency>
                  <groupId>org.jboss.seam.faces</groupId>
                  <artifactId>seam-faces</artifactId>
                  <version>3.0.0.Final</version>
              </dependency>
             
              <dependency>
                  <groupId>joda-time</groupId>
                  <artifactId>joda-time</artifactId>
                  <version>${jodatime.version}</version>
                  <type>jar</type>
              </dependency>
          </dependencies>

      This project doesn't have or even use seam-faces at all.  It just includes it.
      So I am not sure if this is a simple maven setup issue or if there is a real problem with how I am using seam-faces with glassfish.
        • 1. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
          lightguard

          Which version of Glassfish ace you running, also which version of weld?

          • 2. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
            asermej

            Hi Jason,


            I am running glassfish 3.1 that comes with the netbeans 7.0 download and I upgrading weld to Weld OSGi Bundle 1.1.1.Final according to the Seam Compatabilty reference page.

            • 3. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
              lightguard

              Okay, one other idea. You said the app is named some-app.war correct? Try naming it to something that comes before seam in an alphabetic sort. There's a bug in glassfish that may possibly be biting you in that regard. If that still doesn't work we'll have to dig a bit deeper.

              • 4. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                asermej
                It is definitely name related, however I'm not sure if it's an issue with alphabetical order.  I created two new web applications: blah-app and blahapp and tried deploying each.  The blah-app.war file did not deploy, but the blahapp.war did.  The fact that it is name related makes sense with the errors I was seeing, because when you deploy through netbeans it was deploying the app as: com.mycompany_blah-app_war_1.0-SNAPSHOT which IS working.  When I tried to deploy the same build as blah-app.war it was NOT working.
                • 5. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                  lightguard

                  Very interesting. Could you try a nightly of Glassfish 3.1.1 (or a promoted build if there are any)? Also, if you don't mind, try JBoss AS6 or AS7 and let us know the results.

                  • 6. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                    asermej
                    More testing is showing me that it is not simply a naming issue.  When I ran this on jboss AS 6 here is the error I get:

                    22:37:19,674 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfs:///Users/asermelj/Applications/jboss-6.0.0.Final/server/default/deploy/blah.war_WeldBootstrapBean state=Create: java.lang.RuntimeException: Error instantiating class org.jboss.seam.faces.context.FacesAnnotationsAdapterExtension
                            at org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:282) [:6.0.0.Final]
                            at org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:238) [:6.0.0.Final]
                            at org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:194) [:6.0.0.Final]
                            at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:157) [:6.0.0.Final]
                            at org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:346) [:6.0.0.Final]
                    ...
                    Caused by: java.lang.NoClassDefFoundError: javax/faces/bean/RequestScoped
                            at org.jboss.seam.faces.context.FacesAnnotationsAdapterExtension.<init>(FacesAnnotationsAdapterExtension.java:39)
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [:1.6.0_24]
                            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) [:1.6.0_24]
                            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [:1.6.0_24]
                            at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [:1.6.0_24]
                            at org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:273) [:6.0.0.Final]
                            ... 70 more
                    Caused by: java.lang.ClassNotFoundException: javax.faces.bean.RequestScoped from BaseClassLoader@3d989dea{vfs:///Users/asermelj/Applications/jboss-6.0.0.Final/server/default/deploy/blah.war}
                            at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:480) [jboss-classloader.jar:2.2.0.GA]
                            at java.lang.ClassLoader.loadClass(ClassLoader.java:248) [:1.6.0_24]
                            ... 76 more
                    DEPLOYMENTS MISSING DEPENDENCIES:
                      Deployment "jboss-switchboard:appName=blah,module=blah" is missing the following dependencies:
                        Dependency "java:global/cdi/blah/blah/BeanManager" (should be in state "Installed", but is actually in state "** NOT FOUND Depends on 'java:global/cdi/blah/blah/BeanManager' **")
                      Deployment "jboss.web.deployment:war=/blah" is missing the following dependencies:
                        Dependency "vfs:///Users/asermelj/Applications/jboss-6.0.0.Final/server/default/deploy/blah.war_WeldBootstrapBean" (should be in state "Create", but is actually in state "**ERROR**")

                    DEPLOYMENTS IN ERROR:
                      Deployment "java:global/cdi/blah/blah/BeanManager" is in error due to the following reason(s): ** NOT FOUND Depends on 'java:global/cdi/blah/blah/BeanManager' **
                      Deployment "vfs:///Users/asermelj/Applications/jboss-6.0.0.Final/server/default/deploy/blah.war_WeldBootstrapBean" is in error due to the following reason(s): java.lang.ClassNotFoundException: javax.faces.bean.RequestScoped from BaseClassLoader@3d989dea{vfs:///Users/asermelj/Applications/jboss-6.0.0.Final/server/default/deploy/blah.war}, **ERROR**
                    ...

                    a bunch more

                    It seems to me the java:global/cdi/blah/blah/BeanManager is probably the issue.  Note the duplicate blah/blah.

                    I also tried running this is glassfish 3.1.1 and received the same error.
                    • 7. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                      lightguard

                      If you don't have any web.xml or an empty faces-config.xml the JSF libraries probably won't be added by the server.

                      • 8. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                        asermej

                        I have both of those files and am still getting the issue.  What's driving me crazy is that the app deploys correctly when I run it from within Netbeans.  I will attempt to find some simple seam faces examples and trim them back.

                        • 9. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                          lightguard

                          Much appreciated, thank you.

                          • 10. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                            asermej

                            I cloned the faces repo and built the faces-short.ly example and tried to deploy it.  I had a couple of issues that I had to resolve, including adding hibernate using the update tool and adding the joda-time dependency to the pom.xml.  Once I did these two things and tried to deploy the app, I got the same error.  I have tried this on a mac, ubuntu and windows.  For this latest test I ran the example on glassfish 3.1 and jboss 6.0.  Note: the glassfish instance has the updated version of weld.


                            Also, I tried building my simple app with just mvn clean install to take netbeans out of the picture and got the same problem.


                            I little more info is that I was able to create a version of my blah.war file that couldn't be deployed to glassfish, but COULD be deployed to jboss.  Glassfish was giving the same BeanManager error and jboss was happy.  Unfortunately, the build that deploys to one and not the other had nothing done differently to it.


                            I have seen this behavior where one time a war might deploy and then not the next, but I can't put my finger on why.  That's why I thought earlier on that I had it fixed with the new name stuff.

                            • 11. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                              asermej

                              It seems the same sort of thing is still happening in JBoss AS 7:


                              http://seamframework.org/Community/SeamFacesIntegrationAtTomcat7

                              • 12. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                                lightguard

                                That's Tomcat 7, please try with JBoss AS7, if there's a bug there we have to address it immediately, the others we'll look into and get it figured out. It's really odd that this is happening. Sorry we don't have a solution just yet.

                                • 13. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                                  asermej
                                  Hi Jason,

                                  I deployed the app using the standalone deployment in as 7 directory and got the following output.

                                  I don't think this has anything to do with our issue.

                                  19:50:25,439 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) Starting deployment of "faces-short.ly.war"
                                  19:50:25,603 WARN  [org.jboss.as.server.deployment.module] (MSC service thread 1-6) META-INF directory /C:/Users/Gerard/Desktop/jboss-7.0.0.Beta3/bin/content/faces-short.ly.war/WEB-INF/classes/META-INF ignored as it is not a valid location for META-INF
                                  19:50:25,933 INFO  [org.jboss.jpa] (MSC service thread 1-5) read persistence.xml
                                  for example
                                  19:50:25,960 INFO  [org.jboss.weld] (MSC service thread 1-8) Processing CDI deployment: faces-short.ly.war
                                  19:50:26,128 INFO  [org.jboss.weld] (MSC service thread 1-3) Starting Services for CDI deployment: faces-short.ly.war
                                  19:50:26,139 INFO  [org.jboss.weld] (MSC service thread 1-5) Starting weld service
                                  19:50:26,181 INFO  [org.jboss.seam.solder.Version] (MSC service thread 1-5) Seam Solder null (build id: null)
                                  19:50:26,378 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-5) Preventing class org.jboss.seam.solder.core.VersionLoggerUtil from being installed as bean due to @Veto annotation
                                  19:50:26,535 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-5) Preventing class org.jboss.seam.solder.resourceLoader.ResourceProvider from being installed as bean due to Veto annotation
                                  19:50:26,646 INFO  [org.jboss.seam.international.status.TypedStatusMessageBundleExtension] (MSC service thread 1-5) Add @MessageBundle to org.jboss.seam.solder.
                                  reflection.annotated.AnnotationBuilder.messages injection point for the type: or g.jboss.seam.solder.support.SolderMessages
                                  19:50:26,654 INFO  [org.jboss.seam.international.status.TypedStatusMessageBundleExtension] (MSC service thread 1-5) Add @MessageBundle to org.jboss.seam.solder.
                                  reflection.annotated.AnnotatedTypeBuilder.messages injection point for the type:
                                  org.jboss.seam.solder.support.SolderMessages
                                  19:50:26,771 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-5) Preventing class org.jboss.seam.international.locale.LocaleConfiguration from being installed as bean due to @Veto annotation
                                  19:50:27,047 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-5) Preventing class org.jboss.seam.faces.validation.InputElement from being installed as bean due to @Veto annotation
                                  19:50:27,080 INFO  [org.jboss.seam.solder.core.CoreExtension] (MSC service thread 1-5) Preventing class org.jboss.seam.faces.exception.CatchExceptionHandler from being installed as required class org.jboss.seam.exception.control.extension.CatchExtension could not be found
                                  19:50:27,251 INFO  [org.jboss.as.server] (MSC service thread 1-7) Service status
                                  report
                                     New missing/unsatisfied dependencies:
                                        service jboss.data-source.jdbc/__default (missing)

                                  19:50:27,267 INFO  [org.jboss.weld] (MSC service thread 1-2) Stopping weld service
                                  19:50:27,332 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Stopped deployment faces-short.ly.war in 78ms
                                  19:50:27,341 INFO  [org.jboss.as.server] (MSC service thread 1-6) Service status
                                  report
                                     Newly corrected services:
                                        service jboss.data-source.jdbc/__default (no longer required)
                                  • 14. Re: Seam Faces 3.0.1.Final BeanManagerUnavailableException on glassfish
                                    lightguard

                                    Ah, right, that's because in AS7 the default datasource is java:/H2DS. It looks like everything else is working correctly. This looks like it's a bug, possibly with Faces. Please create a JIRA and attach a sample project (or better, arquillian test).

                                    1 2 Previous Next