Results 1 to 3 of 3

Thread: Spring Hessian Remoting Error

Hybrid View

  1. #1

    Default Spring Hessian Remoting Error

    Hi,

    I am getting the following exception using Spring remoting with Hessian on Glassfish. Any pointers to why this might be happening? I am using hessian-3.2.1.jar as the dependency jar.

    PWC1406: Servlet.service() for servlet remoting threw exception
    java.io.IOException: expected 'c' in hessian input at 67
    at org.springframework.remoting.caucho.Hessian2Skelet onInvoker.invoke(Hessian2SkeletonInvoker.java:77)
    at org.springframework.remoting.caucho.HessianExporte r.invoke(HessianExporter.java:142)
    at org.springframework.remoting.caucho.HessianService Exporter.handleRequest(HessianServiceExporter.java :70)
    at org.springframework.web.servlet.mvc.HttpRequestHan dlerAdapter.handle(HttpRequestHandlerAdapter.java: 49)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:511)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:738)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:831)
    at org.apache.catalina.core.ApplicationFilterChain.se rvletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:290)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:271)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:202)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipel ine.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:206)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:1080)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:150)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:1080)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:272)
    at com.sun.enterprise.web.connector.grizzly.DefaultPr ocessorTask.invokeAdapter(DefaultProcessorTask.jav a:637)
    at com.sun.enterprise.web.connector.grizzly.DefaultPr ocessorTask.doProcess(DefaultProcessorTask.java:56 8)
    at com.sun.enterprise.web.connector.grizzly.DefaultPr ocessorTask.process(DefaultProcessorTask.java:813)
    at com.sun.enterprise.web.connector.grizzly.DefaultRe adTask.executeProcessorTask(DefaultReadTask.java:3 41)
    at com.sun.enterprise.web.connector.grizzly.DefaultRe adTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultRe adTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.portunif.PortUnificationPip eline$PUTask.doTask(PortUnificationPipeline.java:3 80)
    at com.sun.enterprise.web.connector.grizzly.TaskBase. run(TaskBase.java:265)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWo rkerThread.run(SSLWorkerThread.java:106)

    I've pasted the config used below:

    Thanks,
    Karthik.

    Config:

    remoting-servlet.xml
    --------------------

    <bean class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="urlMap">
    <map>
    <entry key="/hessianAPISecurity">
    <ref bean="hessianAPISecurity"/>
    </entry>
    </map>
    </property>
    </bean>

    <bean name="hessianAPISecurity" class="org.springframework.remoting.caucho.Hessian ServiceExporter">
    <property name="service" ref="APISecurityService"/>
    <property name="serviceInterface" value="org.springframework.security.userdetails.Us erDetailsService"/>
    </bean>

    spring-ws-servlet.xml
    ---------------------

    <bean id="wsSecurityInterceptor"
    class="org.springframework.ws.soap.security.xwss.X wsSecurityInterceptor">
    <property name="policyConfiguration" value="classpath:securityPolicy.xml"/>
    <property name="callbackHandlers">
    <list>
    <ref bean="springSecurityHandler"/>
    </list>
    </property>
    </bean>
    <bean id="springSecurityHandler"
    class="org.springframework.ws.soap.security.xwss.c allback.SpringPlainTextPasswordValidationCallbackH andler">
    <property name="authenticationManager" ref="authenticationManager"/>
    </bean>
    <bean id="authenticationManager" class="org.springframework.security.providers.Prov iderManager">
    <property name="providers">
    <bean class="org.springframework.security.providers.dao. DaoAuthenticationProvider">
    <property name="userDetailsService" ref="userDetailsService"/>
    </bean>
    </property>
    </bean>
    <bean id="userDetailsService" class="org.springframework.remoting.caucho.Hessian ProxyFactoryBean">
    <property name="serviceUrl" value="<server>/security/remoting/hessianAPISecurity"/>
    <property name="serviceInterface" value="org.springframework.security.userdetails.Us erDetailsService"/>
    <property name="proxyFactory" ref="proxyFactory"/>
    </bean>
    <bean id="proxyFactory" class="com.caucho.hessian.client.HessianProxyFacto ry">
    <property name="hessian2Request" value="true" />
    <property name="hessian2Reply" value="true" />
    <property name="debug" value="true" />
    </bean>

  2. #2
    Join Date
    Jul 2008
    Posts
    10

    Default

    I suspect your server is running hessian-3.2.0.jar while your client is running hessian-3.2.1.jar, which introduced incompatible changes to Hessian protocol version 2. Since Hessian protocol version 2 is still changing, I use Hessian protocol version 1 for my production code.

  3. #3

    Default

    Thanks for the input. I used hessian-3.0.20.jar. Though the remote service gets called, the implementation doesn't work and the authentication fails. (the same implementation works when injected as a normal service object). Is there someway I can examine the return object or obtain any info that might help me debug/understand whats going on?

    This is the following service implementation class:

    import org.springframework.security.GrantedAuthority;
    import org.springframework.security.GrantedAuthorityImpl;
    import org.springframework.security.userdetails.User;
    import org.springframework.security.userdetails.UserDetai ls;
    import org.springframework.security.userdetails.UserDetai lsService;

    public class AuthenticationImpl implements UserDetailsService {

    public UserDetails loadUserByUsername(String user) {
    System.out.println("UserDetails called as "+ user);
    GrantedAuthorityImpl gai = new GrantedAuthorityImpl("<ROLE>");
    GrantedAuthority[] ga = new GrantedAuthorityImpl[]{gai};
    return new User("user","pass",true, true, true, true, ga);
    }

    }

    Corresponding config entry:
    <bean id="APISecurityService" class="<package>.AuthenticationImpl"/>


    Thanks,
    Karthik.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •