Announcement Announcement Module
Collapse
No announcement yet.
Spring BlazeDS on Glassfish v3? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring BlazeDS on Glassfish v3?

    Hi Everybody,

    I have some problems using Spring BlazeDS on a Glassfish server. When I deploy my app to Glassfish, the following errormessage is thrown:

    Code:
    [#|2009-06-16T12:28:16.816+0200|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=17;_ThreadName=Thread-3;|WebModule[/web]StandardWrapper.Throwable
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBroker': Cannot resolve reference to bean '_messageBrokerLoginCommand' while setting bean property 'configProcessors' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_messageBrokerLoginCommand': Cannot resolve reference to bean '_authenticationManager' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '_authenticationManager' is defined
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
     at java.security.AccessController.doPrivileged(Native Method)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
     at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
     at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
     at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
     at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
     at javax.servlet.GenericServlet.init(GenericServlet.java:270)
     at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1198)
     at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
     at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4953)
     at org.apache.catalina.core.StandardContext.start(StandardContext.java:5350)
     at com.sun.enterprise.web.WebModule.start(WebModule.java:456)
     at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:922)
     at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:906)
     at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
     at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2205)
     at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1890)
     at com.sun.enterprise.web.WebApplication.start(WebApplication.java:85)
     at com.sun.enterprise.v3.server.ApplicationLifecycle.start(ApplicationLifecycle.java:560)
     at com.sun.enterprise.v3.server.ApplicationLifecycle.start(ApplicationLifecycle.java:547)
     at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:189)
     at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:329)
     at com.sun.enterprise.v3.admin.CommandRunner$2.execute(CommandRunner.java:297)
     at com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:312)
     at com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:119)
     at com.sun.enterprise.v3.admin.CommandRunner.doCommand(CommandRunner.java:99)
    
    ... (shortened)
    If I deploy exactly the same application into a Tomcat 6.0.18, everything works fine.

    I use this version of spring-flex

    Code:
    			<dependency>
    				<groupId>org.springframework.flex</groupId>
    				<artifactId>spring-flex</artifactId>
    				<version>1.0.0.RELEASE</version>
    			</dependency>
    and Java 1.6.

    I know BlazeDS does not support Glassfish officially, but when I deploy a Flex-BlazeDS application (no security) without the Spring integration, everything works fine.

    Normally I just use Spring and have no technical insight, so I need some help with this issue.

    Can somebody explain me what to do so the bean named "_authenticationManager" is found?
    How can I provide a valid authenticationManager?

    Every help is appreciated.

    Regards,
    Christoph

  • #2
    Correction!

    Tomcat shows the same error...

    Comment


    • #3
      Solved

      Hi all,

      I found the problem.

      In the testdrive all Spring Bean declarations are loaded by
      Code:
      	<context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>
      			/WEB-INF/spring/*-context.xml
      		</param-value>
      	</context-param>
      in web.xml.

      In my application some party, i.e. the dataSource is used by multiple components, so it is absolutely necessary to initialise the dataSource at first. With the following context-param I was able to control the initialisation.

      Code:
      	<context-param>
      		<param-name>contextConfigLocation</param-name>
      		<param-value>/WEB-INF/spring/security-context.xml,/WEB-INF/spring/database-context.xml,/WEB-INF/spring/template-context.xml,/WEB-INF/spring/translation-context.xml,/WEB-INF/spring/mart-context.xml,/WEB-INF/spring/services-context.xml</param-value>
      		<description>all Spring Bean configuration files ordered by initialisation time</description>
      	</context-param>
      Now the application can be deployed in Glassfish V3 without any error.

      Regards,
      Christoph

      Comment


      • #4
        BlazeDS on Glassfish V3

        Hi Chris,

        I couldn't get Spring-Flex 1.0.0.RELEASE working on Glassfish V3.

        I always get:

        java.lang.Exception: org.springframework.beans.factory.BeanDefinitionSt oreException: Unexpected exception parsing XML document from class path resource [META-INF/consumer-servlet.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.springframework.flex.config.xml.FlexNamespaceH andler] for namespace [http://www.springframework.org/schema/flex]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/beans/factory/xml/NamespaceHandlerSupport

        I'm thinking this error is due to OSGI? I don't see this happening in Tomcat.

        Comment


        • #5
          wrong diagnosis?

          Originally posted by christoph.guse View Post
          Hi all,

          I found the problem.

          In the testdrive all Spring Bean declarations are loaded by
          Code:
          	<context-param>
          		<param-name>contextConfigLocation</param-name>
          		<param-value>
          			/WEB-INF/spring/*-context.xml
          		</param-value>
          	</context-param>
          in web.xml.

          In my application some party, i.e. the dataSource is used by multiple components, so it is absolutely necessary to initialise the dataSource at first. With the following context-param I was able to control the initialisation.

          Code:
          	<context-param>
          		<param-name>contextConfigLocation</param-name>
          		<param-value>/WEB-INF/spring/security-context.xml,/WEB-INF/spring/database-context.xml,/WEB-INF/spring/template-context.xml,/WEB-INF/spring/translation-context.xml,/WEB-INF/spring/mart-context.xml,/WEB-INF/spring/services-context.xml</param-value>
          		<description>all Spring Bean configuration files ordered by initialisation time</description>
          	</context-param>
          Now the application can be deployed in Glassfish V3 without any error.

          Regards,
          Christoph
          Hi, and thanks for coming back with the answer, but I think you're wrong (even though you found a solution). Spring will take care of loading dependencies in the right order.

          What caught my attention is that you mention "(no security)". I had the same problem and fixed it like this:

          BEFORE:

          Code:
          	<flex:message-broker>
          		<flex:message-service
          			default-channels="my-amf" />
          		<flex:secured />
          	</flex:message-broker>
          AFTER:

          Code:
          	<flex:message-broker>
          		<flex:message-service
          			default-channels="my-amf" />
          	</flex:message-broker>
          I also didn't require security, and fixed it by removing the flex:secured declaration.

          Comment


          • #6
            Still not working for me

            Hello,
            I have had a look at the solutions posted here, and unfortunately, they do not work for me.

            I am deploying on Jboss 4.2.2 and am using Spring 3.0 RELEASE and Spring Security 3.0 RELEASE and Spring Flex 1.0 RELEASE.

            My Spring Security initial setup is shown below

            <security:http entry-point-ref="cmsAuthenticationProcessingFilterEntryPoint">
            <security:intercept-url pattern="/messagebroker/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
            <security:intercept-url pattern="/flex-client/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
            <security:intercept-url pattern="/**" access="ROLE_ADMIN,ROLE_MEDICAL,ROLE_NON_MEDICAL" />
            <security:custom-filter ref="cmsFormAuthenticationProcessingFilter" position="FORM_LOGIN_FILTER" />
            </security:http>

            Unfortunately I am still getting the same initial error even after taking the <flex:secured/> section out of my flex:messagebroker. Is there anything that could have been missed?

            Comment


            • #7
              Originally posted by kazama2002uk View Post
              I am deploying on Jboss 4.2.2 and am using Spring 3.0 RELEASE and Spring Security 3.0 RELEASE and Spring Flex 1.0 RELEASE.
              The 1.0.x line is currently incompatible with Spring Security 3.0 due to a lot of the core Spring Security classes getting moved around and generally refactored. This is a known issue (http://jira.springframework.org/browse/FLEX-65) that we are currently working on. In the meantime, Spring Security 2.x should continue to work without issue with Spring 3.0.

              Comment


              • #8
                Hi Jeremy,

                Is 1.0.2 compatible with Spring 3.0.1 + Spring Security 3.0.2? Cause I'm getting this error at startup:

                Cannot resolve reference to bean '_messageBrokerLoginCommand' while setting bean property 'configProcessors'

                Thank you.

                A.

                Comment


                • #9
                  Yes, 1.0.2 should definitely be compatible. Make sure you don't have any older dependencies (i.e., Spring 2.5.6 jars) on your classpath. Beyond that, I'd need to see your full stack trace to have a better idea of what's happening.

                  Comment

                  Working...
                  X