You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by vnjaldawar <vn...@gmail.com> on 2012/12/27 07:58:07 UTC
ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Web Service client exists in the workspace. Written a unit test to call Web
Service using client code. Below error is thrown.
RuleImporterProcess is an interface but the error ask to implement method in
it.
[junit] Caused by: com.link.exception.SystemException: [exception of type
javax.xml.ws.WebServiceException occured. error message is
org.apache.cxf.service.factory.ServiceConstructionException: Service class
.model.rulehome.service.wsclient.RuleImporterProcess does not implement the
process method.
[junit] at
com.link.model.rulehome.service.RuleHomeServiceCaller.getWSClientInstance(RuleHomeServiceCaller.java:65)
[junit] at
com.link.model.rulehome.service.RuleHomeServiceCaller.getPredictabilityCost(RuleHomeServiceCaller.java:120)
[junit] at
com.link.model.metricsanalyzer.service.PredictabilityMetricsService.<clinit>(PredictabilityMetricsService.java:53)
[junit] ... 28 more
[junit] Caused by: javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException: Service class
com.link.model.rulehome.service.wsclient.RuleImporterProcess does not
implement the process method.
[junit] at
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:334)
[junit] at
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
[junit] at javax.xml.ws.Service.getPort(Service.java:92)
[junit] at
com.link.model.rulehome.service.wsclient.client_ep.getRuleImporterProcess_pt(client_ep.java:80)
[junit] at
com.link.model.rulehome.service.RuleHomeServiceCaller.getWSClientInstance(RuleHomeServiceCaller.java:62)
[junit] ... 30 more
[junit] Caused by:
org.apache.cxf.service.factory.ServiceConstructionException: Service class
com.link.model.rulehome.service.wsclient.RuleImporterProcess does not
implement the process method.
[junit] at
org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:68)
[junit] at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.bindOperation(JaxWsServiceFactoryBean.java:280)
[junit] at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:254)
[junit] at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:652)
[junit] at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:289)
[junit] at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:393)
[junit] at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:506)
[junit] at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
[junit] at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
[junit] at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
[junit] at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
[junit] at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
[junit] at
org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:153)
[junit] at
org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:465)
[junit] at
org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
[junit] ... 34 more
[junit] Caused by: java.lang.NoSuchMethodException:
com.link.model.rulehome.service.wsclient.RuleImporterProcess.process(com.link.model.rulehome.service.wsclient.Process)
[junit] at java.lang.Class.getMethod(Class.java:1605)
[junit] at
org.apache.cxf.jaxws.JAXWSMethodDispatcher.getImplementationMethod(JAXWSMethodDispatcher.java:88)
[junit] at
org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:55)
[junit] ... 48 more
Unit test Code is:
package com.link.rulehome.service;
import com.link.model.rulehome.service.wsclient.RuleImporterProcess;
import com.link.model.rulehome.service.wsclient.Process;
import com.link.model.rulehome.service.wsclient.RuleTemplate;
import com.link.model.rulehome.service.wsclient.RulesResponseType;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import javax.ejb.embeddable.EJBContainer;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.xml.ws.Service;
import javax.xml.namespace.QName;
import junit.framework.TestCase;
public class RuleImporterServiceTest extends TestCase {
private InitialContext initialContext;
protected void setUp() throws Exception {
Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
properties.setProperty("openejb.embedded.remotable", "true");
EJBContainer.createEJBContainer(properties);
}
/**
* Create a webservice client using wsdl url
*
* @throws Exception
*/
public void testCalculatorViaWsInterface() throws Exception {
URL url = new
URL("http://localhost:8001/SOA/RuleImporterService/client_ep?WSDL");
QName calcServiceQName = new
QName("http://xmlns.oracle.com/RuleImporterService/RuleImporterProcess",
"client_ep");
Service service = Service.create(url, calcServiceQName);
assertNotNull(service);
Iterator<QName> ite = service.getPorts();// .createCall(port);
while(ite.hasNext()) {
QName qn = ite.next();
System.out.println("WS QName : " + qn.getNamespaceURI());
}
final RuleImporterProcess rp =
service.getPort(RuleImporterProcess.class);
Process payload = new Process();
payload.setRuleName("Commodity Line Assignment");
RulesResponseType res = rp.process(payload);
RulesResponseType.Rules rule = res.getRules();
List<RuleTemplate> listRule = rule.getRule();
for (RuleTemplate rt : listRule) {
System.out.println("Rule Name # " + rt.getRuleName());
}
}
}
--
View this message in context: http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Dont you provide xml api instead of using container ones?
Le 28 déc. 2012 12:40, "vnjaldawar" <vn...@gmail.com> a écrit :
>
> Issue is also occuring on 4.5.2 Snapshot version. The workaround i.e
> classloader.skip property is working on v 4.5.1 and not on v4.0. I will
> write a separate sample code and replicate the issue and then will provide
> it.
>
> Thanks for you quick support.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899p4659915.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by vnjaldawar <vn...@gmail.com>.
Issue is also occuring on 4.5.2 Snapshot version. The workaround i.e
classloader.skip property is working on v 4.5.1 and not on v4.0. I will
write a separate sample code and replicate the issue and then will provide
it.
Thanks for you quick support.
--
View this message in context: http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899p4659915.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
https://repository.apache.org/content/groups/snapshots/org/apache/openejb/openejb-standalone/
Le 27 déc. 2012 10:02, "vnjaldawar" <vn...@gmail.com> a écrit :
> I have searched for snapshot but didn't find it. I have tested using
> openejb-standalone-4.5.1.
>
> If possible please provide the link.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899p4659903.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by vnjaldawar <vn...@gmail.com>.
I have searched for snapshot but didn't find it. I have tested using
openejb-standalone-4.5.1.
If possible please provide the link.
Thanks.
--
View this message in context: http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899p4659903.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hmm,
Would be nice if you could try the snapshot (to avoid us to have a look if
already fixed). If it still fail just open a jira an attach your sample
As a workaround set openejb.classloader.forced-skip to org.xml in container
properties
Le 27 déc. 2012 08:46, "vnjaldawar" <vn...@gmail.com> a écrit :
>
> Yes I did tried on 4.5.1. version of OpenEJB. But here it is giving
> classloader exception for org/xml/sax classes.
>
> I have included all jars from openEJB_4.5.1/lib in ant task
>
> <fileset dir="${openejb.path}">
> <include name="**/*.jar"/>
> </fileset>
>
>
> [junit] Caused by: java.lang.LinkageError: loader constraint violation:
> when
> resolving overridden method
>
> "org.apache.xerces.jaxp.SAXParserImpl.parse(Lorg/xml/sax/InputSource;Lorg/xml/sax/helpers/DefaultHandler;)V"
> the class loader (instance of org/apache/openejb/core/TempClassLoader) of
> the current class, org/apache/xerces/jaxp/SAXParserImpl, and its superclass
> loader (instance of <bootloader>), have different Class objects for the
> type
> org/xml/sax/helpers/DefaultHandler used in the signature
> [junit] at
> org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
> [junit] at
>
> org.apache.xml.resolver.readers.SAXCatalogReader.readCatalog(SAXCatalogReader.java:245)
> [junit] at
> org.apache.xml.resolver.Catalog.parseCatalog(Catalog.java:681)
> [junit] at
>
> org.apache.cxf.catalog.OASISCatalogManager.loadCatalogs(OASISCatalogManager.java:148)
> [junit] at
>
> org.apache.cxf.catalog.OASISCatalogManager.loadContextCatalogs(OASISCatalogManager.java:133)
> [junit] at
>
> org.apache.cxf.catalog.OASISCatalogManager.<init>(OASISCatalogManager.java:73)
> [junit] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> [junit] at
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> [junit] at
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> [junit] at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> [junit] at
> org.apache.cxf.bus.extension.Extension.load(Extension.java:199)
> [junit] ... 42 more
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899p4659901.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by vnjaldawar <vn...@gmail.com>.
Yes I did tried on 4.5.1. version of OpenEJB. But here it is giving
classloader exception for org/xml/sax classes.
I have included all jars from openEJB_4.5.1/lib in ant task
<fileset dir="${openejb.path}">
<include name="**/*.jar"/>
</fileset>
[junit] Caused by: java.lang.LinkageError: loader constraint violation: when
resolving overridden method
"org.apache.xerces.jaxp.SAXParserImpl.parse(Lorg/xml/sax/InputSource;Lorg/xml/sax/helpers/DefaultHandler;)V"
the class loader (instance of org/apache/openejb/core/TempClassLoader) of
the current class, org/apache/xerces/jaxp/SAXParserImpl, and its superclass
loader (instance of <bootloader>), have different Class objects for the type
org/xml/sax/helpers/DefaultHandler used in the signature
[junit] at
org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
[junit] at
org.apache.xml.resolver.readers.SAXCatalogReader.readCatalog(SAXCatalogReader.java:245)
[junit] at
org.apache.xml.resolver.Catalog.parseCatalog(Catalog.java:681)
[junit] at
org.apache.cxf.catalog.OASISCatalogManager.loadCatalogs(OASISCatalogManager.java:148)
[junit] at
org.apache.cxf.catalog.OASISCatalogManager.loadContextCatalogs(OASISCatalogManager.java:133)
[junit] at
org.apache.cxf.catalog.OASISCatalogManager.<init>(OASISCatalogManager.java:73)
[junit] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[junit] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[junit] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[junit] at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[junit] at
org.apache.cxf.bus.extension.Extension.load(Extension.java:199)
[junit] ... 42 more
--
View this message in context: http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899p4659901.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.
Re: ServiceConstructionException Web Service unit testing is not
working in OpenEJB 4.0.
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,
Did you try 4.5.1?
Le 27 déc. 2012 07:58, "vnjaldawar" <vn...@gmail.com> a écrit :
> Web Service client exists in the workspace. Written a unit test to call Web
> Service using client code. Below error is thrown.
>
> RuleImporterProcess is an interface but the error ask to implement method
> in
> it.
>
> [junit] Caused by: com.link.exception.SystemException: [exception of type
> javax.xml.ws.WebServiceException occured. error message is
> org.apache.cxf.service.factory.ServiceConstructionException: Service class
> .model.rulehome.service.wsclient.RuleImporterProcess does not implement the
> process method.
> [junit] at
>
> com.link.model.rulehome.service.RuleHomeServiceCaller.getWSClientInstance(RuleHomeServiceCaller.java:65)
> [junit] at
>
> com.link.model.rulehome.service.RuleHomeServiceCaller.getPredictabilityCost(RuleHomeServiceCaller.java:120)
> [junit] at
>
> com.link.model.metricsanalyzer.service.PredictabilityMetricsService.<clinit>(PredictabilityMetricsService.java:53)
> [junit] ... 28 more
> [junit] Caused by: javax.xml.ws.WebServiceException:
> org.apache.cxf.service.factory.ServiceConstructionException: Service class
> com.link.model.rulehome.service.wsclient.RuleImporterProcess does not
> implement the process method.
> [junit] at
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:334)
> [junit] at
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:319)
> [junit] at javax.xml.ws.Service.getPort(Service.java:92)
> [junit] at
>
> com.link.model.rulehome.service.wsclient.client_ep.getRuleImporterProcess_pt(client_ep.java:80)
> [junit] at
>
> com.link.model.rulehome.service.RuleHomeServiceCaller.getWSClientInstance(RuleHomeServiceCaller.java:62)
> [junit] ... 30 more
> [junit] Caused by:
> org.apache.cxf.service.factory.ServiceConstructionException: Service class
> com.link.model.rulehome.service.wsclient.RuleImporterProcess does not
> implement the process method.
> [junit] at
>
> org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:68)
> [junit] at
>
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.bindOperation(JaxWsServiceFactoryBean.java:280)
> [junit] at
>
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:254)
> [junit] at
>
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:652)
> [junit] at
>
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:289)
> [junit] at
>
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:393)
> [junit] at
>
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:506)
> [junit] at
>
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:242)
> [junit] at
>
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
> [junit] at
>
> org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
> [junit] at
> org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
> [junit] at
>
> org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:155)
> [junit] at
>
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:153)
> [junit] at
> org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:465)
> [junit] at
> org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:332)
> [junit] ... 34 more
> [junit] Caused by: java.lang.NoSuchMethodException:
>
> com.link.model.rulehome.service.wsclient.RuleImporterProcess.process(com.link.model.rulehome.service.wsclient.Process)
> [junit] at java.lang.Class.getMethod(Class.java:1605)
> [junit] at
>
> org.apache.cxf.jaxws.JAXWSMethodDispatcher.getImplementationMethod(JAXWSMethodDispatcher.java:88)
> [junit] at
>
> org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:55)
> [junit] ... 48 more
>
>
> Unit test Code is:
>
>
> package com.link.rulehome.service;
>
> import com.link.model.rulehome.service.wsclient.RuleImporterProcess;
> import com.link.model.rulehome.service.wsclient.Process;
> import com.link.model.rulehome.service.wsclient.RuleTemplate;
> import com.link.model.rulehome.service.wsclient.RulesResponseType;
>
> import java.net.URL;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Properties;
>
> import javax.ejb.embeddable.EJBContainer;
>
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.xml.ws.Service;
> import javax.xml.namespace.QName;
>
> import junit.framework.TestCase;
>
> public class RuleImporterServiceTest extends TestCase {
>
> private InitialContext initialContext;
>
> protected void setUp() throws Exception {
> Properties properties = new Properties();
> properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
> properties.setProperty("openejb.embedded.remotable", "true");
>
> EJBContainer.createEJBContainer(properties);
> }
>
> /**
> * Create a webservice client using wsdl url
> *
> * @throws Exception
> */
> public void testCalculatorViaWsInterface() throws Exception {
> URL url = new
> URL("http://localhost:8001/SOA/RuleImporterService/client_ep?WSDL");
> QName calcServiceQName = new
> QName("http://xmlns.oracle.com/RuleImporterService/RuleImporterProcess",
> "client_ep");
> Service service = Service.create(url, calcServiceQName);
>
> assertNotNull(service);
>
> Iterator<QName> ite = service.getPorts();// .createCall(port);
>
> while(ite.hasNext()) {
> QName qn = ite.next();
> System.out.println("WS QName : " + qn.getNamespaceURI());
> }
> final RuleImporterProcess rp =
> service.getPort(RuleImporterProcess.class);
> Process payload = new Process();
> payload.setRuleName("Commodity Line Assignment");
> RulesResponseType res = rp.process(payload);
> RulesResponseType.Rules rule = res.getRules();
> List<RuleTemplate> listRule = rule.getRule();
>
> for (RuleTemplate rt : listRule) {
> System.out.println("Rule Name # " + rt.getRuleName());
> }
>
>
> }
> }
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/ServiceConstructionException-Web-Service-unit-testing-is-not-working-in-OpenEJB-4-0-tp4659899.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>