首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > 其他服务器 >

jbuilder 2006 在构建web service是数据表返回的有关问题,多谢大家,高分回报

2012-03-11 
jbuilder 2006 在构建web service是数据表返回的问题,谢谢大家,高分回报.使用jbuilder 2006 在weblogic下

jbuilder 2006 在构建web service是数据表返回的问题,谢谢大家,高分回报.
使用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>  
 


[解决办法]
使用web service是,一定要注意,返回到都是Object类型的,list是不能返回的,
你要去创建一个实体类,把list作为他的一个属性,这样才可以在客户端得到结果
[解决办法]
我将List 作为一个UserInfo 类的属性返回,但总是出现
[java] javax.xml.soap.SOAPException: failed to deserialize xml:weblogic
.xml.schema.binding.DeserializationException: mapping lookup failure. type=['jav
a:language_builtins.util']:ArrayList schema context=TypedSchemaContext{javaType=
java.util.ArrayList}

这是什么原因?
[解决办法]
List类没有继承序列化接口.所以在使用WEB SERVICES时,最好用数组,而不要用List

热点排行