Announcement Announcement Module
Collapse
No announcement yet.
failed to intergate spring with hessian due to can not find SerializerFactory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • failed to intergate spring with hessian due to can not find SerializerFactory

    Hi, all

    Any one met below exception while intergating spring2.5.5 with hessian3.2.1:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name '/AccountService' defined in URL [bundleentry://3/WEB-INF/remoting-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationExcepti on: Could not instantiate bean class [org.springframework.remoting.caucho.HessianService Exporter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/caucho/hessian/io/SerializerFactory

    I can find the classes in hessian-3.1.5.jar or hessian-3.2.1.jar, and I already put them into a WEB-INF/lib, and set WEB-INF/lib/hessian-3.2.1.jar as bundle-classpath.

    I also try to unpack the hessian-3.2.1.jar and copy the whole com directory into WEB-INF/classes directory, spring runtime still can not find com.caucho.hessian.io.SerializerFactory. I am so frustrate, anyone can help me?

    I know the hessian-3.2.1.jar is not a plug-in, and my project is spring MVC with osgi enabled. How spring osgi call external non-plugin package?

    Thanks in advance.

    Regards,

    Edward He

  • #2
    my detail information

    1. web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>org.springframework.osgi.web.simple</display-name>

    <context-param>
    <param-name>contextClass</param-name>
    <param-value>
    org.springframework.osgi.web.context.support.OsgiB undleXmlWebApplicationContext
    </param-value>
    </context-param>
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListe ner
    </listener-class>
    </listener>

    <servlet>
    <servlet-name>remoting</servlet-name>
    <servlet-class>
    org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <init-param>
    <param-name>contextClass</param-name>
    <param-value>
    org.springframework.osgi.web.context.support.OsgiB undleXmlWebApplicationContext
    </param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>remoting</servlet-name>
    <url-pattern>/remoting/*</url-pattern>
    </servlet-mapping>



    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    </web-app>


    2. remoting-servlet.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
    <beans>

    <bean id="accountService" class="example.AccountServiceImpl">
    <!-- any additional properties, maybe a DAO? -->
    </bean>

    <bean name="/AccountService" class="org.springframework.remoting.caucho.Hessian ServiceExporter">
    <property name="service" ref="accountService"/>
    <property name="serviceInterface" value="example.AccountService"/>
    </bean>

    </beans>

    3. applicationContext.xml:

    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:osgi="http://www.springframework.org/schema/osgi"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd">

    <osgi:reference id="stringReverser">
    <osgi:interfaces>
    <value>org.springframework.osgi.sample.service.Str ingReverser</value>
    </osgi:interfaces>
    </osgi:reference>

    <bean id="stringReverserOSGiFacade" class="org.springframework.osgi.sample.app.StringR everserOSGiFacade">
    <constructor-arg ref="stringReverser"/>
    </bean>
    </beans>

    Comment


    • #3
      Please see attachments for detail confirgurations

      in case the attachment is too big, I delete the hessian-3.1.5.jar from WEB-INF/lib.

      Comment


      • #4
        Solved it by downloading a plug-in version

        Finally I solved it by myself via downloading a hessian from plug-in bundle http://www.springsource.com/reposito...&version=3.1.6 from rather than offical site.

        And absolutely, it is a bug of spring, spring-web.2.5.jar should includes all bundles required!

        I wonder why no one know how to solve it. The fact turns out it is not so difficult :-(


        BTW, must use 3.1.6 instead of 3.2.1, otherwise you will meet bellow exception:
        com.caucho.hessian.io.HessianProtocolException: expected string at 0x6d
        at com.caucho.hessian.io.Hessian2Input.error(Hessian2 Input.java:2714)
        at com.caucho.hessian.io.Hessian2Input.expect(Hessian 2Input.java:2695)

        Comment

        Working...
        X