2 Replies Latest reply on Jul 23, 2011 11:41 AM by jaikiran pai

    AS6 to AS7 migration problem

    0x29a Newbie

      Pretty much a standard .ear deployment into standalone directory. The ear has a jar with a few EJBs. The 2 test wars are using Spring 3.0.5 & Hibernate.

       

      Layout:

       

      -xxx.ear

           --lib

           --test1.war

                --lib

                     --required spring jars

           --test2.war

                --lib

                --required spring jars

           --META-INF

                --application.xml

                --jboss-deployment-structure.xml

                --MANIFEST.MF

           --ejb.jar

       

      If I only run 1 war (either one doesn't matter) everything works great (by commenting out the module in application.xml). If I try to run both wars then I run into this problem (Something relating to the spring context). I have tried both isolation true and false, moved .jars all around and no matter what I do or try, I can't get both .wars to run together. In AS 6 both fire up just fine.

       

      Problem seems to be related to these entried in web-servlet.xml

           <context:component-scan base-package="com.xxx.web"/>

           <context:annotation-config />

           <mvc:annotation-driven />

       

      Any help would be great! Thx!

       

      org.springframework.beans.FatalBeanException: Class [org.springframework.context.config.ContextNamespaceHandler] for namespace [http://www.springframework.org/schema/context] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface

      org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:126)

      org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1330)

      org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)

      org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)

      org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)

      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)

      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)

      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)

      org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)

      org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

      org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

      org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

      org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)

      org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)

      org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)

      org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)

      org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)

      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)

      org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)

      org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)

      org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)

      org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)

      javax.servlet.GenericServlet.init(GenericServlet.java:242)

      org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)

      org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)

      org.apache.jsp.index_jsp._jspService(index_jsp.java:57)

      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)

      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      com.xxx.web.filter.DisableUrlSessionIdFilter.doFilter(DisableUrlSessionIdFilter.java:61)

       

       

      Application.xml

      ?xml version="1.0"?>
      <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">

      <application>
      <display-name></display-name>
      <module>
        <java>ejb.jar</java>
      </module> 
      <module>
        <web>
         <web-uri>test1.war</web-uri>
         <context-root>/test1</context-root>
        </web>
      </module>
      <module>
        <web>
         <web-uri>test2.war</web-uri>
         <context-root>/test2</context-root>
        </web>
      </module>
      <security-role>
        <role-name>users</role-name>
      </security-role>
      </application>

       

      jboss-deployment-structure.xml

      <jboss-deployment-structure>

        <!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->

        <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

        <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->

        <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->

        <deployment>

          <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->

          <exclusions>       

          </exclusions>

          <resources>

          </resources>   

      </deployment>

      </jboss-deployment-structure>

       

      Ear Manifest

      Manifest-Version: 1.0

      Archiver-Version:

      Created-By:

      Built-By:

      Build-Jdk:

      Dependencies: org.apache.commons.logging, org.slf4j, javax.servlet.api, org.hibernate

      Class-Path:

       

      web-servlet.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:p="http://www.springframework.org/schema/p"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:jee="http://www.springframework.org/schema/jee"
          xmlns:mvc="http://www.springframework.org/schema/mvc"
          xmlns:util="http://www.springframework.org/schema/util"   
          xsi:schemaLocation="
              http://www.springframework.org/schema/beans
              http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
              http://www.springframework.org/schema/context
              http://www.springframework.org/schema/context/spring-context-3.0.xsd
              http://www.springframework.org/schema/jee
              http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
             http://www.springframework.org/schema/mvc
             http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
             http://www.springframework.org/schema/util
             http://www.springframework.org/schema/util/spring-util-3.1.xsd">

       

        <context:component-scan base-package="com.xxx.web"/>
        <context:annotation-config />
        <mvc:annotation-driven />

      <bean id="productManager" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
        <property name="jndiName" value="java:app/foundation/ProductManagerBean!com.xxx.persistence.jpa.manager.ProductManager"/>
        <property name="businessInterface" value="com.xxx.persistence.jpa.manager.ProductManager"/>
        <property name="resourceRef" value="false"/>
      </bean> 
      <bean id="productService" class="com.xxx.shopping.prototype.ProductServiceImpl">
        <property name="productManager">
         <ref bean="productManager"/>
        </property> 
      </bean>  
       
      <bean id="sweepstakeManager" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
        <property name="jndiName" value="java:app/foundation/SweepstakeManagerBean!com.xxx.persistence.jpa.manager.SweepstakeManager"/>
        <property name="businessInterface" value="com.xxx.persistence.jpa.manager.SweepstakeManager"/>
        <property name="resourceRef" value="false"/>
      </bean>
      <bean id="sweepstakeService" class="com.xxx.shopping.prototype.SweepstakeServiceImpl" init-method="init">
        <property name="sweepstakeManager">
         <ref bean="sweepstakeManager"/>
        </property> 
      </bean>

      <bean id="integrationManager" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean"> 
        <property name="jndiName" value="java:app/foundation/IntegrationManagerBean!com.xxx.persistence.jpa.manager.IntegrationManager"/>
        <property name="businessInterface" value="com.xxx.persistence.jpa.manager.IntegrationManager"/>
        <property name="resourceRef" value="false"/>
      </bean>
      <bean id="integrationService" class="com.xxx.shopping.prototype.IntegrationServiceImpl">
        <property name="integrationManager">
         <ref bean="integrationManager"/>
        </property> 
      </bean> 

       

       

      <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
         <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/> 
      </bean>

      <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
         <list>
          <value>/WEB-INF/defs/custsvc.xml</value>  
          <value>/WEB-INF/defs/home.xml</value>  
          <value>/WEB-INF/defs/template.xml</value> 
         </list>
        </property>
      </bean>

      </beans>  

       

      Spring EJB injection done thru @EJB.

       

       

       

      Thanks for you time,

      cwb