springboot调用微信的jscode2session报JSONObject异常

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Mrhuangxiutao/article/details/71629680

问题背景:

服务器为Centos6.5
JDK:OpenJDK1.7
tomcat7
项目为微信小程序api的后端代码,解密用户信息,代码是采用springboot写的

异常信息:
json异常

代码:
这里写图片描述

json异常,json应该以{开头。
一样的代码,我在本地跑的时候没有问题的。。。。
于是我一直认为是json异常了,一直在这方面找原因,搞了老半天没解决,后来我直接将那一段文字输出,没有输出,查看日志才发现原因是因为发送请求(https)调用https://api.weixin.qq.com/sns/jscode2session 的时候 出现什么SSL异常了,这才往这方面找原因:
SSL异常

解决方法

展开阅读全文

调用WebService报异常

03-02

AxisFaultrn faultCode: http://schemas.xmlsoap.org/soap/envelope/Server.userExceptionrn faultSubcode: rn faultString: java.lang.reflect.InvocationTargetExceptionrn faultActor: rn faultNode: rn faultDetail: rn http://xml.apache.org/axis/hostname:server4rnrnjava.lang.reflect.InvocationTargetExceptionrn at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)rn at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)rn at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)rn at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)rn at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)rn at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)rn at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)rn at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)rn at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)rn at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)rn at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)rn at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)rn at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)rn at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)rn at org.apache.axis.client.Call.invokeEngine(Call.java:2784)rn at org.apache.axis.client.Call.invoke(Call.java:2767)rn at org.apache.axis.client.Call.invoke(Call.java:2443)rn at org.apache.axis.client.Call.invoke(Call.java:2366)rn at org.apache.axis.client.Call.invoke(Call.java:1812)rn at cn.com.hnisi.viointerface.demo.EPODemo.main(EPODemo.java:105)rn 论坛

struts2 JSONObject异常

12-10

版本:Jdk1.7.0_25 struts2.3.15.1 tomcat v7.0rn代码:rnList list = new ArrayList();rnlist.add( "first" ); rnlist.add( "second" );rnMap map = new HashMap();rnmap.put("rows", list);rn[color=#FF0000]JSONObject jsonObj = JSONObject.fromObject(map);[/color]System.out.println(jsonObj);rnrn红色部分抛出下面的异常,查了好久,很多人说是jar包的问题,我也重新导入了jar包,还是异常。rn求赐教,哪里出了问题。rn12 10, 2013 11:42:16 org.apache.struts2.dispatcher.Dispatcher errorrnSEVERE: Exception occurred during processing request: nullrnjava.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:606)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)rn at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)rn at java.lang.Thread.run(Thread.java:724)rnCaused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeExceptionrn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:792)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)rn at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)rn at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)rn at com.sys.action.GM00401InitAction.getKenGenList(GM00401InitAction.java:46)rn ... 69 morernCaused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeExceptionrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)rn ... 77 morern 论坛

java调用asmx报异常

05-10

下列是 SOAP 1.1 要求與回應的範例。預留位置顯示之處必須代入實際的值。rnrnPOST /MyGameMemberApp/MemberGetData.asmx HTTP/1.1rnHost: b2b.mygame.com.twrnContent-Type: text/xml; charset=utf-8rnContent-Length: lengthrnSOAPAction: "http://tempuri.org/GetMyCardMemberAuth"rnrnrnrn rn rn stringrn stringrn stringrn stringrn rn rnrnrnHTTP/1.1 200 OKrnContent-Type: text/xml; charset=utf-8rnContent-Length: lengthrnrnrnrn rn rn rn intrn stringrn stringrn rn rn rnrnrn以下是我的测试代码rnpackage hk.egame.port2.util;rnimport javax.xml.namespace.QName;rnimport org.apache.axis.client.Call;rnimport org.apache.axis.client.Service;rnpublic class HttpTest rn /**rn * @param argsrn */rn public static void main(String[] args) throws Exceptionrn // TODO Auto-generated method stubrn String service_url="http://************/MyGameMemberApp/MemberGetData.asmx";rn String method="GetMyCardMemberAuth";rn String factoryReturnUrl="www.baidu.com"; rn Service service = new Service();rn Call call = (Call) service.createCall();rn call.setTargetEndpointAddress(new java.net.URL(service_url));rn // 设置要调用的方法rn //We have to figure our the namespace. The java doesn't know where is the namespace rn call.setOperationName(new QName("http://tempuri.org/",method)); rn rn // 该方法需要的参数rn call.addParameter(new QName("http://tempuri.org/","FactoryId"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);rn call.addParameter(new QName("http://tempuri.org/","GameId"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);rn call.addParameter(new QName("http://tempuri.org/","FactoryServiceId"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);rn call.addParameter(new QName("http://tempuri.org/","FactoryReturnUrl"),org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);rn rn // 方法的返回值类型rn call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);rn call.setUseSOAPAction(true);rn call.setSOAPActionURI("http://tempuri.org/GetMyCardMemberAuth");rn //call.setSOAPActionURI(service_url);rn rn // 调用该方法, new Object[] CustNo, passwd, Jobno为参数列表rn rn String xmlStr = call.invoke(new Object[] "xiaonei", "smzt", "MFSD000310","www.baidu.com").toString();rn rn System.out.println(xmlStr);rn rnrnrnrnrn以下是返回的异常rnhttp://xml.apache.org/axis/stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.rn at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)rn at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)rn at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)rn at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)rn at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)rn at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)rn at org.apache.axis.client.Call.invoke(Call.java:2467)rn at org.apache.axis.client.Call.invoke(Call.java:2366)rn at org.apache.axis.client.Call.invoke(Call.java:1812)rn at hk.egame.port2.util.HttpTest.main(HttpTest.java:56)rnrn http://xml.apache.org/axis/hostname:Srnrn请问谁做过这方面的调用,求帮忙rnrnrnrnrnrnrnrnrnrn 论坛

Tomcat 调用 jboss上的 Ejb 报异常

03-14

刚学Ejb 从Tomcat 的index.jsp 中调用本机 jboss 服务器上的Ejb 时报异常 。奇怪的是,在同一工程下我写了一个用来测试的main方法,代码与index.jsp中的脚本代码一模一样,但在main里面运行时可以正常得到结果。我实在不解,请前辈帮我看看是什么原因。代码和异常信息如下。rn~~~ <%rn Properties pop = new Properties();rn pop.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");rn pop.setProperty(InitialContext.PROVIDER_URL,"localhost:1099");rn InitialContext ctx = new InitialContext(pop);rn rn Hello h = (Hello)ctx.lookup("HelloBean/remote");rn out.print(h.sayHello("中国人"));rn rn %>rn~~~rnrn异常信息rn~~~javax.servlet.ServletExceptionrn org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)rn org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)rn org.apache.jsp.index_jsp._jspService(index_jsp.java:75)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnroot causernrnjavax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: rn java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: rn java.net.MalformedURLException: no protocol: Files/Apache]rn org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)rn org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)rn javax.naming.InitialContext.lookup(InitialContext.java:409)rn org.apache.jsp.index_jsp._jspService(index_jsp.java:63)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrnroot causernrnjava.rmi.ServerException: RemoteException occurred in server thread; nested exception is: rn java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: rn java.net.MalformedURLException: no protocol: Files/Apachern sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)rn sun.rmi.transport.Transport$1.run(Unknown Source)rn java.security.AccessController.doPrivileged(Native Method)rn sun.rmi.transport.Transport.serviceCall(Unknown Source)rn sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)rn sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)rn java.lang.Thread.run(Unknown Source)rn sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)rn sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)rn sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)rn org.jnp.server.NamingServer_Stub.lookup(Unknown Source)rn org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)rn org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)rn javax.naming.InitialContext.lookup(InitialContext.java:409)rn org.apache.jsp.index_jsp._jspService(index_jsp.java:63)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rnrn~~~~rn 论坛

*****************客户端调用webservice 报javax.xml.bind.UnmarshalException异常

11-20

javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected element (uri:"http://common.web.topsoft.com", local:"return"). Expected elements are (none) rn at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)rn at $Proxy77.caseSourceInfoForOtherSystem(Unknown Source)rn at com.topnet.stag.service.SuspectIllegalProcessServiceTest.testSuspectIlleal(SuspectIllegalProcessServiceTest.java:70)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)rn at java.lang.reflect.Method.invoke(Method.java:599)rn at junit.framework.TestCase.runTest(TestCase.java:154)rn at junit.framework.TestCase.runBare(TestCase.java:127)rn at junit.framework.TestResult$1.protect(TestResult.java:106)rn at junit.framework.TestResult.runProtected(TestResult.java:124)rn at junit.framework.TestResult.run(TestResult.java:109)rn at junit.framework.TestCase.run(TestCase.java:118)rn at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)rnCaused by: javax.xml.bind.UnmarshalExceptionrn - with linked exception:rn[javax.xml.bind.UnmarshalException: unexpected element (uri:"http://common.web.topsoft.com", local:"return"). Expected elements are (none)]rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:421)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:330)rn at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:768)rn at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:632)rn at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:156)rn at org.apache.cxf.interceptor.DocLiteralInInterceptor.getPara(DocLiteralInInterceptor.java:260)rn at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:127)rn at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)rn at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:785)rn at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2375)rn at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2233)rn at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2076)rn at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)rn at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:724)rn at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)rn at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)rn at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:546)rn at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:343)rn at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:295)rn at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)rn at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)rn ... 18 morernCaused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://common.web.topsoft.com", local:"return"). Expected elements are (none)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)rn at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244)rn at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:239)rn at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1009)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:446)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427)rn at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:275)rn at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:209)rn at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:358)rn ... 38 morernCaused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"http://common.web.topsoft.com", local:"return"). Expected elements are (none)rn ... 48 morernrn 论坛

