File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes Prevent JBoss deploying a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Prevent JBoss deploying a bean" Watch "Prevent JBoss deploying a bean" New topic

Prevent JBoss deploying a bean

Nishanth Alphonse

Joined: Aug 13, 2010
Posts: 11

I have a situation where a session bean (call it Bean A) is defined in an external jar that I have no control over. This bean is used by other beans in that jar.
I wish to override the behaviour of this bean A and therefore, I have created another session bean and have named it A. This is because the other beans in the external jar relie on the bean with name A.

So I have a EAR file with the external jar and my A.class file. Deploying on JBoss throws the Bean already registered error. Is there any way to get JBoss to not deploy the bean from the external jar?
Or do you have another solution for the situation I have?

Many thanks,

Peter Johnson

Joined: May 14, 2008
Posts: 5852

A few options I can think of:

a) Repackage the JAR file replacing the existing A.class with yours.

b) Use AOP to overwrite the existing EJB's methods

c) Use pre/post processing mechanism built into JBoss (the term used for this escapes me) to override the EJB's methods.

JBoss In Action
I agree. Here's the link:
subject: Prevent JBoss deploying a bean
It's not a secret anymore!