[JBoss jBPM] - Re: Exception on Timer-Execution under Weblogic
by syngolis
After all...I found a possibillity to solve this problem...Here comes a question for the developers:
The error is thrown in Timerservicebean. First, the EJB Timer becomes cancled in 'cancelTimersByName'. Afterwards method 'deleteTimersForProcessInstance' is called and while executing TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo(); an error is thrown (in weblogic not in jboss), because there is no timer object for operation left.
I don't understand this behaviour...so I insert a try...catch block in the second method and all works fine.
Can somebody explain it to me?
Here are the methods (with my 'correction')
| public void cancelTimersByName(String timerName, Token token) {
| // TODO make the scanning of timers for cancellation optional by only deleting the timerjobs in the db.
| // of course, the corresponding ejb timer notifications have to be ignored.
|
| log.debug("cancelling timers with name "+timerName+" from the ejb timer service");
|
| TimerService timerService = sessionContext.getTimerService();
|
| Iterator iter = timerService.getTimers().iterator();
|
| while (iter.hasNext()) {
| javax.ejb.Timer ejbTimer = (javax.ejb.Timer) iter.next();
| if (ejbTimer.getInfo() instanceof TimerInfo) {
| TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
| if (timerInfo.matchesName(timerName, token)) {
| ejbTimer.cancel();
| }
| }
| }
| }
|
| public void deleteTimersForProcessInstance(ProcessInstance processInstance) {
|
| // TODO make the scanning of timers for cancellation optional by only deleting the timerjobs in the db.
| // of course, the corresponding ejb timer notifications have to be ignored.
|
| log.debug("deleting timers for process instance "+processInstance+" from the ejb timer service");
| TimerService timerService = sessionContext.getTimerService();
| Iterator iter = timerService.getTimers().iterator();
|
| while (iter.hasNext()) {
| javax.ejb.Timer ejbTimer = (javax.ejb.Timer) iter.next();
| try {
| if (ejbTimer.getInfo() instanceof TimerInfo) {
| TimerInfo timerInfo = (TimerInfo) ejbTimer.getInfo();
| if (timerInfo.matchesProcessInstance(processInstance)) {
| ejbTimer.cancel();
| }
| }
| } catch (Exception e) {
| System.out.println("CATCH!");
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060585#4060585
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060585
18Â years, 9Â months
[EJB 3.0] - No active session context
by curtney
Greetings everyone!
I am recieving a "No active session context" when the timer I have set has timed out.
I am running JBoss 4.2
I am using Seam 2.0 Beta (perhaps relevant).
The following is the code of interest. If I remove the function (findInvitation) that accesses the database then everything runs ok.
I have tried various transaction attribute notation (include using no annotations), but still get the error.
Any help is greatly appreciated. Thanks.
| @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
| @Timeout
| public void timeout (Timer timer) throws Exception {
| Long invitationId = (Long)timer.getInfo();
| //using a dao object to access database.
| Invitation invitation = findInvitation (invitationId);
| }
|
The following is the relevant debug output:
2007-07-01 22:07:13,741 DEBUG [org.jboss.ejb.txtimer.TimerImpl] run: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=phoenix.ear,jar=phoenix-security.jar,name=invitationService],remaining=-3,periode=0,active]
2007-07-01 22:07:13,741 DEBUG [org.jboss.ejb.txtimer.TimerImpl] setTimerState: in_timeout
2007-07-01 22:07:13,745 INFO [STDOUT] Pre Checking 21 for cancellation
2007-07-01 22:07:13,747 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4847013207027712
2007-07-01 22:07:13,748 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
2007-07-01 22:07:13,748 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
2007-07-01 22:07:13,752 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
2007-07-01 22:07:13,752 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Transaction already joined
2007-07-01 22:07:13,752 DEBUG [org.hibernate.loader.Loader] loading entity: [com.phoenix.security.domain.registration.Invitation#21]
2007-07-01 22:07:13,753 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-07-01 22:07:13,753 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
2007-07-01 22:07:13,755 DEBUG [org.hibernate.SQL]
select
invitation0_.id as id0_0_,
invitation0_.user_logon as user10_0_0_,
invitation0_.template as template0_0_,
invitation0_.title as title0_0_,
invitation0_.expiration as expiration0_0_,
invitation0_.status as status0_0_,
invitation0_.email as email0_0_,
invitation0_.activation_key as activation7_0_0_,
invitation0_.created as created0_0_,
invitation0_.last_modified as last9_0_0_
from
PHOENIX_INVITATION invitation0_
where
invitation0_.id=?
2007-07-01 22:07:13,756 INFO [STDOUT] Hibernate:
select
invitation0_.id as id0_0_,
invitation0_.user_logon as user10_0_0_,
invitation0_.template as template0_0_,
invitation0_.title as title0_0_,
invitation0_.expiration as expiration0_0_,
invitation0_.status as status0_0_,
invitation0_.email as email0_0_,
invitation0_.activation_key as activation7_0_0_,
invitation0_.created as created0_0_,
invitation0_.last_modified as last9_0_0_
from
PHOENIX_INVITATION invitation0_
where
invitation0_.id=?
2007-07-01 22:07:13,761 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
2007-07-01 22:07:13,762 DEBUG [org.hibernate.loader.Loader] result row: EntityKey[com.phoenix.security.domain.registration.Invitation#21]
2007-07-01 22:07:13,777 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
2007-07-01 22:07:13,777 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-07-01 22:07:13,778 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2007-07-01 22:07:13,778 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2007-07-01 22:07:13,778 DEBUG [org.hibernate.engine.TwoPhaseLoad] resolving associations for [com.phoenix.security.domain.registration.Invitation#21]
2007-07-01 22:07:13,781 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@6e9e64, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@14f1544{ url=null ,addedOrder=0}
2007-07-01 22:07:13,801 DEBUG [org.jboss.ejb3.entity.ManagedEntityManagerFactory] ************** closing entity managersession **************
2007-07-01 22:07:13,802 ERROR [org.jboss.ejb.txtimer.TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBTransactionRolledbackException: No active session context
2007-07-01 22:07:13,803 DEBUG [org.jboss.ejb.txtimer.TimerImpl] Timer was not registered with Tx, resetting state: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=phoenix.ear,jar=phoenix-security.jar,name=invitationService],remaining=-66,periode=0,in_timeout]
2007-07-01 22:07:13,803 DEBUG [org.jboss.ejb.txtimer.TimerImpl] setTimerState: expired
2007-07-01 22:07:13,803 DEBUG [org.jboss.ejb.txtimer.TimerImpl] killTimer: [id=1,target=[target=jboss.j2ee:service=EJB3,ear=phoenix.ear,jar=phoenix-security.jar,name=invitationService],remaining=-66,periode=0,expired]
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060582#4060582
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060582
18Â years, 9Â months
[JBoss Portal] - Re: No bridge detected for application factory org.jboss.sea
by jgilbert
its not pretty but i got it to work with the following change. i hope there is a better way.
| public class JSFMetaBridgeFactory
| {
|
| /** . */
| private static final Logger log = Logger.getLogger(JSFMetaBridgeFactory.class);
|
| private static boolean isJsf12() {
| try {
| Object af = FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
| java.lang.reflect.Method m = af.getClass().getMethod("getApplication", new Class[]{});
| Object app = m.invoke(af, new Object[]{});
| if ("org.jboss.seam.jsf.SeamApplication12".equals(app.getClass().getName())) {
| return true;
| } else {
| return false;
| }
| } catch (Exception e) {
| throw new RuntimeException(e);
| }
| }
|
| public static JSFMetaBridge getMetaBridge()
| {
| JSFMetaBridge metaBridge = null;
|
| //
| String className = FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY).getClass().getName();
| if ("com.sun.faces.application.ApplicationFactoryImpl".equals(className))
| {
| metaBridge = new SunRIJSFBridge();
| }
| else if ("org.apache.myfaces.application.ApplicationFactoryImpl".equals(className))
| {
| metaBridge = new MyFacesJSFBridge();
| }
| else if ("org.jboss.seam.jsf.SeamApplicationFactory".equals(className))
| {
| if (isJsf12()) {
| metaBridge = new SunRIJSFBridge();
| } else {
| metaBridge = new MyFacesJSFBridge();
| }
| }
|
| //
| if (metaBridge != null)
| {
| log.debug("Detected JSF bridge " + metaBridge.getName());
| }
| else
| {
| log.warn("No bridge detected for application factory " + className);
| }
|
| //
| return metaBridge;
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060578#4060578
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060578
18Â years, 9Â months