[EJB 3.0] - Persistence unit dependency failure on deploy
by mtuckah
Hello,
I have an ejb3 application packaged in the following way:
|
|
| myapp.ear
| |---application.xml
| |---myentities.jar
| |---META-INF/persistence.xml
| |---(entity beans)
| |---mysessions.jar
| |---MySessionBean.java
|
|
My persistence.xml looks like this:
|
| <persistence>
| <persistence-unit name="myUnit">
| <jta-data-source>java:/MyDS</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
| <property name="hibernate.hbm2ddl.auto" value="validate"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| <property name="hibernate.transaction.flush_before_completion" value="true"/>
| <property name="hibernate.show_sql" value="false"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/MyFactory"/>
| <property name="jboss.entity.manager.jndi.name" value="java:/EntityManager/myUnit"/>
| </properties>
| </persistence-unit>
| </persistence>
|
|
Mu application.xml looks like this:
|
| <application>
| <display-name>My App</display-name>
|
| <module>
| <ejb>myentities.jar</ejb>
| </module>
|
| <module>
| <ejb>mysessions.jar</ejb>
| </module>
| </application>
|
|
In MySession, I'm attempting to inject an EntityManager like so:
|
| @PersistenceContext(unitName = "myUnit")
| private EntityManager em;
|
|
For session beans that exist within the same JAR that contains the persistence.xml, this injection works fine. However for session beans within mysessions.jar, I get the following exception on deploy:
anonymous wrote :
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:ear=myapp.ear,jar=mysessions.jar,name=MySessionBean,service=EJB3
| State: NOTYETINSTALLED
| I Depend On:
| persistence.units:unitName=myUnit
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: persistence.units:unitName=myUnit
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.j2ee:ear=myapp.ear,jar=mysessions.jar,name=MySessionBean,service=EJB3
|
|
I've seen posts with similar problems but no clear cut solutions. Is my packaging correct? Should JARs within the same EAR be able to reference persistence units in other JARs? Any help would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964467#3964467
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964467
19 years, 9 months
[JBoss jBPM] - Re: Rollback - Business Process
by stevei00
Here is some additional food for thought:
http://rodin.cs.ncl.ac.uk/Publications/Coleman-ExaminingBPEL.pdf
A Process is made up of States, Transitions, and Transition Events. A Transition is used to move from one State to another State. During the course of that Transition, you may invoke many Transition Events that may need to be carried out (sequentially or parallel).
Two scenarios may require the need to 'compensate':
1) During the execution of your Transition Event(s), you encounter a problem (business rule or exception) that prevents the Transition from completing to the new State.
2) A situation occurs that requires the need to move a Task backwards in the Process. This could be as simple as user moving a Task forward by mistake. Additionally, it could involve multiple Transitions and States.
In both of these scenarios, you need the ability to 'compensate' for the Transition Events that have already occurred. It is not ideal to create additional Transitions for every possible scenario. Additionally, this functionality should not be treated as a fault, but it may be the response to a fault.
Proposed Solution:
Suppose a Transition had knowledge of all the Transition Events that are in progress, completed, or failed. The Transition could have a reverse() method that could cycle through the Transition Events and determine which ones needed to be handled. It would then call a rollback() method on each Transition Event, as necessary. The rollback() method would perform the most appropriate action to compensate for changes that already occurred.
When I refer to the 'most appropriate action', I mean that whoever codes the Transition Event execution, would also define what should occur on a rollback(). You can't use a standard mechanism to handle this. It is just too process-specific and requires knowledge of your logic.
In scenario 1 (above), the Transition would never complete or get to the new State. It would just call the rollback() method on each of the Transition Events (that had occurred). When all appropriate rollback() methods were called, the Transition's reverse() method could return a boolean indicating whether all the rollback() methods completed successfully or not.
In scenario 2 (above), the reverse() method of the Transition would be called and all Transition Event rollback() methods would be called. Again, the reverse() method would return a boolean indicating if all the rollback() methods were successful. If the reverse() method returned true, then the State of the Task would be changed to the previous State.
I haven't thought through the implications of guard conditions that may be dependent on variables that have changed. Furthermore, the order of Transition Events, that did not occur sequentially, could be problematic. These issues may just have to be the responsibility of the logic within each rollback() method.
Please let me know if this idea has merit or is riddled with holes.
Thanks in advance,
- Steve
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964461#3964461
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964461
19 years, 9 months
[Beginners Corner] - How to force JBoss to read my own xmlrpc.jar?
by shudonglu
We have an application(let's call it myapp) running fine on Tomcat(no JBoss). In myapp, we modified the source code of Apache xmlrpc and have our own xmlrpc.jar.
We are trying to port myapp to JBoss with embedded Tomcat. Deployment failed with the exception:
java.lang.NoSuchMethodError: org.apache.xmlrpc.XmlRpcClient.execute(Ljava/lang/String;Ljava/util/Vector;I)Ljava/lang/Object;
This method is what we changed and thus is not in the standard Apache xmlrpc.jar. It is in our modified xmlrpc.jar. I could not make JBoss to read our modified xmlrpc.jar. I tried to put it under:
../server/default/deploy/myapp.war/WEB-INF/lib
../server/default/deploy
../server/default/lib
../lib
../lib/endorsed
Then restarted JBoss each time. None worked -- the same exception every time. It seems to me JBoss is always reading the original Apache xmlrpc.jar from some where. Where is it? How can I force JBoss to read my modified xmlrpc.jar?
I checked my $CLASSPATH which did not include xmlrpc.jar.
JBoss AS 4.0.4
java 1.5.0_06
Solaris 10
Thanks,
Shudong
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964456#3964456
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964456
19 years, 9 months