当前位置: 代码迷 >> Java Web开发 >> 何位大神用过xfire做webservice,帮小弟一个忙!
  详细解决方案

何位大神用过xfire做webservice,帮小弟一个忙!

热度:6915   发布时间:2013-02-25 21:09:51.0
哪位大神用过xfire做webservice,帮小弟一个忙!!!!!!!
我照网上做了几个例子,都是会报同样的异常:org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection)
......
Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
但是我根本没和数据库关联也没配什么数据库,只是做个简单的xfire实现webservice例子而已,各路神仙们帮小弟看看!!

1、IHello.java:
public String sayHello(String username);

2、Hello.java:
public class Hello implements IHello {
public String sayHello(String username) {
// TODO Auto-generated method stub
return "Hello!" + username;
}
}

3、web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <servlet>
  <servlet-name>XFireServlet</servlet-name>
  <servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
  <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
  <servlet-name>XFireServlet</servlet-name>
  <url-pattern>/services/*</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

4、services.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
  <name>myhello</name><!-- 这个名字比较重要,调用时用的就是它 -->
  <namespace>http://localhost/Hello</namespace>
  <serviceClass>test.IHello</serviceClass>
  <implementationClass>test.Hello</implementationClass>
</service>
</beans>

就这四个文件,然后已启动tomcat就报错(⊙o⊙)~~~~~~~~~~~~~~~······呃呃呃!!!啊啊啊...

------解决方案--------------------------------------------------------
http://localhost:8080/Hello
  相关解决方案