hessian spring疑问(已解决)

今天随便用maven创建了个工程,写了个hessian的服务,然后写了个客户端调用这个hessian服务,发现总是报如下错误:



 根据以前开发hessian接口的经验这种情况应该都是启动服务报错了,但是我用log4j打印日志,发现没有任何错误,后来想了下,这个错误是说文件找不到,那应该就是bean服务找不到,我现在是把配置文件放在类路径下,工程结构如下:



 <bean id="helloWorldAPI1" class="com.hessian.impl.JavassitHelloWorldImpl">

</bean>

 

<bean name="/hessianCommentService1"

class="org.springframework.remoting.caucho.HessianServiceExporter">

<property name="service" ref="helloWorldAPI1" />

<property name="serviceInterface" value="com.hessian.api.JavassitHelloWorldAPI" />

</bean>

这段提供服务的配置是定义在hello-servlet.xml文件中,web.xml文件定义如下:

 

<?xml version="1.0" encoding="GB2312"?>

<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">

 

<context-param> 

<param-name>log4jConfigLocation</param-name> 

<param-value>classpath:log4j.xml</param-value> 

</context-param> 

 

<listener>

<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>

</listener>

 

<servlet>

<servlet-name>test</servlet-name>

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

 

<servlet-mapping>

<servlet-name>test</servlet-name>

<url-pattern>/service/*</url-pattern>

</servlet-mapping>

 

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>

   classpath*:/spring/*.xml</param-value>

</context-param>

 

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

<welcome-file-list>

<welcome-file>/jsp/login.jsp</welcome-file>

</welcome-file-list>

 

</web-app>

按照道理,spring回去解析/spring/*.xml下的hello-servlet.xml文件,就可以提供hessian服务,可是却报了这个找不到的错误,于是我将hessian的bean定义放在test-servlet.xml文件中,同时注释掉web.xml中的如下配置:

<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值