Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.0.0 and JBoss 5 Proxy conversion Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.0.0 and JBoss 5 Proxy conversion

    I've recently been attempting an upgrade from JBoss 4.0.3 with Spring 2.5.3 to JBoss 5.1.0 and Spring 3.0.0. Since the change with the JBoss version, I've been having a problem with converting the EJB's $ProxyXXX implementing com.company.appserver.SiteManagementLocal,org.spri ngframework.aop.SpringProxy,org.springframework.ao p.framework.Advised] to required type [com.company.appserver.SiteManagementLocal] The configuration for spring hasn't changed during the upgrade. I've included the relevant sections below so that you can see what we have been successfully using.

    I haven't been able to find any documentation that says what changes are necessary in a JBoss upgrade that's relevant to Spring. Did I miss a document in my efforts to search the forum and other resources?

    At startup, the system is having trouble referencing the localSiteManagement bean. Below is a copy of the
    spring configuration.

    Code:
        <util:map id="viewBuilderMap">
            <entry key="device">
                <bean class="com.company.query.permissions.DeviceViewBuilder">
                    <property name="restrictionsBuilder">
                        <bean class="com.company.query.permissions.ViewRestrictionsBuilder"/>
                    </property>
                </bean>
            </entry>
            <entry key="site">
                <bean class="com.company.query.permissions.SiteViewBuilder">
                    <property name="siteManagementLocal" ref="localSiteManagement"/>
                </bean>
            </entry>
            <entry key="user">
                <bean class="com.company.query.permissions.UserViewBuilder">
                    <property name="restrictionsBuilder">
                        <bean class="com.company.query.permissions.ViewRestrictionsBuilder"/>
                    </property>
                </bean>
            </entry>
        </util:map>
    
        <bean id="localSiteManagement" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
            <property name="jndiName">
                <util:constant static-field="com.company.appserver.SiteManagementLocalHome.JNDI_NAME"/>
            </property>
            <property name="businessInterface" value="com.company.appserver.SiteManagementLocal"/>
            <property name="cacheHome" value="true"/>
            <property name="lookupHomeOnStartup" value="false"/>
        </bean>
    I've included the headers of the EJB below. The methods within the EJB
    don't seem relevant to the discussion, so I didn't include them.

    Code:
    /**
     * @ejb:bean name="SiteManagement" type="Stateless" view-type="both" jndi-name="SiteManagement" local-jndi-name="SiteManagementLocal" transaction-type="Bean"
     * @ejb:home extends="javax.ejb.EJBHome" local-extends="javax.ejb.EJBLocalHome"
     * @ejb:interface extends="javax.ejb.EJBObject" local-extends="javax.ejb.EJBLocalObject"
     * @jboss:container-configuration name="Standard Stateless SessionBean"
     */
    public class SiteManagementEJB implements SessionBean {
    
       // ...
    }
    The generated source for the EJB's local interface is included below.

    Code:
    /**
     * Local interface for SiteManagement.
     */
    public interface SiteManagementLocal
       extends javax.ejb.EJBLocalObject
    {
        // ...
    }


    Code:
    public interface SiteManagementLocalHome
       extends javax.ejb.EJBLocalHome
    {
       public static final String COMP_NAME="java:comp/env/ejb/SiteManagementLocal";
       public static final String JNDI_NAME="SiteManagementLocal";
    
       public com.company.appserver.SiteManagementLocal create()
          throws javax.ejb.CreateException;
    
    }
    The full stack trace and logs are included below, but I've had to truncate a few lines from it to fit the posting limit.

    Code:
    15:28:21,559 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:META-INF/config/EjbRefContext.xml], factory key [com.company.service.context]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.company.service.context' defined in URL [vfszip:/opt/NA/server/ext/jboss-5.1.0.GA/server/default/deploy/truecontrol-app-mysql.ear/truecontrol-ejb-mysql.jar/META-INF/config/EjbRefContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.company.util.NAClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewBuilderMap': Cannot create inner bean 'com.company.query.permissions.SiteViewBuilder#52b8e429' of type [com.company.query.permissions.SiteViewBuilder] while setting bean property 'sourceMap' with key [TypedStringValue: value [site], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.company.query.permissions.SiteViewBuilder#52b8e429' defined in class path resource [META-INF/config/spring-service-queries.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type '$Proxy667 implementing com.company.appserver.SiteManagementLocal,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised' to required type 'com.company.appserver.SiteManagementLocal' for property 'siteManagementLocal'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [$Proxy667 implementing com.company.appserver.SiteManagementLocal,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.company.appserver.SiteManagementLocal] for property 'siteManagementLocal': no matching editors or conversion strategy found
          at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:389)
          at org.springframework.web.context.ContextLoader.loadParentContext(ContextLoader.java:343)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
          [snip]
          at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
          at org.jboss.Main.boot(Main.java:221)
          at org.jboss.Main$1.run(Main.java:556)
          at java.lang.Thread.run(Unknown Source)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'com.company.service.context' [snip] nested exception is java.lang.IllegalStateException: Cannot convert value of type [$Proxy667 implementing com.company.appserver.SiteManagementLocal,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.company.appserver.SiteManagementLocal] for property 'siteManagementLocal': no matching editors or conversion strategy found
          at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:283)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:984)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:886)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
          at org.springframework.context.access.ContextSingletonBeanFactoryLocator.initializeDefinition(ContextSingletonBeanFactoryLocator.java:143)
          at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:384)
          ... 73 more
          [snip]
    Caused by: java.lang.IllegalStateException: Cannot convert value of type [$Proxy667 implementing com.company.appserver.SiteManagementLocal,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.company.appserver.SiteManagementLocal] for property 'siteManagementLocal': no matching editors or conversion strategy found
          at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:289)
          at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:154)
          at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:452)
          ... 116 more
    What needs to be changed to get the required type correct?

  • #2
    This turned out to be masking a ClassCastException due to the fact that the deployed ear file had a copy of the class in the EJB jar and war file. Removing the duplicate class is necessary to solve this issue.

    Comment

    Working...
    X