android客户端调用webservice报异常,是怎么回事

10-05

[code=java]package Telephone.test;rnrnimport org.ksoap2.SoapEnvelope;rnimport org.ksoap2.serialization.SoapObject;rnimport org.ksoap2.serialization.SoapSerializationEnvelope;rnimport org.ksoap2.transport.HttpTransportSE;rnrnimport android.app.Activity;rnimport android.os.Bundle;rnimport android.view.View;rnimport android.view.View.OnClickListener;rnimport android.widget.Button;rnimport android.widget.EditText;rnimport android.widget.TextView;rnpublic class TelephoneActivity extends Activity rn /** Called when the activity is first created. */rn private EditText phoneSecEditText;rn private TextView resultView;rn private Button queryButton;rn public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn queryButton = (Button) findViewById(R.id.query_btn);rn queryButton.setOnClickListener(new OnClickListener() rn public void onClick(View v) rn rn String username = phoneSecEditText.getText().toString().trim();rn getRemoteInfo(username);rn rn );rn rn rn public void getRemoteInfo(String username) rn // 命名空间rn String nameSpace="http://tempuri.org/";rn // 调用的方法名称rn String methodName="GetUserList";rn // EndPointrn String endPoint="http://192.168.0.100:8081/WebService.asmx";rn // SOAP Actionrn String soapAction="http://tempuri.org/GetUserList";rnrn // 指定WebService的命名空间和调用的方法名rn SoapObject rpc = new SoapObject(nameSpace, methodName);rnrn // 设置需调用WebService接口需要传入的两个参数mobileCode、userIdrn rpc.addProperty("username", username);rn rnrn // 生成调用WebService方法的SOAP请求信息,并指定SOAP的版本rn SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);rnrn envelope.bodyOut = rpc;rn // 设置是否调用的是dotNet开发的WebServicern envelope.dotNet = true;rn // 等价于envelope.bodyOut = rpc;rn envelope.setOutputSoapObject(rpc);rnrn HttpTransportSE transport = new HttpTransportSE(endPoint);rn try rn // 调用WebServicern transport.call(soapAction, envelope);rn catch (Exception e) rn e.printStackTrace();rn rnrn // 获取返回的数据rn SoapObject object = (SoapObject) envelope.bodyIn;rn // 获取返回的结果rn String result = object.getProperty(0).toString();rn //String result = "lijian";rnrn // 将WebService返回的结果显示在TextView中rn resultView.setText(result);rn rn[/code]rnrn 论坛

