Ahmed Basheer

Ranch Hand
+ Follow
since Apr 15, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ahmed Basheer

Any one can comment on this?
Basheer
9 years ago
Hello All,

I have MDB developed in EJB3.0 using annotations without any deployment discriptor. I would like to have capability ( may be through aop) to disable the deployment of certin MDB when the ear is deployed. I was checking ejb3-interceptors-aop.xml file in deploy directoty of jboss but can't find a way to disable deploying specific MDB contained in ear file. Any suggestions will be appreciated.

Thanks,
Basheer
9 years ago
THank you for being very responsive. It seems that jboss5.1 has this bug.but how would programatically retry the transaction if you get staleobjectstate exception in cmt environment, when the exception doesn,t tell you root cause of the problem. Is there a work around. I agree that logs does show the cause that is meaningless though.

hmm...
Basheer
Jai,

The exception stack trace is at http://img8.imageshack.us/img8/8634/exceptionb.jpgClearly StaleObjectStateException is not wrapped.Let me know if you need more info


Thanks,
Basheer

Hi Jai,

I will post the full stackTrace shortly. But it is EJBTransactionRolledbackException wrapping RoleBackException and the then wrapping throwable.

I use container managed transaction. @Transaction Required tag. The client of the bean has a try catch.
client code:

try
{
mybean.update(obj)
}
catch(StaleObjectStateException)
{
// no staleobjectstateexception is thrown.
}
catch(Exception e}
{
//even if I unwind the exception no staleobjectstateexception exists.
}
----------------------

mybean code

@Transaction(REQUIRED)
public void update(Obj) throws exception
{
}
I clearly see in the server that StaleObjectStateException is thrown but Client of the bean doesn't see it and hence doesn't retry the transaction.

I will post the stack trace shortly.I can't use EntityManager as I use CMT allowing the EJB contain to open close session and Transaction.

Thanks,
Bashir
I am using local transactions and CMT. Perheps the code you gave will catch the stale exception. But I can,t use this code as I am using CMT. It seems transaction manager "Arjuna" in jboss is contributing to this prob. But it is such a basic thing I can't imagine that stale exception is not wrapped in ejb transaction fail exception. Thank you for you response. I am expecting some one like Jai Kiran , who spearheads the ejb3 on jboss dev, to address this issue.

Thanks
Ahmed

I am developing an EJB3 application in Jboss 5 with a db connector to MySQL.
I am trying to prevent simultaneous writes of two or more transactions on the same entities by using a @Version annotated field inside the affected session bean.
If I test it by forcing two transactions to simulataneously read the same entities and then write them I get a StaleObjectException and one transaction rolls back. That's fine!
But, I am unable to catch this exception with a try{...} catch(Exception e)... block around the method that starts the transaction. The EJBTransaction doesn't wrap the StaleObjectStateException. I did investigate the State track and in EJBTransactionfail exception I could NOTsee StaleObjectStateException wrapped? I don't want to propagate this exception back to the client I just want to restart the transaction.

Any suggestion? I appreciate.
Basheer
I am looking for a pattern in spring where most of the things will be taken care off in spring xml file. I have base class ( default class) and three derived classes NY, London, Tokyo. Similar another set of base class and derived classes for NY, London and Tokoyo. In traditional java application you have to know every time which Class you want to create and work from that class. Possibly a factory pattern in traditional java application can handle it better. Is there any mechanism in spring where once the locale is set the correct classes are returned based on the locale set.I like to keep mapping of all classes for all regions in one file but create classes specific to user defined locale.

Any insight into this?

Thanks,
Ahmed.
11 years ago
I have a quick suggestion for you to try it. Can you call method 2 from method1 not directly but by using the container API. If you call method 2 directly from method 1, then method 2 also runs in the same transaction as method 1 and method 2 transactions attributes don't matter.
I have an ear file which contains SLSB's and MDB's. MDB's dependent on SLSB's. When ear is deployed the MDB starts up and starts processing messsages rightaway and results in dependency injection Exception ( as shown below) because the SLSB that it depends on is no deployed yet. If there are no messages for MDB to process then everything works fine. I tried using Jboss annotation @Depends but nothing works. Any ideas of how to control message delivery to MDB would be appreciated.
I am using Jboss4.3.



2009-05-24 17:00:26,823 ERROR [WorkManager(2)-6] [com.company.mdbs.MDBBean] MDBBean.onMessage() unexpected exception
java.lang.NullPointerException
at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:49)
at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:87)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:112)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:107)
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:65)
at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:111)
at org.jboss.ejb3.StrictMaxPool.get(StrictMaxPool.java:141)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
11 years ago
I have questions about EJB3 on Jboss5.
I have following statless session bean which include reference to itself through EJB3 injection. This bean deploys and works fine in Jboss4.2.2 but when I upgraded to Jboss 5 I get following deployment error indicating that a reference of same type of bean in this bean is flawed, I think. The other beans which don't include reference to same type of bean deploy and work fine.

Appreciate your inputs.
Ahmed.

The code is simplified as follows.




@Stateless
public class ExampleServiceBean extends ServiceBase implements ExampleServiceLocalInterface, ExampleServiceRemoteInterface
{

@EJB
ExampleServiceLocalInterface ExampleService;

@Resource SessionContext ctx;
}


DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:ear=Mob.ear,jar=Mob.ear,name=ExampleServiceBean,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:ear=myexample.ear,jar=myexample.ear,name=ExampleServiceBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'jndi:ExampleServiceBean/local-com.ExampleServiceLocalInterface' **")
11 years ago
I am using HQL select statements with where clause . My records are unique and hence there is no hit in the cache. I am pretty much convinced that hibernate cache causes the slow down, because if I clear the cache after every select the next look ups inside the same session run faster. What I am not sure is how does hibernate compare the items in the cache, because I don't see hibernate calling persistent objects equals and hashcode method.
No my sessions are not long and there is nothing else going on in the session.
Thank you for your response.
Wichka
I am observing that in a single transaction while looking up distinct records the hibernate gets really slow. The reason is that because unique records are looked up and hibernate caches them and every new record that is looked up, the hibernates looks the item in the query, basically iterating through its cache list. This lookup time increases as hibernate cache builds up. I am talkign about ~ 1000 item look ups. My question is

1. Why does hibernate get slow with unique item lookup. What mechanism is it using to lookup the item in the cache?
2. While hibernate looks the item first in the cache before loading it from database, it DOES NOT call persistent objects hascode and equals method.Again how does it lookup item?
3. Is there any solution to to the slowness other than clearing the session cache every tome item is looked up?

I am not using level 2 cache.

Appreciate your responses/suggestions.

Wichka
Thank you Musab,

I thought ejb might provide out of box solution, but probably not so. In case your solution I would have to build message.How would I get confirmation from mdbs unless mdbs send the confirmation back on bus and another mdb listens to it and somehow notified the master sslb. This sounds a lot of work to solve what I think is common problem.

I was looking into worker manager Api. It could very well solve this problem but I am still checking into it.

Any other suggestions, appreciate it.

Thanks
Ahmed
I am looking for a pattern where an Stateless Session Bean break up a large transaction into multiple transactions and allow the broken up transactions to be executed simultaneously. I am sure this is common problem to speed up the execution of a single large transaction. Is there a J2EE pattern or EJB pattern for it. Since EJB's can't create threads, I am wondering how can this be handled?

Suggestions appreciated. Thanks,
Ahmed