求教jbuilder 2006 在构建web service是数据表返回的问题,谢谢大家,高分回报.

dz08039 2008-06-07 10:02:33
使用jbuilder 2006 在weblogic下创建一个web service,通过jdbc读oracle的表,然后将表的数据传给客户端,resultset不能被序列化,所以使用List,编译部署都成功了,但是去访问就出错了,求教,请大家指点,谢谢了


程序如下:
public List getTable()
{
DataSource ds ;
List ReturnDate = null;
Connection conn = null ;
ResultSet rs = null;
try
{
Bean1 ub = new Bean1();
ds=getOracleDS();
conn = ds.getConnection();
Statement sta = conn.createStatement();
rs = sta.executeQuery("Select * from testTable");
ReturnDate = new ArrayList();
while(rs.next() )
{
ub.setFirst_Name(rs.getString("First_Name") ) ;
ub.setLast_Name(rs.getString("Last_Name") ) ;
ub.setAddress(rs.getString("Address") );
ub.setCity(rs.getString("City") );
ub.setCountry(rs.getString("Country") );
ReturnDate.add(ub);
}
conn.close();
}
catch (Exception e)
{
//异常处理
}

return ReturnDate;
}
private DataSource getOracleDS() throws NamingException
{
Context ctx = new InitialContext();
return (DataSource) ctx.lookup("jdbc/testmdb");
}


错误提示如下:

Invocation failed!

Parameter Name Parameter Value


Request sent to the server

<!--REQUEST.................-->
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header>
</env:Header>
<env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<m:getTable xmlns:m="http://beanexport">
</m:getTable>
</env:Body>
</env:Envelope>

Response from the server

<!--RESPONSE.................-->
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header>
</env:Header>
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>Exception during processing: weblogic.xml.schema.binding.SerializationException: type mapping lookup failure on class=class beanexport.Bean1 TypeMapping=TYPEMAPPING SIZE=2
ENTRY 1:
class: java.util.List
xsd_type: ['java:language_builtins.util']:p1:List
ser: weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec@532d15
deser: weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec@b4e7ec
ENTRY 2:
class: beanexport.Tuple
xsd_type: ['java:beanexport']:p2:Tuple
ser: beanexport.TupleCodec@e6615f
deser: beanexport.TupleCodec@102d6b3
(see Fault Detail for stacktrace)</faultstring>
<detail>
<bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">weblogic.xml.schema.binding.SerializationException: type mapping lookup failure on class=class beanexport.Bean1 TypeMapping=TYPEMAPPING SIZE=2
ENTRY 1:
class: java.util.List
xsd_type: ['java:language_builtins.util']:p1:List
ser: weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec@532d15
deser: weblogic.xml.schema.binding.internal.builtin.JavaUtilListCodec@b4e7ec
ENTRY 2:
class: beanexport.Tuple
xsd_type: ['java:beanexport']:p2:Tuple
ser: beanexport.TupleCodec@e6615f
deser: beanexport.TupleCodec@102d6b3

at weblogic.xml.schema.binding.RuntimeUtils.lookup_serializer(RuntimeUtils.java:135)
at weblogic.xml.schema.binding.internal.builtin.XSDAnyCodec.serialize(XSDAnyCodec.java:71)
at weblogic.xml.schema.binding.internal.builtin.JavaUtilCollectionCodec.serializeOneDimArray(JavaUtilCollectionCodec.java:93)
at weblogic.xml.schema.binding.SoapArrayCodecBase.gatherContents(SoapArrayCodecBase.java:470)
at weblogic.xml.schema.binding.CodecBase.serializeFill(CodecBase.java:297)
at weblogic.xml.schema.binding.CodecBase.serialize_internal(CodecBase.java:234)
at weblogic.xml.schema.binding.CodecBase.serialize(CodecBase.java:193)
at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(RuntimeUtils.java:192)
at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(RuntimeUtils.java:178)
at weblogic.webservice.core.DefaultPart.invokeSerializer(DefaultPart.java:331)
at weblogic.webservice.core.DefaultPart.toXML(DefaultPart.java:300)
at weblogic.webservice.core.DefaultMessage.toXML(DefaultMessage.java:651)
at weblogic.webservice.core.handler.InvokeHandler.handleRequest(InvokeHandler.java:151)
at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.java:144)
at weblogic.webservice.core.DefaultOperation.process(DefaultOperation.java:551)
at weblogic.webservice.server.Dispatcher.process(Dispatcher.java:204)
at weblogic.webservice.server.Dispatcher.doDispatch(Dispatcher.java:175)
at weblogic.webservice.server.Dispatcher.dispatch(Dispatcher.java:97)
at weblogic.webservice.server.WebServiceManager.dispatch(WebServiceManager.java:101)
at weblogic.webservice.server.servlet.WebServiceServlet.serverSideInvoke(WebServiceServlet.java:321)
at weblogic.webservice.server.servlet.ServletBase.doPost(ServletBase.java:452)
at weblogic.webservice.server.servlet.WebServiceServlet.doPost(WebServiceServlet.java:292)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3214)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1983)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1890)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1344)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
</bea_fault:stacktrace>
</detail>
</env:Fault>
</env:Body>
</env:Envelope>
...全文
37 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
dz08039 2008-06-10
Bean1类已经实现序列化了,把数据返回类型转换为String型是可以的,但作为list类传就不行
回复
dz08039 2008-06-10
[Quote=引用 4 楼 yetaodiao 的回复:]
少改一个地方了
[/Quote]
求教,要改哪个地方
回复
yetaodiao 2008-06-08
少改一个地方了
回复
liuxiaotao008 2008-06-07
就是Bean1 implements Serializable
回复
liuxiaotao008 2008-06-07
Bean1类需要实现序列化接口!
回复
liuxiaotao008 2008-06-07
WebServcie公布的方法中不能直接操作数据库,你把数据库相关代码放到独立的类中,然后由公开的方法去调用.
先试试看.
回复
相关推荐
发帖
Java
创建于2007-09-28

4.8w+

社区成员

Java相关技术讨论
申请成为版主
帖子事件
创建了帖子
2008-06-07 10:02
社区公告
暂无公告