[EJB 3.0] - Error while timeout handler is executed
by mlsreekanth
Hi all,
Environment : Windows XP with java1.6 beta and Jboss 4.0.4GA
I am using Container managed Persistence context (EJB3 entity manager)
I have a problem with a timer. It is being created properly with a warning
20:53:13,343 WARN [TxConnectionManager] Prepare called on a local tx. Use of local transactions on a jta transaction with more than one branch may result in inconsistent data in some cases of failure.
Time out handler also called properly. At the end of the method it is raising one error and whole transaction is rolled back.
Error:
20:55:00,234 ERROR [TimerImpl] Error invoking ejbTimeout: java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=lakssrikd/50, BranchQual=, localId=50] status=STATUS_NO_TRANSACTION; - nested throwable: (java.lang.NullPointerException)
There is no other trace is available for htis error.
Please help me to resolve the issue.
Timer Code:
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.ejb.Local;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.jboss.seam.Component;
import org.jboss.seam.annotations.Intercept;
import org.jboss.seam.annotations.Name;
@Name("tenderUnlockTimer")
@Stateless
@Local(TenderUnlockTimer.class)
public class TenderUnlockTimerAction implements TenderUnlockTimer {
@Resource
private SessionContext ctx;
@PersistenceContext
EntityManager entityManager;
public void scheduleTimer(long milliseconds, String nitId) {
ctx.getTimerService().createTimer(
new Date(new Date().getTime() + milliseconds), nitId);
}
@Timeout
public void timeoutHandler(Timer timer) {
try{
String processName = "process_name"; // masked
String id= timer.getInfo().toString();
ProcessHelper processHelper = (ProcessHelper) Component
.getInstance("processHelper");
String processId = processHelper.startEvaluationProcess(processName,
id);
// Chnage the status of the entity using EM
timer.cancel();
// After this statement it is raising the error .. found while debugging
}catch(Exception e){
e.printStackTrace();
}
}
public void scheduleTimer(String nitId, Date unlockingDate) {
// Create UnlockTimer for the task "taskName"
try {
if (ctx != null) {
if (ctx.getTimerService() != null) {
ctx.getTimerService().createTimer(unlockingDate, nitId);
}else{
System.out.println("Timer service is null");
}
}else{
System.out.println(" Session context is null");
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void cancelTimerByName(String name) {
// Cancel the timer by name
if (name != null) {
Collection timers = ctx.getTimerService().getTimers();
Timer timer = null;
if (!timers.isEmpty()) {
Iterator timersIterator = timers.iterator();
while (timersIterator.hasNext()) {
timer = (Timer) timersIterator.next();
System.out.println(" Timer name " + timer.getInfo());
if (timer.getInfo().toString().trim().equals(name.trim())) {
System.out.println(" Canceling the Timer with name " + timer.getInfo());
timer.cancel();
break;
}
}
}else{
System.out.println(" There are no timer defined ");
}
} else {
// If name is null throw runtime exception
throw new ApplicationDefaultException(
ExceptionCodes.UNDEFINED_EXCEPTION);
}
}
public void scheduleTimer(long milliseconds) {
// TODO Auto-generated method stub
}
public void rescheduleTimer(String name, Date newDate) {
cancelTimerByName(name);
scheduleTimer(name, newDate);
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981786#3981786
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981786
19 years, 5 months
[JBoss Seam] - @OneToMany not initializing
by jerroldeads
I am creating a SEAM based application and in it I have a one to many relationship between a study and a biospecimentype. I used the DVDStore example Category, Categories and CategoriesBean as a reference. When I load a list of biospecimentypes using the following code:
| List<BiospecimenType> biospecimenTypes;
| Map<String,BiospecimenType> biospecimenTypeMap;
|
|
| @Create
| public void loadData() {
| biospecimenTypes = em.createQuery("from BiospecimenType bst")
| .setHint("org.hibernate.cacheable", true)
| .getResultList();
|
| Map<String,BiospecimenType> results = new TreeMap<String,BiospecimenType>();
|
| for (BiospecimenType biospecimenType: biospecimenTypes) {
| results.put(biospecimenType.getName(),biospecimenType);
| }
|
| biospecimenTypeMap = results;
| }
|
|
and then try to access the list via:
| <h:selectManyListbox
| value="#{search.biospecimenTypesSelected}"
| size="10"
| converter="#{biospecimentypesbean.converter}">
| <f:selectItems value="#{biospecimentypesbean.biospecimenTypes}" />
| </h:selectManyListbox>
| <BR/><BR/><h:commandButton action="#{search.testSelected}"
| value="TestSelection"/>
| <BR/><BR/><h:outputText value="Selected Categories: "/><h:outputText value="#{search.selItemsOutput}"/>
|
I get the following error in my JBoss server log but if I comment out the @OneToMany property in the BiospecimenType bean the list is built:
2006-10-30 06:46:52,928 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-10-30 06:46:52,928 DEBUG [org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener] committing transaction after phase: RENDER_RESPONSE(6)
2006-10-30 06:46:52,928 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] processing flush-time cascades
2006-10-30 06:46:52,928 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] dirty checking collections
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#1], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#1] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#2], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#2] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#3], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#3] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#4], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#4] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#5], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#5] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#6], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#6] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#7], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#7] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#8], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#8] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#9], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#9] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#10], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#10] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.engine.Collections] Collection found: [gov.nih.nci.brn.BiospecimenType.studyCollection#11], was: [gov.nih.nci.brn.BiospecimenType.studyCollection#11] (uninitialized)
2006-10-30 06:46:52,928 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 insertions, 0 updates, 0 deletions to 11 objects
2006-10-30 06:46:52,928 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] Flushed: 0 (re)creations, 0 updates, 0 removals to 11 collections
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] listing entities:
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Autopsy tissue, id=11}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Diseased Tissue, id=4}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Saliva, id=9}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Blood, id=5}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Plasma, id=7}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Malignant Tissue, id=2}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Other, id=10}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Urine, id=8}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Benign Tissue, id=3}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Serum, id=6}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.pretty.Printer] gov.nih.nci.brn.BiospecimenType{createdDate=null, modifiedBy=INITIAL LOAD, modifiedDate=null, deleteRecord=null, studyCollection=, createdBy=INITIAL LOAD, name=Normal Tissue, id=1}
2006-10-30 06:46:52,928 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
2006-10-30 06:46:52,928 DEBUG [org.hibernate.jdbc.JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
2006-10-30 06:46:52,928 DEBUG [org.jboss.ejb3.entity.ManagedEntityManagerFactory] ************** closing entity managersession **************
2006-10-30 06:46:52,928 DEBUG [org.hibernate.jdbc.JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
The definintion for the relationship in the BiospecimenType bean is:
| @OneToMany(mappedBy="biospecimenType")
| private Set<Study> studyCollection;
|
The definition for the relationship in the Study bean is:
| @ManyToOne
| @JoinColumn(name="BIOSPECIMEN_TYPE_ID")
| private BiospecimenType biospecimenType;
|
Shouldn't this relationship be initialized when the biospecimentype query is run? The foreign key necessary exists and is not null for these relatiionships. I am new to SEAM and EJB3.0 so please bear with me. I am using the DALI plug-in for Eclipse to generate the entity beans and relationships.
Thanks
Jerry
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981784#3981784
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981784
19 years, 5 months
[EJB 3.0] - @EJB Injection in JSF Managed Bean
by sisepago
Hi all ejb3 gurus,
i' am trying to use @EJB injection in a jsf managed bean class and i use the jbossas version 4.0.5.
I want to know if this scenario can work?
--- EJB 3 Codes
| @javax.ejb,Remote
| public Interface Service{
| public String meth1(Object o);
| }
|
| @javax.ejb.Stateful
| public class ServiceImpl implements Service{
| @PersistenceContext
| private EntityManager em;
| public String meth1(Test t){
| em.persist(t);
| return "success";
| }
| }
|
| the String "success" is for the redirection
|
| --- JSF Managed Bean class
| public class ManagedBean{
| private String field1="";
|
| @EJB
| private Service s1;
|
| public String getField1(){return field1;}
| public void setFied1(String f){field1 = f;}
|
| public String controller(){
| if(field1==null){
| return null;
| }else{
| return (s1.meth1(new Test(getField1()));
| }
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981782#3981782
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981782
19 years, 5 months
[JBoss Seam] - Multiple select items in page scope with factories.
by christian.andersson
Hi all,
I have an issue with multiple @SelectItems and factories.
Environment
jboss-4.0.4.GA
Seam 1.1.0.beta1
selectitems 1.0.1rc1
In my SFSB I have these @SelectItems
@SelectItems(value = "selectProjectManagers", scope = ScopeType.PAGE, label = "name", strategy = SelectItems.Strategy.INDEX)
| private List<User> projectManagers;
|
| @SelectItems(value = "selectCustomers", scope = ScopeType.PAGE, label = "name", strategy = SelectItems.Strategy.INDEX)
| private List<Customer> customers;
|
| @SelectItems(value = "selectBusinessAreas", scope = ScopeType.PAGE, label = "name", strategy = SelectItems.Strategy.INDEX)
| private List<BusinessArea> businessAreas;
I have three factories for these
| @Factory("selectProjectManagers")
| public void getProjectManagers()
| {
| projectManagers = userManager.getUsersInRoles(new String[] { SystemRole.PROJECT_ADMINISTRATOR });
| }
|
| @Factory("selectBusinessAreas")
| public void getBusinessAreas()
| {
| businessAreas = systemManagerBean.getBusinessAreas();
| }
|
| @Factory("selectCustomers")
| public void getCustomers()
| {
| customers = customerManager.getCustomers();
| }
and finally a page that displays these select items on a page as drop downs.
| <h:outputLabel for="customer">Project Manager:</h:outputLabel>
| <h:selectOneMenu value="#{projectWebManager.projectManager}">
| <f:selectItems value="#{selectProjectManagers}"/>
| </h:selectOneMenu>
|
| <h:outputLabel for="customer">Customer:</h:outputLabel>
| <h:selectOneMenu value="#{projectWebManager.customer}">
| <f:selectItems value="#{selectCustomers}"/>
| </h:selectOneMenu>
|
| <h:outputLabel for="customer">Business Area:</h:outputLabel>
| <h:selectOneMenu value="#{projectWebManager.businessArea}">
| <f:selectItems value="#{selectBusinessAreas}"/>
| </h:selectOneMenu>
When I debug this I can see that only the factory associated with the first of the three dropdowns (selectProjectManagers) is called. If I put the selectCustomers dropdown before the selectProjectManagers dropdown the selectCustomers factory is called.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981781#3981781
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981781
19 years, 5 months
[JBoss jBPM] - Re: Deploying jbpm.war(3.1.3) to jboss as 4.0.5GA
by ngtdave
So, I was having the same problems with 3.1.3 and 5.0.4.GA but wasn't entirely convinced it was not my fault for not copying all the right stuff. So I copied the jbpm folder/directory from the starter kit and placed it alongside my "default" folder/directory in my 5.0.4.GA installation and did a run -c jbpm, and got a different error:
07:58:45,274 DEBUG [JbpmService] binding 'org.jbpm.JbpmConfiguration@157b39f' to 'java:/jbpm/JbpmConfiguration'
| 07:58:45,289 DEBUG [JbpmService] Started jboss.jbpm:name=DefaultJbpm,service=JbpmService
| 07:58:45,399 WARN [ServiceController] Problem starting service jboss.mq:service=StateManager
| java.lang.NoSuchMethodError: org.jboss.util.timeout.Timeout.cancel()V
| at org.jboss.tm.TransactionImpl.cancelTimeout(TransactionImpl.java:1359)
| at org.jboss.tm.TransactionImpl.completeTransaction(TransactionImpl.java:1179)
| at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:359)
| at org.jboss.tm.TxManager.commit(TxManager.java:224)
| at org.jboss.mq.sm.jdbc.JDBCStateManager$JDBCSession.close(JDBCStateManager.java:630)
| ....
|
07:59:10,805 INFO [STDOUT] Exception in thread "JbpmCommandExecutor"
| 07:59:10,821 INFO [STDOUT] java.lang.NoClassDefFoundError: org/dom4j/DocumentException
| 07:59:10,821 INFO [STDOUT] at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:84)
| 07:59:10,821 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:68)
| 07:59:10,821 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90)
| 07:59:10,836 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:74)
| ...
|
07:59:11,211 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.mq:service=StateManager
| State: FAILED
| Reason: java.lang.NoSuchMethodError: org.jboss.util.timeout.Timeout.cancel()V
| I Depend On:
| jboss.jca:service=DataSourceBinding,name=DefaultDS
| Depends On Me:
| jboss.mq:service=DestinationManager
|
| ObjectName: jboss.mq:service=PersistenceManager
| State: FAILED
| Reason: java.lang.NoSuchMethodError: org.jboss.util.timeout.Timeout.cancel()V
| I Depend On:
| jboss.jca:service=DataSourceBinding,name=DefaultDS
| Depends On Me:
| jboss.mq:service=DestinationManager
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: jboss.mq:service=StateManager
| State: FAILED
| Reason: java.lang.NoSuchMethodError: org.jboss.util.timeout.Timeout.cancel()V
| I Depend On:
| jboss.jca:service=DataSourceBinding,name=DefaultDS
| Depends On Me:
| jboss.mq:service=DestinationManager
|
| ObjectName: jboss.mq:service=PersistenceManager
| State: FAILED
| Reason: java.lang.NoSuchMethodError: org.jboss.util.timeout.Timeout.cancel()V
| I Depend On:
| jboss.jca:service=DataSourceBinding,name=DefaultDS
| Depends On Me:
| jboss.mq:service=DestinationManager
| ...
|
07:59:12,321 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in 59s:797ms
| 07:59:15,789 INFO [STDOUT] Exception in thread "JbpmScheduler"
| 07:59:15,805 INFO [STDOUT] java.lang.NoClassDefFoundError: org/dom4j/DocumentException
| 07:59:15,805 INFO [STDOUT] at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:84)
| 07:59:15,805 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:68)
| 07:59:15,821 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90)
| 07:59:15,821 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:74)
| 07:59:15,821 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:78)
| ...
|
Not sure this is a valid test, but I think it show's there is something fundamentally different between the starter-kit and 4.0.5.GA
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3981780#3981780
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3981780
19 years, 5 months