[EJB 3.0] - Circular call of beans, transaction context
by beep_beep
I have 3 SfSB : A,B,C
Bean A has method getBean(Class),
this getBean(B.class) returns bean B,
then I call method doSomthing() on B, this method doSomthing has
@TransactionAttribute(TransactionAttributeType.REQUIRED)
and doSomthing calls A.getBean(C.class) to achive C.
In this example bean A is factory, which is accessible from all beans and provides reference from one bean to another.
I tried to assign ALL existent attributes "TransactionAttribute" on method getBean(Class), but anyway I have this exception:
On this last call exception happens:
anonymous wrote : javax.ejb.EJBException: java.lang.RuntimeException: cannot import a transaction context when a transaction is already associated with the thread
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:308)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:104)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
| at org.jboss.remoting.transport.local.LocalClientInvoker.invoke(LocalClientInvoker.java:72)
| at org.jboss.remoting.Client.invoke(Client.java:525)
| at org.jboss.remoting.Client.invoke(Client.java:488)
| at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
| at org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:133)
| at $Proxy87.create(Unknown Source)
| .......
What happen here? Any attribute on getBean does not help!
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956854#3956854
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956854
18 years, 5 months
[JBossWS] - problem on invoking WS
by cisco
I have written a WebService on JBoss 4.0.4 GA (jboss-EJB-3.0_RC8-FD + jbossws-1.0.1.GA)
| package webservices;
|
| import java.rmi.Remote;
|
| public interface SimpleService extends Remote {
| String echo(String echo);
| }
|
| package webservices;
|
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
| import javax.jws.WebMethod;
| import javax.jws.WebService;
|
| import org.jboss.ws.annotation.PortComponent;
|
| @WebService(name="EndpointInterface", targetNamespace="http://localhost", serviceName="SimpleService")
| @PortComponent(contextRoot="/jbosswstest", urlPattern="/*")
| @Remote(SimpleService.class)
| @Stateless
| public class SimpleServiceImpl implements SimpleService {
| @WebMethod
| public String echo(String input) {
| return input;
| }
| }
|
After deploy it to JBoss, I got a auto-generated WSDL as follow:
| <definitions name='SimpleService' targetNamespace='http://localhost' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://localhost' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <schema elementFormDefault='qualified' targetNamespace='http://localhost' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://localhost' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <complexType name='echo'>
| <sequence>
| <element name='String_1' nillable='true' type='string'/>
| </sequence>
| </complexType>
| <complexType name='echoResponse'>
| <sequence>
| <element name='result' nillable='true' type='string'/>
| </sequence>
| </complexType>
| <element name='echo' type='tns:echo'/>
| <element name='echoResponse' type='tns:echoResponse'/>
| </schema>
| </types>
| <message name='EndpointInterface_echo'>
| <part element='tns:echo' name='parameters'/>
| </message>
| <message name='EndpointInterface_echoResponse'>
| <part element='tns:echoResponse' name='result'/>
| </message>
| <portType name='EndpointInterface'>
| <operation name='echo'>
| <input message='tns:EndpointInterface_echo'/>
| <output message='tns:EndpointInterface_echoResponse'/>
| </operation>
| </portType>
| <binding name='EndpointInterfaceBinding' type='tns:EndpointInterface'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='echo'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='SimpleService'>
| <port binding='tns:EndpointInterfaceBinding' name='EndpointInterfacePort'>
| <soap:address location='http://ibm-t40:8080/jbosswstest'/>
| </port>
| </service>
| </definitions>
|
Then I try to code a client to invoke the webservice:
| package client;
|
| import java.net.URL;
|
| import javax.xml.namespace.QName;
| import javax.xml.rpc.Service;
| import javax.xml.rpc.ServiceFactory;
|
| import webservices.SimpleService;
|
| public class SimpleServiceClient {
| private static final String _namespace = "http://localhost";
|
| private static final String _service = "SimpleService";
|
| private static final String _wsdl = "http://localhost:8080/jbosswstest?wsdl";
|
| public static void main(String[] args) {
| try {
| URL defUrl = new URL(_wsdl);
| // Create the service factory
| ServiceFactory serviceFactory = ServiceFactory.newInstance();
| // Load the service implementation class
| Service remoteService = serviceFactory.createService(defUrl,
| new QName(_namespace, _service));
| // Load a proxy for our class
| SimpleService invoker = (SimpleService) remoteService
| .getPort(SimpleService.class);
| // Invoke our interface for each argument
| for (int i = 0; i < args.length; i++) {
| String returnedString = invoker.echo(args);
| System.out.println("sent string: " + args
| + ", received string: " + returnedString);
| }
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
Here comes the problem ->
org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://localhost}echo
at org.jboss.ws.deployment.JSR109MetaDataBuilder.buildParameterMetaDataDoc(JSR109MetaDataBuilder.java:450)
at org.jboss.ws.deployment.JSR109MetaDataBuilder.setupOperationsFromWSDL(JSR109MetaDataBuilder.java:200)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaDataInternal(JSR109ClientMetaDataBuilder.java:208)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:126)
at org.jboss.ws.deployment.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:82)
at org.jboss.ws.jaxrpc.ServiceImpl.(ServiceImpl.java:96)
at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
at client.SimpleServiceClient.main(SimpleServiceClient.java:24)
Could somebody give me a idea what's wrong, thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956847#3956847
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956847
18 years, 5 months