调用web service服务的时候报异常。。

05-13

javax.servlet.ServletException: com.biaoqi.ibs.exception.SystemException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.rn org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)rn org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)rn org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)rn org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)rn com.biaoqi.ibs.base.IBSActionServlet.process(IBSActionServlet.java:27)rn org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)rn com.biaoqi.ibs.filter.EncodingFilter.doFilter(EncodingFilter.java:28)rnrnrn完全不能理解者到底是哪里有问题 蛋疼死了 rn[code=java] public void doFilter(ServletRequest srequest, ServletResponse sresponse,rn FilterChain chain) throws IOException, ServletException rn HttpServletRequest request = (HttpServletRequest) srequest;rn request.setCharacterEncoding(targetEncoding);rn config.toString();rn chain.doFilter(srequest, sresponse);rn [/code]rn上面说的EncodingFilter.doFilter报的错 但是这里什么也没做 就掉了一个封装好了的方法。 论坛

C#调用C++的DL报未知异常

07-05

[code=C/C++]rn//DLL中的函数声明rn//app传入rn//buffer 传出rnISO8583DLL_API int Pack_Ex (application* app,unsigned char * buffer );rn[/code]rnrn[code=C#]rn//机构体定义rn [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]rn internal struct Application_Exrn rn public static Application_Ex InitShuZu()rn rn Application_Ex obj = new Application_Ex();rn obj.process_code = new byte[5];rn obj.trans_type = new byte[3];rn obj.park_id = new byte[PARK_ID_LENGTH + 1];rn obj.terminal_id = new byte[TERMINAL_ID_LENGTH + 1];rn //............. rn //内容太多,没有贴完rn rn // packagern rn public byte[] source_tpdu ; rn public byte[] target_tpdu ; rnrn public byte itrans_type; rn public byte[] trans_type ; rn //............. rn //内容太多,没有贴完rn rn//DLL函数导出rn [DllImport("ISO8583Dll.dll", EntryPoint = "Pack_Ex")]rn private static extern int Pack_Ex(Application_Ex app_ex, byte[] buff);rnrn//函数调用rn unsafe public static void jgtdy()rn rn Application_Ex m_txd = new Application_Ex();rn m_txd = Application_Ex.InitShuZu();rn rn tryrn rn //赋值rn m_txd.process_code[0] = (byte)'0';rn m_txd.process_code[1] = (byte)'0';rn m_txd.process_code[2] = (byte)'0';rn m_txd.process_code[3] = (byte)'6';rnrn m_txd.trans_type[0] = (byte)'8';rn m_txd.trans_type[1] = (byte)'1';rn //010101009001rn m_txd.park_id[0] = (byte)'0';rn m_txd.park_id[1] = (byte)'1';rn m_txd.park_id[2] = (byte)'0';rn m_txd.park_id[3] = (byte)'1';rn m_txd.park_id[4] = (byte)'0';rn m_txd.park_id[5] = (byte)'1';rn m_txd.park_id[6] = (byte)'0';rn m_txd.park_id[7] = (byte)'0';rn m_txd.park_id[8] = (byte)'9';rn m_txd.park_id[9] = (byte)'0';rn m_txd.park_id[10] = (byte)'0';rn m_txd.park_id[11] = (byte)'1';rnrn //02010001rn m_txd.terminal_id[0] = (byte)'0';rn m_txd.terminal_id[1] = (byte)'2';rn m_txd.terminal_id[2] = (byte)'0';rn m_txd.terminal_id[3] = (byte)'1';rn m_txd.terminal_id[4] = (byte)'0';rn m_txd.terminal_id[5] = (byte)'0';rn m_txd.terminal_id[6] = (byte)'0';rn m_txd.terminal_id[7] = (byte)'1';rnrn //20120420rn m_txd.trans_date[0] = (byte)'2';rn m_txd.trans_date[1] = (byte)'0';rn m_txd.trans_date[2] = (byte)'1';rn m_txd.trans_date[3] = (byte)'2';rn m_txd.trans_date[4] = (byte)'0';rn m_txd.trans_date[5] = (byte)'4';rn m_txd.trans_date[6] = (byte)'2';rn m_txd.trans_date[7] = (byte)'0';rnrn //005006rn m_txd.trans_time[0] = (byte)'0';rn m_txd.trans_time[1] = (byte)'0';rn m_txd.trans_time[2] = (byte)'5';rn m_txd.trans_time[3] = (byte)'0';rn m_txd.trans_time[4] = (byte)'0';rn m_txd.trans_time[5] = (byte)'6';rn //000100rn m_txd.lsh = 000100;rnrn m_txd.host_lsh = 000000000000;rn //000101rn m_txd.batch_no = 000101;rnrn m_txd.amount = 000000000000;rnrn //0033rn m_txd.para_ver = 0033;rnrn //2012040400rn m_txd.fee_id[0] = (byte)'2';rn m_txd.fee_id[1] = (byte)'0';rn m_txd.fee_id[2] = (byte)'1';rn m_txd.fee_id[3] = (byte)'2';rn m_txd.fee_id[4] = (byte)'0';rn m_txd.fee_id[5] = (byte)'4';rn m_txd.fee_id[6] = (byte)'0';rn m_txd.fee_id[7] = (byte)'4';rn m_txd.fee_id[8] = (byte)'4';rn m_txd.fee_id[9] = (byte)'0';rn m_txd.fee_id[10] = (byte)'0';rnrn m_txd.prog_ver = 0000;rn //01080001rn m_txd.oper_id[0] = (byte)'0';rn m_txd.oper_id[1] = (byte)'1';rn m_txd.oper_id[2] = (byte)'0';rn m_txd.oper_id[3] = (byte)'8';rn m_txd.oper_id[4] = (byte)'0';rn m_txd.oper_id[5] = (byte)'0';rn m_txd.oper_id[6] = (byte)'0';rn m_txd.oper_id[7] = (byte)'1';rn //0101rn m_txd.oper_pwd[0] = (byte)'0';rn m_txd.oper_pwd[1] = (byte)'1';rn m_txd.oper_pwd[2] = (byte)'0';rn m_txd.oper_pwd[3] = (byte)'1';rnrn //0001rn //m_txd.mac[0]=0x20;rn for (int i = 0; i < 8; i++)rn rn m_txd.mac[i] = 0x20;rn rn m_txd.park_ver[0] = (byte)'0';rn m_txd.park_ver[1] = (byte)'0';rn m_txd.park_ver[2] = (byte)'0';rn m_txd.park_ver[3] = (byte)'1';rn //0102rn m_txd.oper_ver[0] = (byte)'0';rn m_txd.oper_ver[1] = (byte)'1';rn m_txd.oper_ver[2] = (byte)'0';rn m_txd.oper_ver[3] = (byte)'2';rnrn byte[] buf = new byte[100];rn int nlen = Pack_Ex(m_txd, buf);//执行到这里报异常NotSupportedExceptionrn rn catch (System.Exception ex)rn rn string exstr = ex.Message;rn rnrn rn[/code]rn 论坛

