问题描述
最近写了个EJB3,1.想通过webservice调用,这是webservice中类的代码,用main函数调用getName方法,返回一切正常,但是使用mycelipse9.0中的SOAPExplorer测试wsdl时,反生异常代码如下:packagecom.ejb.hello;importjava.io.IOException;importjava.util.Properties;importjavax.naming.Context;importjavax.naming.InitialContext;importjavax.rmi.PortableRemoteObject;importcom.ejb.hello.*;publicclassCalc{/***@paramargs*@throwsNamingException*@throwsIOException*/publicStringgetName(){Propertiesprop=newProperties();prop.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");//设置jnp地址prop.setProperty(Context.PROVIDER_URL,"iiop://localhost:2809/");//初始化try{InitialContextctx=newInitialContext(prop);//查找EJBBeanSystem.out.println(helloRemote.class.getName());Objectobj=ctx.lookup(helloRemote.class.getName());helloRemoteremote=(helloRemote)PortableRemoteObject.narrow(obj,helloRemote.class);returnremote.sayHello("中国");}catch(Exceptione){e.printStackTrace();returnnull;}}}异常代码:Throwableoccurred:java.lang.ExceptionInInitializerErroratjava.lang.J9VMInternals.initialize(J9VMInternals.java:222)atcom.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:318)atjava.lang.J9VMInternals.initializeImpl(NativeMethod)atjava.lang.J9VMInternals.initialize(J9VMInternals.java:200)atcom.sun.xml.ws.transport.http.DeploymentDescriptorParser.createBinding(DeploymentDescriptorParser.java:302)atcom.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:243)atcom.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)atcom.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4336)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:719)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:448)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:552)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)atjava.lang.reflect.Method.invoke(Method.java:599)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Causedby:java.lang.UnsupportedOperationException:WSWS4104E:SAAJ1.2不支持SOAP1.2Protocol。atcom.ibm.ws.webservices.engine.xmlsoap.SOAPFactory.setSOAPConstants(SOAPFactory.java:143)atcom.ibm.ws.webservices.engine.xmlsoap.SOAPFactory.<init>(SOAPFactory.java:111)atcom.ibm.ws.webservices.engine.soap.SAAJMetaFactoryImpl.newSOAPFactory(SAAJMetaFactoryImpl.java:68)atjavax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:304)atcom.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:179)atcom.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:93)atjava.lang.J9VMInternals.initializeImpl(NativeMethod)atjava.lang.J9VMInternals.initialize(J9VMInternals.java:200)...31more2011-8-623:30:11org.apache.catalina.core.StandardContextlistenerStartSEVERE:Exceptionsendingcontextinitializedeventtolistenerinstanceofclasscom.sun.xml.ws.transport.http.servlet.WSServletContextListenerThrowableoccurred:com.sun.xml.ws.transport.http.servlet.WSServletException:WSSERVLET11:failedtoparseruntimedescriptor:java.lang.ExceptionInInitializerErroratcom.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:118)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4336)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1023)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:719)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1015)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)atorg.apache.catalina.core.StandardService.start(StandardService.java:448)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:552)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)atjava.lang.reflect.Method.invoke(Method.java:599)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Causedby:java.lang.ExceptionInInitializerErroratjava.lang.J9VMInternals.initialize(J9VMInternals.java:222)atcom.sun.xml.ws.api.BindingID.<clinit>(BindingID.java:318)atjava.lang.J9VMInternals.initializeImpl(NativeMethod)atjava.lang.J9VMInternals.initialize(J9VMInternals.java:200)atcom.sun.xml.ws.transport.http.DeploymentDescriptorParser.createBinding(DeploymentDescriptorParser.java:302)atcom.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:243)atcom.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147)atcom.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108)...24moreCausedby:java.lang.UnsupportedOperationException:WSWS4104E:SAAJ1.2不支持SOAP1.2Protocol。atcom.ibm.ws.webservices.engine.xmlsoap.SOAPFactory.setSOAPConstants(SOAPFactory.java:143)atcom.ibm.ws.webservices.engine.xmlsoap.SOAPFactory.<init>(SOAPFactory.java:111)atcom.ibm.ws.webservices.engine.soap.SAAJMetaFactoryImpl.newSOAPFactory(SAAJMetaFactoryImpl.java:68)atjavax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:304)atcom.sun.xml.ws.api.SOAPVersion.<init>(SOAPVersion.java:179)atcom.sun.xml.ws.api.SOAPVersion.<clinit>(SOAPVersion.java:93)atjava.lang.J9VMInternals.initializeImpl(NativeMethod)atjava.lang.J9VMInternals.initialize(J9VMInternals.java:200)...31more主要是提示SAAJ1.2不支持SOAP1.2Protocol,请问各位大大怎么解决?另:如果想把EJB3发布成webservice,请问在mycelipse9.0中如何操作?最好能提供较为详细的教程,网上找不到,多谢