« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |
戒除浮躁,读好书,交益友 |
Blog信息 |
blog名称:邢红瑞的blog 日志总数:523 评论数量:1142 留言数量:0 访问次数:9692040 建立时间:2004年12月20日 |

| |
[j2ee]hessian的bug 原创空间, 文章收藏, 软件技术, 电脑与网络
邢红瑞 发表于 2008/5/20 12:16:06 |
人遇到一次bug不难,难的是每天遇到bug,竟然是同一个公司的不同产品的bug。使用hessian进行数据传输,网上下载了新的hessian 3.1.5.接口public interface BasicAPI {public String hello(String user);
}实现public class BasicService implements BasicAPI {public String hello(String user) { return "hello," + user + " !";}
}spring的服务器端配置文件<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <!-- 消息资源 --> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename"> <value>messages</value> </property> </bean> <!--Request Mapping --> <bean id="urlMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"> </bean> <bean id="helloService" class="com.xxx.BasicService"></bean>
<bean name="/hello.service" class="org.springframework.remoting.caucho.HessianServiceExporter"> <property name="service"> <ref bean="helloService" /> </property> <property name="serviceInterface"> <value>com.xxx.BasicAPI</value> </property> </bean></beans>web.xml<servlet> <servlet-name>service</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:service-servlet.xml</param-value> </init-param>
<load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>service</servlet-name> <url-pattern>*.service</url-pattern> </servlet-mapping>客户端的配置文件 hessianclient.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <bean id="helloService" class="org.springframework.remoting.caucho.HessianProxyFactoryBean"> <property name="serviceUrl"> <value> http://localhost/hello.service </value> </property> <property name="serviceInterface"> <value>com.xxx.BasicAPI</value> </property> </bean></beans>测试用例import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;
public class HessianTest {
public HessianTest() {
} public static void main(String[] args) { String[] paths = {"hessianclient.xml"}; ApplicationContext ctx = new ClassPathXmlApplicationContext(paths); BasicAPI hello = (BasicAPI) ctx.getBean("helloService"); System.out.println(hello.hello("dsdd")); }}运行出现Caused by: com.caucho.hessian.io.HessianProtocolException: expected hessian reply at end of file?at com.caucho.hessian.io.Hessian2Input.error(Hessian2Input.java:2701)at com.caucho.hessian.io.Hessian2Input.startReply(Hessian2Input.java:405)at com.lizongbo.hessian.client.HessianProxy.invoke(HessianProxy.java:65)
因为对hessian协议定义不大理解,加上实现复杂,找了一个3.1.3用,以后替他修正这个bug,使用caucho的产品,坚决不用新的版本。 |
|
回复:hessian的bug 原创空间, 文章收藏, 软件技术, 电脑与网络
华美汉盛(游客)发表评论于2008/5/29 16:58:19 |
楼主要找工作吗,到我们公司的blog看看,我们在招软件开发人员,高薪诚聘oracle人才 |
|
» 1 »
|