调用hibernate操作报异常求解

03-31

项目中有个Action~rn当在Action初始化的时候new一个ServiceManage就会报异常rnServiceManage:rn[code=Java]rnpackage com.guangguang.service;rnrnimport org.hibernate.Session;rnimport org.hibernate.SessionFactory;rnimport org.hibernate.cfg.Configuration;rnimport com.guangguang.model.User;rnrnpublic class ServiceManage rn static Configuration cfg = new Configuration();rn static SessionFactory sf= cfg.configure().buildSessionFactory();rn static Session session = sf.openSession();rn rn public void begin()rn session.beginTransaction();rn rn public void end()rn session.getTransaction().commit();rn session.close();rn sf.close(); rn rn public void add(User u)rn begin();rn session.save(u); rn end();rn rn rn public void delete(User u)rn begin();rn session.delete(u);rn end();rn rn rn public void update(User u)rn begin();rn session.update(u);rn end();rn rn rn public void load(User u)rn begin();rn session.load(u ,u.getClass());rn end();rn rn rnrnrnrnrn[/code]rnrn异常信息:rn[code=Java]rn严重: Servlet.service() for servlet default threw exceptionrnjava.lang.ClassNotFoundException: org.hibernate.Sessionrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(Unknown Source)rn at com.guangguang.action.RegisterAction.(RegisterAction.java:14)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at java.lang.Class.newInstance0(Unknown Source)rn at java.lang.Class.newInstance(Unknown Source)rn at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:119)rn at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:150)rn at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)rn at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)rn at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288)rn at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)rn at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)rn at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)rn at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)rn at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)rnrn[/code]rn环境是:rnJDK6.0 struts2.1.6 hibernate3.3.2rnrn我觉得问题出在hibernate内部了rn但是是怎么回事,我也不知道`rnrn请有过类似问题的高手指点一下`rn还需要什么信息请留言..rnrn 论坛

没有更多推荐了,返回首页