Announcement Announcement Module
Collapse
No announcement yet.
Problems with Jetty & Messagebroker Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with Jetty & Messagebroker

    Hi,

    We are having problems with Jetty & BlazeDS Integration M2. Application works fine on Tomcat, but on Jetty (Maven plugin) it fails.

    Error is this:
    Error creating bean with name '_messageBrokerDefaultHandlerMapping': Initialization of bean
    failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '_messageBroker': Invocation of init method failed;
    java.lang.LinkageError: loader constraint violation: loader (instance of org/mortbay/jetty/webapp/WebAppClassLoader) previously initiated loading for a different type with name "javax/manage
    ment/MBeanServer"
    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns="http://java.sun.com/xml/ns/javaee"
    	xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    	 http://java.sun.com/xml/id=WebApp_ID "
    	version="2.5">
    
    	<!--======= INITIALIZATION PARAMETERS =======  -->
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    		classpath:businessApplicationContext.xml
    		classpath:dataAccessContext.xml
    		/WEB-INF/securityContext.xml
    		</param-value>
    	</context-param>
    	
    	<!--=======  LISTENERS =======-->
    
    	<listener>
    		<listener-class>
    			org.springframework.web.context.ContextLoaderListener
    		</listener-class>
    	</listener>
    
    	<listener>
    		<listener-class>flex.messaging.HttpFlexSession</listener-class>
    	</listener>
    
    	
    	<!--=======  SERVLETS =======-->
    
    
    	<!-- The front controller of this Spring Web application, responsible for handling all application requests -->
    	<servlet>
    		<servlet-name>Dispatcher</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>		
    	</servlet>
    
    	<!-- Map all /messagbroker requests to the DispatcherServlet for handling -->
    	<servlet-mapping>
    		<servlet-name>Dispatcher</servlet-name>
    		<url-pattern>/messagebroker/*</url-pattern>
    	</servlet-mapping>
    
    	<welcome-file-list>
    		<welcome-file>index.htm</welcome-file>
    	</welcome-file-list>
    	
    	<!--=======  FILTERS =======-->
    
    
    	
    	<filter>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    	</filter>
    
    	<filter-mapping>
    		<filter-name>springSecurityFilterChain</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    	
    	
    </web-app>
    Dispacher-servlet.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	   xmlns:flex="http://www.springframework.org/schema/flex"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
               http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.springframework.org/schema/flex 
               http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
    
    
        <!-- import context definition resources. Should we import? 
    	<import resource="classpath:businessApplicationContext.xml"/>
    	<import resource="classpath:dataAccessContext.xml"/> -->
    	
        <!-- 1) setup Spring managed message broker infrastructure  -->
        <flex:message-broker/>
    
      	<!-- 2) Expose the service beans for BlazeDS remoting -->
      	
    
      	<flex:remote-service ref="myServiceFromBusinessAppContext"/> -->
      	
      	
    </beans>
    So we are loading application context`s with contextConfigLocation and flex-related context with DispacherServlet. It works fine on tomcat, but fails on Jetty...any thoughts?

  • #2
    We have resolved this now. The problem is: "javax/management/MBeanServer" .

    We think that Jetty has some kind of bug with this MBeanServer component. We found also some similar issues from forums and newsgroups, so this is not related to Spring BlazeDS.

    Solution was: change to Maven Tomcat plugin instead of Jetty.

    Comment


    • #3
      Fix?

      I just had the exact same problem happen for me when switching our deployment from Tomcat to Jetty.

      I noticed that the MBeanServer class was coming in from the log4j dependency and removed it by excluding it from the log4j dependency in maven (if you are using maven).

      This got rid of the runtime exception for me.

      <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <exclusions>
      <exclusion>
      <groupId>com.sun.jmx</groupId>
      <artifactId>jmxri</artifactId>
      </exclusion>
      </exclusions>

      Comment


      • #4
        fin!

        OK, Mr. aparrish.

        I have no idea how you figured that out, but it was most appreciated!!!

        -jonnie

        Comment

        Working...
        X