[EJB] - Transaction and EJB3 Singleton
by sandello
I have a ejb3 project with managed singleton:
| @Service (name = ProfileStateMachine.NAME, objectName = "vis:service=StateMachine")
| @Management (IMainStateMachine.class)
| @Remote (ProfileStateMachine.class)
| public class MainStateMachine implements IMainStateMachine, ProfileStateMachine {
| @PersistenceContext (unitName = "vis")
| private EntityManager entityManager;
|
| void start(){
| SomeEntity entity1=entityManager.find(SomeEntity.class,2);
|
| SomeEntity entity2=new SomeEntity();
| entity2.setFieldOne("one");
| entity2.setFiledTwo("two");
| entityManager.persist(entity2);
| }
|
| void stop(){
| }
| }
|
interface IMainStateMachine
| public interface IMainStateMachine {
| void start();
|
| void stop();
|
| }
I receive a exception during project deployment
| Caused by: javax.persistence.TransactionRequiredException: EntityManager must be access within a transaction
| at org.jboss.jpa.deployment.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:155)
| at org.jboss.jpa.tx.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:186)
|
The exception is thrown at the persist command
| entityManager.persist(entity2);
|
I think the start() method is executed before the project was deployed. Same operation ("entityManager.persist()") works well if it is executed after deploy.
My project has a three stage: starting, working, stopping. I need to use EntityManager during all stages. What I should do to solve the problem?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269678#4269678
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269678
16 years, 4 months
[jBPM Users] - Re: Console: host not found error
by roger0681
Hi, all
Thanks for your answer, Ronald.
Though I've been searching for information on this fact for a few weeks, I had not reached an answer until now. I accept I'm not really used to JIRAs yet.
After Ronalds response, I started browsing all JIRA issues (not only Console), and found this one in JBPM, issue 2562: "Hard-coded host and port for Tomcat".
You can find https://jira.jboss.org/jira/browse/JBPM-2562
With what Tom comments in that JIRA, I found the JBPM server configuration file at: {JBOSS_HOME}\server\default\deploy\jbpm\jbpm-service.sar\jbpm-service-jboss-beans.xml
In that file, I changed this code:
<bean name="org.jbpm:service=ServerConfig"
| class="org.jbpm.integration.jboss5.mgmt.ServerConfig">
| <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
| <property name="webServiceHost">${jboss.bind.address}</property>
| </bean>
|
to this one (I'm changing webServiceHost property, and adding webServicePort):
| <bean name="org.jbpm:service=ServerConfig"
| class="org.jbpm.integration.jboss5.mgmt.ServerConfig">
| <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
| <property name="webServiceHost">publicIP</property>
| <property name="webServicePort">publicPort</property>
| </bean>
|
And now it is working correctly from outside the router/firewall.
I didn't try it yet, but I suppose that now I will have the previous problem when trying to access this files from inside the network, if that network can't resolv the public IP.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269676#4269676
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269676
16 years, 4 months
[jBPM Users] - Re: Extracting information from a jpdl file
by ajaygautam
Thanks Santanu.
getOutcomes does work, but the overhead of convert states to tasks is way too much...
getOutgoingTransitions() always returns an empty list! - I think its broken - or maybe I am not using it correctly.
Anyway...
The requirement has changed: Now, we (me) need to supply the UI with the entire map at startup. As in: The UI starts up, and requests for the "action map" -> which is a list of who can perform which transitions.
Unfortunately, I cannot find any easy way of storing role information with the diagram itself: the who can do what part. So, for now, I am thinking of adding an "allowedRoles" to each transition element. Will have to parse the jpdl file myself to get this information out of the file, but I will have all the data in one place.
The unfortunate downside is that I won't be able to use the UI to edit the jpdl diagram...
Is there an alternative way?
Thanks
Ajay
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269672#4269672
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269672
16 years, 4 months