[jBPM] - JBPM 4.4 and Spring 3
by Donald Walters
Donald Walters [http://community.jboss.org/people/dondragon2] created the discussion
"JBPM 4.4 and Spring 3"
To view the discussion, visit: http://community.jboss.org/message/560650#560650
--------------------------------------------------------------
For days now I am struggling with this issue of integrating Spring 3 and JBPM 4.
Apparently the application fails each time when I try to perform an action on one of the services, such as the repository service or the execution service.
By doing form search I found out that there is a documented issue JBPM-2710.
I have tried the solution as documented below.
http://diversit.eu/2010/01/10/jbpm-4-3-with-spring/comment-page-1/#commen... http://diversit.eu/2010/01/10/jbpm-4-3-with-spring
still the problem persists. I tried to step through the code and I found that the issue is in the SpringTransactionIntercepter. Apparently no matter what I set in the jbpm.cfg.xml the transactionName is always null.
JBPM CFG
===========
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<process-engine-context>
<!-- Default command service has a Spring transaction interceptor-->
<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
<spring-transaction-interceptor
policy="requiresNew" transaction-manager="hibernateTransactionManager" />
</command-service>
<command-service name="txRequiredCommandService">
<retry-interceptor />
<environment-interceptor />
<spring-transaction-interceptor transaction-manager="hibernateTransactionManager" />
</command-service>
</process-engine-context>
<transaction-context>
<transaction type="spring" />
<hibernate-session current="true" />
</transaction-context>
<!-- <process-engine-context>
<string name="spring.cfg" value="workflow.cfg.xml" />
</process-engine-context>-->
</jbpm-configuration>
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />
<process-engine-context>
<!-- Default command service has a Spring transaction interceptor-->
<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
<spring-transaction-interceptor
policy="requiresNew" transaction-manager="hibernateTransactionManager" />
</command-service>
<command-service name="txRequiredCommandService">
<retry-interceptor />
<environment-interceptor />
<spring-transaction-interceptor transaction-manager="hibernateTransactionManager" />
</command-service>
</process-engine-context>
<transaction-context>
<transaction type="spring" />
<hibernate-session current="true" />
</transaction-context>
</jbpm-configuration>
Spring Config
=================
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="com.cavet.core.jbpm"/>
<bean id="jbpmSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>jbpm.repository.hbm.xml</value>
<value>jbpm.execution.hbm.xml</value>
<value>jbpm.history.hbm.xml</value>
<value>jbpm.task.hbm.xml</value>
<value>jbpm.identity.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</props>
</property>
</bean>
<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="jbpmSessionFactory" />
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
Class
=============
...
@Autowired
@Qualifier("jbpmExecutionService")
private ExecutionService executionService;
...
executionService.startProcessInstanceByKey(name, variables); <----nothing happens here and in the spring intercepter
Please help me in trying to resolve this. Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/560650#560650]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months
[JBoss Tools] - Create Eclipse Ecore (EMF) Models manually
by Andre Dietisheim
Andre Dietisheim [http://community.jboss.org/people/adietish] modified the document:
"Create Eclipse Ecore (EMF) Models manually"
To view the document, visit: http://community.jboss.org/docs/DOC-15705
--------------------------------------------------------------
h1. Forewords
EMF provides a runtime and tools that allow you to create ecore object models. The starting point is a model definition. It may be created out of a XML Schema (XSD), annotated java classes, etc. but you will mostly craft one by hand. This document attempts to describe the process involved in the later. It will show you the basic steps to create an ecore model implementation and give you some more advanced hints here and there.
There are a few tutorials available on http://www.eclipse.org/modeling/emf/docs/#tutorials eclipse.org, the best one (to my eyes's) the one provided by http://www.vogella.de/articles/EclipseEMF/article.html Lars Vogella.
h1. Get started, create an EMF Project
To get started, create an *Empty EMF project*.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-533... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
You'll get a new project, that's set up to work with the EMF framework.
What's pops to your eyes is that there's a *model* directory in this project. That´s the folder that will hold the ecore files, the model definitions (not a must but a standard so far).
h1. Create a Model Definition
Create a new *Ecore Model* file to the model folder by selecting it and invoking the new ecore model wizard.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-533... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
h1. Create a Package
We created an empty ecore model so far. The wizard opened the model in an new editor when all steps were achieved. The ecore file already has an empty, unnamed package. Your task is to give it a name, set its Ns URI and prefix.
> * *name*: a simple term (not required to be unique)
> * *Ns prefix*: ~shoretened 'java package' name (not required to be unique)
> * *Ns URI*: some real (or bogus) unique URI where the scheme might be found.
>
Eclipse uses the *Sample Ecore Model Editor* by default. But there are other editors that you may use. There are text based editors like http://wiki.eclipse.org/Emfatic Emfatic or http://www.eclipse.org/Xtext/ Xtext. Eclipse http://www.eclipse.org/MoDisco/ Modisco also has a powerful http://wiki.eclipse.org/MoDisco/ModelBrowser Ecore tree based editor. If you prefer to manipulate diagrams you may use the http://www.eclipse.org/modeling/emft/?project=ecoretools Ecore Diagram Editor or http://www.soyatec.com/euml2/ eUML2.
h3. Example: org.eclipse.emf.cdo.ui.defs
I have a plugin/module in cdo called *org.eclipse.emf.cdo.ui.defs* The Ecore model for it has the following declarations:
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-538... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
> * *name*: defs
> * *Ns prefix*: cdo.ui.defs
> * *Ns URI*: http://www.eclipse.org/emf/CDO/ui/defs/1.0.0 http://www.eclipse.org/emf/CDO/ui/defs/1.0.0
>
h1. Add Classes
You are now ready to create classes in your package. Select your package and use the context menu to create a new *EClass*. Go to the properties view and set its *Name* to *EditorDef*. You may also create another class called *Def* let EditorDef extend it. You achieve this if you add it to EditorDefs *ESuper Types*.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-538... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
The classes you created will get generated in a later step. You'll get an interface *EditorDef*.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-538... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
And an Implementation *EdiotrDefImpl*.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-539... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
h1. No POJO?
If you track the supertype hierarchy you'll notice that your ecore classes extend http://download.eclipse.org/modeling/emf/emf/javadoc/2.5.0/index.html?org... *EObject*. A quick look at the http://download.eclipse.org/modeling/emf/emf/javadoc/2.5.0/org/eclipse/em... EObject class diagram may help you get in touch with the classes the EMF runtime provides.
EObjects offer various capabilities that are not (or at least at high cost) offered with plain POJOs. Extending EObjects in your model classes offers you all these capabilities free of charge:
> * *serialization* (XML, XMI, binary, database based persistence, etc.)
> * *change propagation*
> * ** *validation*
> * ** *object* *query*
> * ** etc.
>
Furthermore the EMF ecosystem holds plenty of frameworks that extend it in various areas. Using EObject based POJOs allows you to take advantage of all these powerful frameworks.
A disadvantage is that EMF's pretty invasive. You get all its power, but you mostly have to stick to EObjects. This usually isn't prroblematic in client (aka Eclipse IDE/RCP or other RCP platforms) projects, but might be a problem in server side projects. You may tell the generator http://wiki.eclipse.org/EMF/Recipes#Recipe:_Generating_Pure_API_With_No_V... not to extend EObjects, but you'll loose all benefits the powerful EMF runtime offers to you. Another solution emerged lately with Eclipse http://martintaal.wordpress.com/2010/05/18/introducing-the-texo-project/ Texo. Texo generates plain POJOs and offers a runtime that unleasehes most of the emf runtime capabilities.
h1. All Ways lead to Rome
There are usually several ways to get to the desired result (aka generated java code). The best way to find out about them is to trial and error or get deeper knowledge in the http://www.amazon.com/EMF-Eclipse-Modeling-Framework-2nd/dp/0321331885/re... Eclipse Modeling Framework book.
A rule of thumb is to have all referenced classes available in your model definition. This is evident for ecore classes. But if your ecore classes use references to plain java types (that are not part of your ecore model in the strict sense) you'll have to declare those java types in the ecore model. In other words, the ecore model needs to know about all types (ecore or plain java) that are part of your model.
h3. Example: Use EDataTypes for Java types
Let's say that my modeled class CDOEditorDefs has a method execute() that throws an ExecutionException. I could add that method by hand but as a matter of taste I prefer to declare that method in my model.
My model does not know anything about this exception so far, so there's no way to get the correct signature generated out of the box . I'll therefore have to declare this exception in model. I create a DataType *ExecutionException*.
Create an EDataType:
http://community.jboss.org/servlet/JiveServlet/showImage/4911/declare-dat... http://community.jboss.org/servlet/JiveServlet/downloadImage/4911/declare...
Give it an *Instance Type Name* so it won't be generated but my models may use references to it:
http://community.jboss.org/servlet/JiveServlet/showImage/4913/declare-exe... http://community.jboss.org/servlet/JiveServlet/downloadImage/4913/declare...
Set the execute method (operation) to *throw the ExecutionException*:
http://community.jboss.org/servlet/JiveServlet/showImage/4914/declare-thr... http://community.jboss.org/servlet/JiveServlet/downloadImage/4914/declare...
The generated method now throws the given Exception:
http://community.jboss.org/servlet/JiveServlet/showImage/4915/generated-t... http://community.jboss.org/servlet/JiveServlet/downloadImage/4915/generat...
h3. Example: Use EClass for Java Interfaces
A very common problem is to have modeled (ecore-) classes that shall extend Java Interfaces. Let's say that I want EditorDef (an ecore class) to implement *java.lang.Comparable*.
** The former example used a EDataType to declare an external type to the ecore model. Interfaces are modeled as supertypes in EMF. EDataTypes cannot be supertypes to ecore classes.I therefore have to declare an *eclass* for my additional interface. *instance type name* will - like in the former example - ensure that no artifact gets generated.
I declare the *Comparable* Interface:
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-539... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
and add it to the *supertypes* of EditorDef:
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-687... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
The (generated) java interface will now *extend* Comparable:
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-539... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
h1. Get prepared to generate code, create a Genmodel
This is mostly straight forward. Select the ecore file and create a genmodel for it. Select your ecore file and start a new *EMF Generator Model* wizard. The wizard will allow you to create a so called Generator Model that holds all settings which are important to the code generation process.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-533... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
There are 2 settings that might be of interest to you:
> '*All*' (property group when the package is selected):
>
> * *Base Package*: the base package all ecore classes get generated to
> * *Prefix*: Prefix that the factory- and package-class get
>
http://community.jboss.org/servlet/JiveServlet/showImage/102-15705-25-533... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15705-25...
h3. Example: org.eclipse.emf.cdo.ui.defs
> *Base Package*: org.eclipse.emf.cdo.ui
> *Prefix*: CDOUIDefs
Package-class gets *CDOUIDefsPackage*, Factory gets *CDOUIDefsFactory*, etc. All classes get generated to the *package org.eclipse.emf.cdo.ui*
h2. Set Packages for Implementations and Interfaces, change Class- and Interface Names
Further modifications you might be interested in are the package names for implementations and interfaces (the defaults creates an 'impl' package where it puts all implementation classes). It can be modified by selecting the '*Package Suffixes*' and selecting the property '*Implementation*'. The same can be achieved for the interfaces package with the property '*Interfaces*'.
The naming of the implementation- and interface-classes may be changed, too. You find those settings if you select the root-node of the tree in the genmodel-editor and choose the '*Model*' property group. You'll find 'Class Name Pattern' and 'Interface Name Pattern' among the available properties. The explanations for the values show up in the statusbar (default is '*{0}impl*' and '*{0}*').
http://community.jboss.org/servlet/JiveServlet/showImage/102-15697-11-484... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15697-11...
Once you're done defining your generator model, you simply need to generate the implementation classes. Select the package you want to generate, right click and select the implementation you want to create. You may choose among the models, the editor, the tests.
http://community.jboss.org/servlet/JiveServlet/showImage/102-15697-11-485... http://community.jboss.org/servlet/JiveServlet/downloadImage/102-15697-11...
h1. Modify the Generated Classes
Ecore is built to be modified, the basic usage-pattern is to code and generate hand-in-hand. To tell the generator not to override your modifications you need to set the javadoc-annotation to anything different than *@generated*. Good practice says that you should set it to '@generated NOT'. Good practice also tells you to annotate any manually added method by *@ADDED*, but its optional though.
There is another handy usage pattern that allows you to replace the generated code with your hand-written one and get the generated one, too. If you want to have your code instead of the generated one, you annotate accordingly (@generated NOT) and the generator will not override it. If you now create a method that uses the same method signature, append "*Gen*" to the method name and annotate it as if it was generated (@generated), the generator will generate its code into this method instead of the one that it would usually generate to.
>
> /**
> * @generated NOT
> */
> public void setName(String name) {
> HANDWRITTEN CODE
> }
>
> /**
> *
> @generated
> */
> public void setNameGen(String name) {
> GENERATED CODE gets generated here
>
After making your modifications, you simply need to re-generate the Ecore classes. (+*How?*+)
h1. Refactor generated Code and Regenerate
The code generator in EMF's is pretty capable when it's up to merge manual code changes in generated code. It respects *@generated* tags and preserves your handwritten code in generated classes.
If you rename a class in your ecore file though, it won't be able to detect your change. EMF has no clue that you renamed ecore class definitions. It will not be able to detect your java files because they have the old name. It will generate new artifacts and merging will not occur. You could copy your changes manually, but this is pretty cumbersome, there's a better approach to this use case:
Refactor/rename the generated java classes in a first step. Rename your ecore class definitions in a second step and regenerate afterwards. EMF will detect the preexisting artifacts and merge your manual code changes with the generated content. You will not have to copy your code manually.
--------------------------------------------------------------
Comment by going to Community
[http://community.jboss.org/docs/DOC-15705]
Create a new document in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=102&co...]
14 years, 3 months
[EJB 3.0] - Ejb3.0 jndi lookup problem
by santhosh pulichinthala
santhosh pulichinthala [http://community.jboss.org/people/santhoshreddy747] created the discussion
"Ejb3.0 jndi lookup problem"
To view the discussion, visit: http://community.jboss.org/message/560400#560400
--------------------------------------------------------------
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb;
import javax.ejb.EJB;
/**
*
* @author santhosh reddy
*/
public class HelloClient {
@EJB
private static StatelessSessionExampleRemote sessionBeanBean;
public static void main(String[] args) {
System.out.println("Displaying Message using EJB:");
System.out.println("=================================");
System.err.println("Name of the Company is : =" + sessionBeanBean.getCompanyname());
System.err.println("Address of the Company is : =" + sessionBeanBean.getAddress());
System.err.println("Message is : =" + sessionBeanBean.getResult());
System.out.println("=================================");
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb;
import javax.ejb.Stateless;
/**
*
* @author santhosh reddy
*/
@Stateless
public class StatelessSessionExample implements StatelessSessionExampleRemote {
// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Business Method")
public String getResult() {
return "Hello World";
}
public String getAddress() {
return "Sec-3,D-16/116,Rohini";
}
public String getCompanyname() {
return "Roseindia.net Pvt.Ltd.";
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejb;
import javax.ejb.Remote;
/**
*
* @author santhosh reddy
*/
@Remote
public interface StatelessSessionExampleRemote {
String getResult();
String getAddress();
String getCompanyname();
}
error log:
============
init:
deps-jar:
compile-single:
run-main:
Displaying Message using EJB:
Exception in thread "main" java.lang.NullPointerException
=================================
at ejb.HelloClient.main(HelloClient.java:22)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
HelloClient.java:22 is
sessionBeanBean.getCompanyname()
i think it is jndi problem.how to setup jndi in 3.0.Actually in 2.0 we will set it in vendor specifiec.xml like jboss.xml.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/560400#560400]
Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months
[Beginner's Corner] - Error initializing socket factory SSL context: Cannot find truststore url.
by dhaval joshi
dhaval joshi [http://community.jboss.org/people/dhaval0129] created the discussion
"Error initializing socket factory SSL context: Cannot find truststore url."
To view the discussion, visit: http://community.jboss.org/message/560473#560473
--------------------------------------------------------------
Hi
I am attaching server.log I keep getting this error as shown below:
I did configure SSL correctly, I am using Jboss 5.1.0. please let me know what needs to be done.
*2010-09-03 12:02:18,726 ERROR [org.jboss.remoting.transport.http.HTTPClientInvoker] (http-0.0.0.0-8443-1) Error creating SSL Socket Factory for client invoker: Error initializing socket factory SSL context: Can not find truststore url.*
2010-09-03 12:01:33,210 INFO [STDOUT] (Timer-2) Small auto-site check is occurring for site: 170
2010-09-03 12:01:33,210 INFO [STDOUT] (Timer-3) Small auto-site check is occurring for site: 159
2010-09-03 12:01:34,117 ERROR [com.icrco.admin] (Timer-3) Connection refused: connect
2010-09-03 12:02:11,085 INFO [STDOUT] (http-0.0.0.0-8443-1) Login Attempt User (admin) FAILED
2010-09-03 12:02:11,117 INFO [STDOUT] (http-0.0.0.0-8443-1) Login Attempt User (admin) PASSED
2010-09-03 12:02:14,038 ERROR [com.icrco.admin] (pool-13-thread-2) Connection refused: connect
2010-09-03 12:02:18,679 INFO [STDOUT] (http-0.0.0.0-8443-1) -------Disabling HTTPS Cert Validation---------
2010-09-03 12:02:18,695 INFO [STDOUT] (http-0.0.0.0-8443-1) Calling remoting server with locator uri of: InvokerLocator [sslservlet://192.168.0.170:8443/servlet-invoker/ServerInvokerServlet]
*2010-09-03 12:02:18,726 ERROR [org.jboss.remoting.transport.http.HTTPClientInvoker] (http-0.0.0.0-8443-1) Error creating SSL Socket Factory for client invoker: Error initializing socket factory SSL context: Can not find truststore url.*
2010-09-03 12:02:20,335 INFO [STDOUT] (Thread-21) Callback Lines: 2
2010-09-03 12:02:30,835 INFO [STDOUT] (Thread-21) Callback Lines: 1
2010-09-03 12:02:39,851 INFO [STDOUT] (Thread-21) Callback Lines: 1
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/560473#560473]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 3 months