Hello,

I can confirm that I have the same problem of exception deserialization.
I tried multiple way of defining my exception objects, and I haven't
found a solution so far. I traced the problem directly in the hessian
library, when the deserializer tries to recreate the Java stack strace.

A temporary solution, as you already guessed, is to force the protocol
1.0 to avoid these problem. Is it already known from Hessian developpers
or should we fill a bug report ?

Regards,
Reynald
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: mercredi, 2. juillet 2008 13:47
To: [email protected]
Subject: [Hessian-interest] Hessian 3.1.6 protocol 2.0 does not work
whenremote exceptions are thrown

Hello,

We have been using hessian 3.0.20 and protocol 1.0 for some time now
with 
no big issues. However I am trying to move to hessian 3.1.6 and protocol

2.0 and I can not get it to work.

Normal calls work fine and a lot faster, but when an exception happens
in 
the remote side, I get deserialization errors as shown below. 

I tried to directly serialise and deserialise an Exception object and it

worked fine, therefore the problem is not in the serialization code but 
the data which is transmitted back to the client when an exception
arises 
which I think it would be a fault map.


web.xml declares the remoting servlet like this:

        <servlet>
                <servlet-name>remoting</servlet-name>
 
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servle
t-class>
                <load-on-startup>1</load-on-startup>
        </servlet>
 
        <servlet-mapping>
                <servlet-name>remoting</servlet-name>
                <url-pattern>/remoting/*</url-pattern>
        </servlet-mapping>



and remoting-servlet.xml contains:

        <!-- Mapping servlet URL to different remoting handlers -->
        <bean 
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
                <property name="urlMap">
                        <map>
                                <entry key="/hessianProxyService">
                                        <ref
bean="hessianProxyService"/>
                                </entry>
                                <!-- Other mappings here -->
                        </map>
                </property>
        </bean>
 
        <!-- Exposing service with Hessian -->
        <bean id="hessianProxyService" 
 class="org.springframework.remoting.caucho.HessianServiceExporter">
                <property name="service" ref="proxyService"/>
                <property name="serviceInterface" 
 value="uk.nominet.proxyservice.InternalProxyServiceIF"/>
        </bean>
 
 
        In the client side, Hessian proxy bean is configured as follows.
        <beans>
 
                <bean id="proxyClient" 
                class="uk.nominet.proxyservice.client.TestProxyClient">
                        <property name="proxyService" 
ref="hessianProxyService"/>
                </bean>
 
                <bean id="hessianProxyService" 
 class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
                        <!-- This URL binds to the service, it must be 
changed as an ant substitution -->
                        <property name="serviceUrl" value="
http://localhost:8080/proxyservice/remoting/hessianProxyService"/> 
                        <property name="serviceInterface" 
value="uk.nominet.proxyservice.InternalProxyServiceIF"/>
                        <property name="proxyFactory"
ref="proxyFactory"/>
                </bean>
 
                <bean id="proxyFactory" 
class="com.caucho.hessian.client.HessianProxyFactory">
                        <property name="hessian2Request" value="true" />
                        <property name="hessian2Reply" value="true" />
                        <property name="debug" value="false" />
                </bean>
 
        </beans>

For testing purposes I just define one method in InternalProxyServiceIF 
which is forced to throw an exception:

        public String testHessian2(String str) throws Exception{
                System.out.println("You passed: " + str);
                throw new Exception("Testing");
                //              return str;
        }
 

Calls work for normal cases, when the exception is not thrown and the 
string is returned, but when an exception is thrown I always get the 
following problem:


org.springframework.remoting.RemoteAccessException: Cannot access
Hessian 
remote service at [http://
localhost:8080/proxyservice/remoting/hessianProxyService]; nested 
exception is com.caucho.hessian.io
.HessianFieldException: java.lang.StackTraceElement.lineNumber: expected

integer at end of file
at 
org.springframework.remoting.caucho.HessianClientInterceptor.convertHess
ianAccessException(Hessi
anClientInterceptor.java:254)
at 
org.springframework.remoting.caucho.HessianClientInterceptor.invoke(Hess
ianClientInterceptor.jav
a:225)
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.
java:171)
at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:204)
at $Proxy1.testHessian2(Unknown Source)
at 
uk.nominet.proxyservice.client.TestProxyClient.main(TestProxyClient.java
:42)
Caused by: com.caucho.hessian.io.HessianFieldException: 
java.lang.StackTraceElement.lineNumber: expe
cted integer at end of file
at 
com.caucho.hessian.io.JavaDeserializer.logDeserializeError(JavaDeseriali
zer.java:590)
at 
com.caucho.hessian.io.JavaDeserializer$IntFieldDeserializer.deserialize(
JavaDeserializer.java:48
3)
at 
com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:
233)
at 
com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:
157)
at 
com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.jav
a:2048)
at
com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1689)
at 
com.caucho.hessian.io.ArrayDeserializer.readList(ArrayDeserializer.java:
95)
at
com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1700)
at 
com.caucho.hessian.io.JavaDeserializer$ObjectFieldDeserializer.deseriali
ze(JavaDeserializer.java
:387)
at 
com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:
233)
at 
com.caucho.hessian.io.JavaDeserializer.readObject(JavaDeserializer.java:
157)
at 
com.caucho.hessian.io.SerializerFactory.readObject(SerializerFactory.jav
a:376)
at 
com.caucho.hessian.io.Hessian2Input.readObjectInstance(Hessian2Input.jav
a:2051)
at
com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1977)
at
com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1969)
at
com.caucho.hessian.io.Hessian2Input.readFault(Hessian2Input.java:1626)
at 
com.caucho.hessian.io.Hessian2Input.prepareFault(Hessian2Input.java:425)
at
com.caucho.hessian.io.Hessian2Input.startReply(Hessian2Input.java:414)
at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:218)
at $Proxy0.testHessian2(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.springframework.remoting.caucho.HessianClientInterceptor.invoke(Hess
ianClientInterceptor.jav
a:219)
... 4 more
Caused by: com.caucho.hessian.io.HessianProtocolException: expected 
integer at end of file
at com.caucho.hessian.io.Hessian2Input.error(Hessian2Input.java:2705)
at com.caucho.hessian.io.Hessian2Input.expect(Hessian2Input.java:2668)
at com.caucho.hessian.io.Hessian2Input.readInt(Hessian2Input.java:845)
at 
com.caucho.hessian.io.JavaDeserializer$IntFieldDeserializer.deserialize(
JavaDeserializer.java:47
9)
        ... 27 more
 


I tried to set debug to true in the factory to see what is being
returned,

        <bean id="proxyFactory" 
class="com.caucho.hessian.client.HessianProxyFactory">
                <property name="hessian2Request" value="true" />
                <property name="hessian2Reply" value="true" />
                <property name="debug" value="true" />
        </bean>
 
A different exception is thrown when debuging. the output in this case
is 
shown below.
 
        reply 2.0
        fault map (#0)
        "code" => "ServiceException"
"message" => "Testing"
"detail" => /* defun java.lang.Exception [detailMessage, cause, 
stackTrace] */
object java.lang.Exception (#0)
detailMessage: "Testing"
cause: ref(#0)
stackTrace: list [java.lang.StackTraceElement(#1)
0: 0.0
1: binary(14)
2: 
3: 
4: 
5: 4
6: "declaringClass"
7: "methodName"
8: "fileName"
9: "lineNumber"
10: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at 
com.caucho.hessian.io.HessianDebugState$ObjectState.shift(HessianDebugSt
ate.java:1188)
at 
com.caucho.hessian.io.HessianDebugState$State.nextObject(HessianDebugSta
te.java:277)
at 
com.caucho.hessian.io.HessianDebugState$ObjectState.next(HessianDebugSta
te.java:1214)
at
com.caucho.hessian.io.HessianDebugState.next(HessianDebugState.java:93)
at 
com.caucho.hessian.io.HessianDebugInputStream.read(HessianDebugInputStre
am.java:106)
at java.io.InputStream.read(InputStream.java:163)
at
com.caucho.hessian.io.Hessian2Input.readBuffer(Hessian2Input.java:2644)
at com.caucho.hessian.io.Hessian2Input.read(Hessian2Input.java:2624)
at
com.caucho.hessian.io.Hessian2Input.startReply(Hessian2Input.java:386)
at com.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:218)
at $Proxy0.testHessian2(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.springframework.remoting.caucho.HessianClientInterceptor.invoke(Hess
ianClientInterceptor.jav
a:219)
at 
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.
java:171)
at 
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAo
pProxy.java:204)
at $Proxy1.testHessian2(Unknown Source)
        at 
uk.nominet.proxyservice.client.TestProxyClient.main(TestProxyClient.java
:42)
 
 
Can somebody help on this?

Kind regards
Miquel


_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest


_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to