[JBoss AOP] - Re: maven-plugin
by avihaimar
Thanks a lot.
The problem that i intreduce is a little different.
In the example that you wrote modue2 depend on module1, and class in module2 intercept by interceptor in module1.
In my question module2 depend on module1 (model), but classes in module1 intercept by module2 , the problem (or what i think can be a problem ) is that module1 dont "know" the interceptor classes.
This problem can be in any system that use in "model event driven" the mode fire an event to server classses, so i need to add pointcut on model classes which intercept by server classes.
No i do it with loadtime weaving.
i have ear with 3 jars (the third is aop jar with xml), but i want to do this in compile time.
tahnk you very much.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131355#4131355
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131355
18 years, 2 months
[JBossWS] - Type mapping trouble with JAX-WS and EJB3
by JoPe
I'm trying to write my first own webservice using EJBs (V3) in a JBoss 4.2.2. Building and deploying the webservice bean works fine, but when I try to access a web method with no parameters and no return type like this:
package test.de.laliluna.library;
| import java.net.URL;
| import javax.xml.namespace.QName;
| import javax.xml.rpc.Service;
| import javax.xml.rpc.ServiceFactory;
| import de.laliluna.library.BookTestBean;
|
| public class WebServiceTestClient
| {
| public static void main(String[] args) throws Exception
| {
| URL url = new URL("http://localhost:8080/FirstEjb3Tutorial/BookTestBean?wsdl");
| QName qname = new QName("http://library.laliluna.de/", "BookTestBeanService");
| ServiceFactory factory = ServiceFactory.newInstance();
| Service service = factory.createService(url, qname);
|
| BookTestBean serviceEndpoint = (BookTestBean)service.getPort(BookTestBean.class);
| serviceEndpoint.test();
| }
| }
it throws this exception:
Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://library.laliluna.de/}test
| at org.jboss.ws.metadata.builder.jaxrpc.JAXRPCMetaDataBuilder.processDocElement(JAXRPCMetaDataBuilder.java:627)
| ...
| at test.de.laliluna.library.WebServiceTestClient.main(WebServiceTestClient.java:18)
where the last line refers to "Service service = factory.createService(url, qname);"
My questions are:
1. I thought using JAX-WS and Annotations would take care of all the webservice-configuration-XML-SOAP stuff for me. Do I still need to manually specify a type mapping? How? Where?
2. The web method I try to access has neither parameters nor a return value. How can there be any types to map??
If you could make me friends with webservices again, they and I would really appreciate it.
>From here: Server code.
package de.laliluna.library;
| import java.rmi.Remote;
| import java.util.Iterator;
| import java.util.List;
| import javax.ejb.Stateless;
| import javax.jws.Oneway;
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| @Stateless
| @WebService
| public class BookTestBean implements BookTestBeanLocal, BookTestBeanRemote, Remote
| {
| @PersistenceContext
| EntityManager em;
| public static final String RemoteJNDIName = BookTestBean.class.getSimpleName() + "/remote";
| public static final String LocalJNDIName = BookTestBean.class.getSimpleName() + "/local";
|
| @WebMethod
| @Oneway
| public void test()
| {
| Book book = new Book(null, "My first bean book", "Sebastian");
| em.persist(book);
| Book book2 = new Book(null, "another book", "Paul");
| em.persist(book2);
| Book book3 = new Book(null, "EJB 3 developer guide, comes soon", "Sebastian");
| em.persist(book3);
| System.out.println("list some books");
| List someBooks = em.createQuery("from Book b where b.author=:name").setParameter("name", "Sebastian")
| .getResultList();
| for(Iterator iter = someBooks.iterator(); iter.hasNext() ;)
| {
| Book element = (Book)iter.next();
| System.out.println(element);
| }
| System.out.println("List all books");
| List allBooks = em.createQuery("from Book").getResultList();
| for(Iterator iter = allBooks.iterator(); iter.hasNext() ;)
| {
| Book element = (Book)iter.next();
| System.out.println(element);
| }
| System.out.println("delete a book");
| em.remove(book2);
| System.out.println("List all books");
| allBooks = em.createQuery("from Book").getResultList();
| for(Iterator iter = allBooks.iterator(); iter.hasNext() ;)
| {
| Book element = (Book)iter.next();
| System.out.println(element);
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131354#4131354
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131354
18 years, 2 months
[JBoss jBPM] - StaleObjectStateException in a Fork with states
by jfbenck
Hi,
I'm working a jBPM implementation with the following characteristics:
1) All calls go to external systems, so we use states for modeling the different steps.
2) We might be using forks in our processes, which thus contain states.
3) The external systems store their reply in a variable attached to a token.
Without the usage of forks, jBPM works fine. I've been creating some tests to simulate the behaviour of our backend systems by using various threads. Whenever two or more threads within a fork try to signal their respective token at the same time, the second thread throws a hibernate StateObjectStateException when calling JbpmContext.close().
To signal jBPM to continue processing of a state from the external system (simulated by the thread) we use the following code:
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| ProcessInstance processInstance = jbpmContext.getProcessInstance(callInfo.getProcessid());
| Token token = jbpmContext.getTokenForUpdate(callInfo.getTokenid());
| token.setProcessInstance(processInstance);
| processInstance.getContextInstance().addVariables(contextData,token);
|
| token.signal();
| } finally {
| jbpmContext.close();
| }
|
I have to do token.setProcessInstance(), as the process instance == null when calling getTokenForUpdate(), which results in a NPE on token.signal().
I've been looking through mailing lists, documentation and Google to find any info about this problem. Unfortunately to no avail. I've got the following questions:
1) Is my process instance/token retrieval code correct? The jBPM examples which some with the source only contain a quick-and-dirty solution?
2) Should I take care of synchronization myself or is jBPM supposed to handle this (as I expect) and have I run into a bug?
Thanks for your time.
Jeroen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131342#4131342
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131342
18 years, 2 months