Announcement Announcement Module
Collapse
No announcement yet.
createWebApplicationContext Error? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • createWebApplicationContext Error?

    It's a very strange exception for me.

    I can init the Context in my test unit,but it has some error when I start my application server.

    The key conf is:
    Code:
        <!-- an interceptor for transaction -->
    	<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
        	<property name="transactionManager"><ref bean="transactionManager"/></property>
            <property name="transactionAttributes">
                <props>
                    <prop key="save*">PROPAGATION_REQUIRED</prop>
                    <prop key="remove*">PROPAGATION_REQUIRED</prop>
                    <prop key="assign*">PROPAGATION_REQUIRED</prop>
                    <prop key="unassign*">PROPAGATION_REQUIRED</prop>
                    <prop key="move*">PROPAGATION_REQUIRED</prop>
                    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
                </props>
            </property>
    	</bean>    
    
    	<bean id="manager" class="org.springframework.aop.framework.ProxyFactoryBean">
            <property name="target">
                <bean class="besti.core.service.impl.BaseManager">
                    <property name="DAO"><ref bean="dao"/></property>
                </bean>
            </property>	
          	<property name="interceptorNames">
             	<list>
             		<!-- Add Transaction Here -->
                	<idref local="transactionInterceptor"/>
                	<!-- Add Security Check Here -->
             	</list>
          	</property>
    	</bean>
    My test unit code is:
    Code:
    		ClassPathXmlApplicationContext appContext = 
    			new ClassPathXmlApplicationContext&#40;
    		        new String&#91;&#93; &#123;
    						"applicationContext-hibernate.xml", 
    						"applicationContext-service.xml"
    						&#125;&#41;;
    		BeanFactory factory = &#40;BeanFactory&#41; appContext;
    		Manager manager = &#40;Manager&#41;factory.getBean&#40;"manager"&#41;;
    And my web.xml is:

    Code:
        <!-- context param -->
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/classes/applicationContext-hibernate.xml
    			/WEB-INF/classes/applicationContext-service.xml
    		</param-value>
    	</context-param>
    
    	<servlet>
    		<servlet-name>context</servlet-name>
    		<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
    When the app server start,it has some exception in console:

    Code:
    19&#58;03&#58;48,171 ERROR &#91;ContextLoader&#93; Context initialization failed
    org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'manager' defined in ServletContext resource &#91;/WEB-INF/classes/applicationContext-service.xml&#93;&#58; Initialization of bean failed; nested exception is org.aopalliance.aop.AspectException&#58; null
    java.lang.IllegalStateException&#58; Callback Lnet/sf/cglib/proxy/MethodInterceptor; is not assignable to Lnet/sf/cglib/proxy/MethodInterceptor;
    	at net.sf.cglib.proxy.Enhancer.validate&#40;Enhancer.java&#58;374&#41;
    	at net.sf.cglib.proxy.Enhancer.createHelper&#40;Enhancer.java&#58;399&#41;
    	at net.sf.cglib.proxy.Enhancer.create&#40;Enhancer.java&#58;318&#41;
    	at org.springframework.aop.framework.Cglib2AopProxy.getProxy&#40;Cglib2AopProxy.java&#58;194&#41;
    	at org.springframework.aop.framework.Cglib2AopProxy.getProxy&#40;Cglib2AopProxy.java&#58;150&#41;
    	at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance&#40;ProxyFactoryBean.java&#58;256&#41;
    	at org.springframework.aop.framework.ProxyFactoryBean.setBeanFactory&#40;ProxyFactoryBean.java&#58;220&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;349&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;223&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;147&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;271&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;312&#41;
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh&#40;AbstractRefreshableWebApplicationContext.java&#58;134&#41;
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext&#40;ContextLoader.java&#58;230&#41;
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext&#40;ContextLoader.java&#58;156&#41;
    	at org.springframework.web.context.ContextLoaderServlet.init&#40;ContextLoaderServlet.java&#58;81&#41;
    All of these muss me!

    Thanks for your help

  • #2
    My application server is JBoss4,and use Default conf. In other words,I deploy my war in /default/ directory.

    Spring's AOP is conflict with JBoss's AOP ?

    Comment


    • #3
      Yes,Maybe I'm right !

      I create one server configuration "besti" (just copy /default directory),and delete the "jboss-aop.deployer" and "jboss-hibernate.deployer",now everything is run normally...

      Hum!Maybe it's a bug of spring?

      Comment

      Working...
      X