tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nrkkalyan <nrkkal...@gmail.com>
Subject Re: Exception while running openejb application
Date Sun, 02 Nov 2014 07:37:43 GMT
Hi

Thank you. Can you please elaborate what do you mean by synchronously. 

Regards 
/Kalyan 
0733312584

PS: I am bad at spelling because I use mobile. 

> On 2 nov 2014, at 08:04, Romain Manni-Bucau <rmannibucau@gmail.com> wrote:
> 
> This is an app exception and surely a timing issue. Rewrite the app
> synchronously it will work so i sadly think it is on your side
> Le 1 nov. 2014 22:24, "Radhakrishna Kalyan" <nrkkalyan@gmail.com> a écrit :
> 
>> Sorry
>> Please find the exception at the following url
>> 
>> 
>> https://drive.google.com/file/d/0B9j0dIS5bS0wYy1OOE5iaFNKaUU/view?usp=sharing
>> 
>> 
>> On Sat, Nov 1, 2014 at 10:20 PM, Romain Manni-Bucau <rmannibucau@gmail.com
>> wrote:
>> 
>>> Hi
>>> 
>>> I dont see any attached file, can you gist or pastebin it?
>>> Le 1 nov. 2014 21:23, "Radhakrishna Kalyan" <nrkkalyan@gmail.com> a
>> écrit
>>> :
>>> 
>>>> 
>>>> 
>>>> Hi,
>>>> 
>>>> Yesterday we had deployed our application in our production for the
>> first
>>>> time which was developed using OpenEJB standalone.
>>>> But we got an exception after a while when we tried to perform certain
>>>> operation.
>>>> Please find the attached exception file.
>>>> 
>>>> The application shall read certain data from a table(Invoice) in
>> database
>>>> and create an entry in an another table (BatchOrder). After that it
>> shall
>>>> create an xml message using that data
>>>> and send to a jms queue.
>>>> In the console log everything looks fine and the jms message has been
>>> sent.
>>>> In the console log the id of the newly created BatchOrder record is
>>>> printed, but at the end when we check the database no record has been
>>>> created in the table BatchOrder.
>>>> 
>>>> The classes involved are 3:
>>>> BatchManager
>>>> BatchOrderDao
>>>> OverdueBatchTimerService
>>>> 
>>>> Here is the following code snippet of my application.
>> ---------------------------------------------------------------------------------------------------------------------------
>>>> @Stateless
>>>> public class BatchManager{
>>>>    @EJB
>>>>    private BatchOrderDao batchOrderDao;
>>>> 
>>>>    @Asynchronous
>>>>    @Lock(LockType.READ)
>>>>    public void createBatchMessage(...){
>>>>        ...Some code to read Invoice table...
>>>> 
>>>>        batchOrderDao.create(batchOrder);
>>>> 
>>>>        ...Some more code to send jms message...
>>>> 
>>>>    }
>>>> }
>> ---------------------------------------------------------------------------------------------------------------------------
>>>> @Stateless
>>>> public class BatchOrderDao{
>>>> 
>>>>    @PersistenceContext(unitName = "datasource")
>>>>    private EntityManager entityManager;
>>>> 
>>>>    public void create(BatchOrder entity){
>>>>        entityManager.persist(entity);
>>>>        entityManager.flush();
>>>>    }
>>>> 
>>>>    @SuppressWarnings("unchecked")
>>>>    public List<Long> findBatchesWithOverdueReceipts(final Date date)
{
>>>>        final Criteria criteria =
>>>> getSession().createCriteria(BatchOrder.class);
>> criteria.setProjection(Projections.distinct(Projections.property("iId")));
>>>>        criteria.add(Restrictions.isNull("iAlarmed"));
>>>>        ....Some more Restrictions.....
>>>>        return criteria.list();
>>>>    }
>>>> 
>>>> }
>> ---------------------------------------------------------------------------------------------------------------------------
>>>> @Entity
>>>> @Cacheable
>>>> @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
>>>> @Table(name = "BATCH_ORDER")
>>>> public class BatchOrder {
>>>>  private static final long serialVersionUID = 1L;
>>>> 
>>>>  @Id
>>>>  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator =
>>> "IdSeq")
>>>>  @SequenceGenerator(name = "IdSeq", sequenceName = "BOID_SEQ",
>>>> allocationSize = 1)
>>>>  @Column(name = "BO_ID", unique = true, nullable = false, updatable =
>>>> false)
>>>>  private Long iId;
>>>> 
>>>>  @Column(name = "BO_ALARMED", unique = false, nullable = true,
>> updatable
>>>> = true)
>>>>  private Date iAlarmed;
>>>> 
>>>>  .... Some more fields....
>>>> 
>>>> }
>> ---------------------------------------------------------------------------------------------------------------------------
>>>> @Singleton
>>>> @Startup
>>>> @Lock(LockType.READ)
>>>> private class OverdueBatchTimerService{
>>>>    @Inject
>>>>    private BatchOrderDao dao;
>>>>    @Resource
>>>>    private TimerService timerService;
>>>>    private static final long _5MINUTES_IN_MILLISECONDS = 5l * 60l *
>>> 1000l;
>>>> 
>>>>    @PostConstruct
>>>>    public void initialize() throws Exception {
>>>>        timerService.createSingleActionTimer(_5MINUTES_IN_MILLISECONDS,
>>>> new TimerConfig());
>>>>    }
>>>> 
>>>>    @Timeout
>>>>    public void onTimeout(final Timer timer) {
>>>>        try{
>>>>            .. Some Code....
>>>>            dao.findBatchesWithOverdueReceipts(time);
>>>>            .... Some more code....
>>>>        } catch (final Exception ignore) {
>>>>            LOG.error("Some exception occured while excecuting
>> onTimeout,
>>>> but IGNORED.", ignore);
>>>>        } finally {
>>>> 
>>>> timerService.createSingleActionTimer(_5MINUTES_IN_MILLISECONDS, new
>>>> TimerConfig());
>>>>        }
>>>>    }
>>>> }
>> ---------------------------------------------------------------------------------------------------------------------------
>>>> 
>>>> Please let me know if I am making any mistake.
>>>> 
>>>> 
>>>> --
>>>> Thanks and Regards
>>>> N Radhakrishna Kalyan
>>>> 
>>>> P:  +46 733 312 584
>>>> http://about.me/nrkkalyan
>>>> <http://about.me/nrkkalyan>
>> 
>> 
>> 
>> --
>> Thanks and Regards
>> N Radhakrishna Kalyan
>> 
>> P:  +46 733 312 584
>> http://about.me/nrkkalyan
>> <http://about.me/nrkkalyan>
>> 

Mime
View raw message