今天随便用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>
<