[JBoss jBPM] - How to call Seam SLSB from a jbpm-invoked action?
by brombie
Hi all,
I posted this question at seamframework.org forum but haven't seen any answers so I'm trying my luck in this forum.
My seam project has the jbpm module enabled and I'm wondering how I can get my jbpm action handler to access a Seam component/object.
For example, in my jpdl, I have a transition which has an action handler pointing to test.transitionHandler class.
Inside the transitionHandler.class, I have something like below.
Component comp = Seam.componentForName("fruitManager");
| assert comp !=null;
| FruitManager fm= (FruitManager) comp.newInstance();
| fm.updateDescription(1, "Apple");
fruitManager is a name of a SLSB. updateDescription() simply updates the description field of the Fruit bean and persist it.
When executed, here's the stack trace that shows:
17:53:34,406 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
| 17:53:34,406 ERROR [JDBCExceptionReporter] Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fffd:da4:47f28229:3b9 status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: -3f57fffd:da4:47f28229:3b9 status: ActionStatus.ABORT_ONLY >))
| 17:53:34,406 INFO [DefaultLoadEventListener] Error performing load command
| org.hibernate.exception.GenericJDBCException: Cannot open connection
| at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
| at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
| at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
| at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
| at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
| at org.hibernate.loader.Loader.doQuery(Loader.java:673)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
| at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
| at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
| at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
| at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
| at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
| at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
| at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
| at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)
| at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)
| at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
| at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
| at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
| at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:174)
| at org.jboss.ejb3.entity.TransactionScopedEntityManager.find(TransactionScopedEntityManager.java:171)
| at org.jboss.seam.persistence.EntityManagerProxy.find(EntityManagerProxy.java:85)
| at test.FruitManagerBean.updateDescription(ImageTicketManagerBean.java:739)
Note that the Seam application and JBPM are using different database schema. They're also both configured to use XA transactions/driver.
Thanks for your help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140761#4140761
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140761
18 years
[JBossWS] - please help - web services still dont work for me - jboss as
by wiggy
thought i'd have one last go
downloaded jboss As5b4. configured eclipse 3.3 with default 5.0 server (basic one)
deployed ejb3 webservice as ejb file to server and checked wsdl generated. used wsconsume to gen client artifacts and imported into standalone application client project. All compiles.
client looks like this - cant get much easier
|
| package test;
|
| import java.util.Hashtable;
|
| import javax.naming.InitialContext;
|
| import org.wstest.webservices.*;
|
| public class Test {
|
| /**
| * @param args
| */
| public static void main(String[] args) throws Exception
| {
|
| InitialContext ctx;
| // TODO Auto-generated method stub
|
|
| HelloService s = new HelloService();
| HelloServiceWS ws = s.getHelloServiceWSPort();
|
|
|
| String res = ws.sayHello();
| System.out.println ("test: returned " + res + " \n");
|
| }
|
generated wsdl at server looks like
|
| - <definitions name="HelloService" targetNamespace="http://webservices.wstest.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservices.wstest.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| - <types>
| - <xs:schema targetNamespace="http://webservices.wstest.org/" version="1.0" xmlns:tns="http://webservices.wstest.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
| <xs:element name="sayHello" type="tns:sayHello" />
| <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
| - <xs:complexType name="sayHello">
| <xs:sequence />
| </xs:complexType>
| - <xs:complexType name="sayHelloResponse">
| - <xs:sequence>
| <xs:element minOccurs="0" name="helloResult" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| - <message name="HelloServiceWS_sayHello">
| <part element="tns:sayHello" name="sayHello" />
| </message>
| - <message name="HelloServiceWS_sayHelloResponse">
| <part element="tns:sayHelloResponse" name="sayHelloResponse" />
| </message>
| - <portType name="HelloServiceWS">
| - <operation name="sayHello" parameterOrder="sayHello">
| <input message="tns:HelloServiceWS_sayHello" />
| <output message="tns:HelloServiceWS_sayHelloResponse" />
| </operation>
| </portType>
| - <binding name="HelloServiceWSBinding" type="tns:HelloServiceWS">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
| - <operation name="sayHello">
| <soap:operation soapAction="" />
| - <input>
| <soap:body use="literal" />
| </input>
| - <output>
| <soap:body use="literal" />
| </output>
| </operation>
| </binding>
| - <service name="HelloService">
| - <port binding="tns:HelloServiceWSBinding" name="HelloServiceWSPort">
| <soap:address location="http://127.0.0.1:8080/wstest-ejb/HelloService" />
| </port>
| </service>
| </definitions>
|
run the test and get
| Exception in thread "main" javax.xml.ws.WebServiceException: Unable to load Provider: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl
| at javax.xml.ws.spi.Provider.provider(Provider.java:90)
| at javax.xml.ws.Service.<init>(Service.java:82)
| at org.wstest.webservices.HelloService.<init>(HelloService.java:40)
| at test.Test.main(Test.java:21)
| Caused by: java.lang.IllegalStateException: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl
| at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:96)
| at javax.xml.ws.spi.Provider.provider(Provider.java:82)
| ... 3 more
| Caused by: java.lang.ExceptionInInitializerError
| at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
| at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
| at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
| at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
| at java.lang.Class.newInstance0(Class.java:350)
| at java.lang.Class.newInstance(Class.java:303)
| at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:91)
| ... 4 more
| Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference.
| at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:188)
| at com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:65)
| ... 11 more
| Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
| Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.
| this problem is related to the following location:
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
| at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| this problem is related to the following location:
| at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
| at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
| at javax.xml.ws.wsaddressing.W3CEndpointReference
| Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.
| this problem is related to the following location:
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
| at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
| at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| this problem is related to the following location:
| at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
| at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
| at javax.xml.ws.wsaddressing.W3CEndpointReference
|
| at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
| at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
| at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
| at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
| at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
| at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
| at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
| at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
| at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:186)
| ... 12 more
|
please help i really want this to work so i can get back to my business problem - and not spend time trashing in frameworks.
doesnt work on 4.2.2 either
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140760#4140760
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140760
18 years
[JBossWS] - Basic Authentication
by jmoring
I have a custom login module that works just fine on non-web service applications. However on web service (EJB endpoint) it is called just fine but the callback handler for the user name always returns null. I have tried annotations (@SecurityDomain, @WebContext) and I have tried using a jboss.xml but nothing seems to work.
I have verified that the .NET 2.0 and/or .NET 3.5 client is sending the Authorization http header.
What is the secret here!!!!
package com.xxxxxxxx.ws.autopilot;
import javax.annotation.security.*;
import javax.ejb.*;
import javax.jws.*;
import javax.jws.soap.*;
import org.jboss.annotation.security.*;
import org.jboss.ws.annotation.*;
@Stateless
@SecurityDomain(value="MyLoginModule")
@WebService
(
name="Autopilot",
targetNamespace = "http://opas.xxxxxxxxx.net/Xxxxxxxxxxxx",
serviceName = "AutopilotService"
)
@RolesAllowed("Everyone")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebContext(contextRoot="/Autopilot", urlPattern="/*", authMethod="BASIC", transportGuarantee="NONE", secureWSDLAccess=false)
public class Autopilot
{
@WebMethod
@PermitAll
public String ping( String Value )
{
return Value.toUpperCase();
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140751#4140751
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140751
18 years