[jboss-user] [JBoss jBPM] - Create own JbpmJsfContext Implementation
Hello, I build my own Workflow application using JBPM and the JSF addon for JBPM (JBPM4JSF). Now I want to create my own implementation of JbpmJsfContext but I saw that in the PhaseListener and in the JbpmActionListener Wrapper not the interface (JbpmJsfContext.class) is expected but the real implementation (JbpmJsfContextImpl.class). This would result in a class cast exception when I put my own JbpmJsfContext implementation in the request map. Also I can't extend JbpmJsfContextImpl because it is final. So why they are using the implementation when there is an interface. I think that makes no sence. Kind regards, Marco. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4168102#4168102 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4168102 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBossWS] - Re: Problem with inheritance and JBossWS
I have testet a little bit more and now I have a little example that I can deploy. I also startet with the wsdl file and used wsconsume to create the java classes and annotation. Then I copied these classes in my project and so the deployment was successful. But when I access the deployed webservice I am getting a ClassCastException during the request. Below I list my classes: ClassA | @XmlAccessorType(XmlAccessType.FIELD) | @XmlType(name = classA, propOrder = { | propA | }) | public class ClassA { | | private String propA; | | public ClassA() { | } | | public String getPropA() { | return propA; | } | | public void setPropA(String propA) { | this.propA = propA; | } | | } | ClassB | @XmlAccessorType(XmlAccessType.FIELD) | @XmlType(name = classB, propOrder = { | propB | }) | public class ClassB extends ClassA { | private String propB; | public ClassB() { | } | | public String getPropB() { | return propB; | } | | public void setPropB(String propB) { | this.propB = propB; | } | } | ClassC | @XmlAccessorType(XmlAccessType.FIELD) | @XmlType(name = classC, propOrder = { | propC | }) | public class ClassC extends ClassB { | | private String propC; | public ClassC() { | } | | public String getPropC() { | return propC; | } | | public void setPropC(String propC) { | this.propC = propC; | } | } | GetClassBResponse | @XmlAccessorType(XmlAccessType.FIELD) | @XmlType(name = getClassBResponse, propOrder = { | someElement, | data | }) | public class GetClassBResponse { | | @XmlElementRef(name = someElement, type = JAXBElement.class) | protected JAXBElementString someElement; | @XmlElement(required = true, nillable = true) | protected ClassB data; | | public JAXBElementString getSomeElement() { | return someElement; | } | | public void setSomeElement(JAXBElementString value) { | this.someElement = ((JAXBElementString ) value); | } | | public ClassB getData() { | return data; | } | | public void setData(ClassB value) { | this.data = value; | } | } | SampleWSWithDocument_Bare | @WebService() | @SOAPBinding( style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE ) | public class SampleWSWithDocument_Bare { | | public SampleWSWithDocument_Bare() { | } | | @WebMethod() | public GetClassBResponse getClassCAsClassB() { | System.out.print(getClassCAsClassB); | ClassC classC= new ClassC(); | classC.setPropA(propA); | classC.setPropB(propB); | classC.setPropC(propC); | | GetClassBResponse resp = new GetClassBResponse(); | resp.setData(classC); | | ObjectFactory fact = new ObjectFactory(); | resp.setSomeElement(fact.createGetClassBResponseSomeElement(Test)); | return resp; | } | } | ObjectFactory | @XmlRegistry | public class ObjectFactory { | | private final static QName _GetClassCAsClassBResponse_QNAME = new QName(http://ws.examples.mstrauch/;, getClassCAsClassBResponse); | private final static QName _GetClassBResponseSomeElement_QNAME = new QName(http://ws.examples.mstrauch/;, someElement); | | public ObjectFactory() { | } | | public ClassA createClassA() { | return new ClassA(); | } | | public ClassC createClassC() { | return new ClassC(); | } | | public ClassB createClassB() { | return new ClassB(); | } | | public GetClassBResponse createGetClassBResponse() { | return new GetClassBResponse(); | } | | @XmlElementDecl(namespace = http://ws.examples.mstrauch/;, name = getClassCAsClassBResponse) | public JAXBElementGetClassBResponse createGetClassCAsClassBResponse(GetClassBResponse value) { | return new JAXBElementGetClassBResponse(_GetClassCAsClassBResponse_QNAME, GetClassBResponse.class, null, value); | } | | @XmlElementDecl(namespace = http://ws.examples.mstrauch/;, name = someElement, scope = GetClassBResponse.class) | public JAXBElementString createGetClassBResponseSomeElement(String value) { | return new JAXBElementString(_GetClassBResponseSomeElement_QNAME, String.class, GetClassBResponse.class, value); | } | } | Now I get follow error message during request. 08:59:41,554 ERROR [SOAPFaultHelperJAXWS] SOAP request exception javax.xml.soap.SOAPException: java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl at javax.xml.soap.SOAPFactory.newInstance(SOAPFactory.java:68) at
[jboss-user] [JBossWS] - Re: Problem with inheritance and JBossWS
I tried to create an own JAXBElement as you described. But I am getting errors when I deploy it. First I create an ObjectFactory for someElement: | @XmlRegistry | class ObjectFactory { | | @XmlElementDecl(scope=getClassBResponse.class, name=someElement, namespace=http://some.namespace.com;) | JAXBElementString createSomeElement(String s) { | return new JAXBElementString(new QName(someElement), String.class, s); | } | } | Then I defined the JAXBElement in my response class | @XmlAccessorType(XmlAccessType.FIELD) | @XmlType(name = getClassBResponse, namespace=http://mstrauch.examples.ws/;, propOrder = { data, someElement }) | public class getClassBResponse { | | @XmlElementRef(name = someElement, namespace = http://some.namespace.com;, type = JAXBElement.class) | protected JAXBElementString someElement; | | @XmlElement(required = true, nillable = true) | protected ClassB data; | | public getClassBResponse() { | } | | public ClassB getData() { | return data; | } | | public void setData(ClassB data) { | this.data = data; | } | | } | During deployment I am getting a ClassCastException: org.jboss.deployment.DeploymentException: Cannot start service endpoint; - nested throwable: (java.lang.ClassCastException: mstrauch.examples.ws.jaxws.GetClassCAsClassBResponse$JaxbAccessorM_getReturn _setReturn_mstrauch_examples_ws_types_ClassB) at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53) at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:101) at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188) at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy46.start(Unknown Source) at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782) at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210) at $Proxy9.deploy(Unknown Source) at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421) at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274) at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225) Caused by: java.lang.ClassCastException: mstrauch.examples.ws.jaxws.GetClassCAsClassBResponse$JaxbAccessorM_getReturn_setReturn_mstrauch_examples_ws_types_ClassB at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.instanciate(OptimizedAccessorFactory.java:151) at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:96) at com.sun.xml.bind.v2.runtime.reflect.Accessor$GetterSetterReflection.optimize(Accessor.java:308) at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.(SingleElementNodeProperty.java:53) at sun.reflect.GeneratedConstructorAccessor62.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at
[jboss-user] [JBossWS] - Problem with inheritance and JBossWS
I have a problem with the new JBossWS-1.2.1.GA in JBoss 4.2.0.GA and inheritance. To describe this problem first I have to describe my code structure: For an example I have three classes (ClassA, ClassB and ClassC). ClassC inherits of ClassB and ClassB inherits of ClassA (ClassA -- ClassB -- ClassC). Now I have a webservice method that returns ClassB. In this method an instance of ClassC is being created and returned. This was not a problem in the former JBossWS version (and also in the other J2EE 4 styled webservices) but now in JBossWS 1.2 I only get returned an object of ClassB but I supposed to get an obejct of ClassC. | public class ClassA { | private String propA; | | // here setter and getter for propA | .. | } | | public class ClassB extends ClassA { | | private String propB; | // here setter and getter for propB | .. | } | | public class ClassC extends ClassC { | private String propC; | // here setter and getter for propC | .. | } | | @WebService | @SOAPBinding( style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED ) | public class MyWebService { | | @WebMethod() | public ClassB getClassB() { |ClassC classC = new ClassC(); |classC.setPropA(propA); |return classC; | } | | /** |* -- this method is only used to publish ClassC otherwise it is not known |* in this webservice |*/ | @WebMethod() | public ClassC getClassC() { |ClassC classC = new ClassC(); |classC.setPropA(propA); |return classC; | } | | } | | } Now I call getClassB() and the result that I got is an object of ClassB and not of ClassC. What can I do to get an object of ClassC. I also looked at the returned SOAP message and there you can see that only informations about the ClassB instance are submitted. In JBoss 4.0.5 (JBossWS1.0.3) the SOAP message contains the type of the returned object and all data are being submitted correctly. I also tried the SOAP parameter style BARE but nothing changed. And whenI use RPC/Literal then I get an error in the .NET Client that an instance of ClassB was expected but got an instance of ClassC. I also tried it with a JAVA client but there was the same occurance. Any help would be appreciated! Marco. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4051611#4051611 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4051611 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user