ejb-3.0

Using the client jar in EJB 3 and design patterns

Hi, I'm new to EJB 3 and pretty confused with some doubts which Google didn't provide with a satisfactory answer. I'm trying to create a framework with some base classes and some utility methods which my other applications can use. All applications are to be deployed on the same server. When I'm trying to create a new EJB 3.0 project ...

Ejb refrences another ejb

i have two ejbs , ejb A references ejb B, both are deployed to the same server , i am using netbeans and jbosss 4.2.3 as well as ejb3.0 each time i try to deploy ejb A it tries to register ejb B which is already deployed and registered which causes error :java.lang.IllegalStateException any idea how to prevent EJB A from registering t...

How to use @PostConstruct to create timers in a stateless bean EJB3?

I want to create a timer EJB3 when a stateless bean is created in the pool. But if I use @PostConstruct I get the exception: java.lang.IllegalStateException: [EJB:010193]Illegal call to EJBContext method. The bean is in "null" state. It cannot perform 'getting the Timer Service' action(s). Refer to the EJB specification for more details...

How to inject resources into EJB3 beans with Spring 2.5?

If I create an EJB3 bean (say a stateless session bean) in an application using Spring 2.5 for DI, how should I inject dependencies from Spring into the bean without coupling the bean to Spring? ...

"javax.ejb.NoSuchEJBException: Could not find stateful bean: "

Hello All, I'm struggling futher in my adventure with Jboss and EJB 3.0. I joined Spring 3.0 with EJB. I have 3 modules - web module with Spring controllers, ejb module with my EJB beans and spring mogule with other classes like dao or some helpers. All in the ear. So, in my Spring Controller I have the following code: @Controller publ...

Message Driven Bean-When To Use

Hi The javaEE 6 tutorial says that you can not use Session Bean asynchronously, then what is the purpose of @Asynchronous annotation in EJB 3.1 as this article says you can use it. Can somebody explain when to use Message Driven Bean? thanks! ...

Stateless Session Bean

Do I package a stateless session bean in a war file or a ear file for deployment? ...

How to apply a default-restriction on Entity-Bean @OneToMany Relationships

Dear all, I have to e ntity model like Customer and Order. Each customer could have thousand orders, well, I make OneToMany and ManyToOne relationship between these to entities. But the thing I want is how to restrict this relationship's list to only top 10 orders. I mean if it is possible to apply 'WHERE' condition as an attribute on @...

JNDI names in Weblogic Server

Is it mandatory to provide a JNDI name for a stateless session bean using the mappedName attribute of the Stateless annotation? I thought that on deployment the server will assign a JNDI name if one is not provided based on the pkgname and the class name. I have not checked the ejb 3.x spec! However with Weblogic 10.3 I found that you h...

glassfish v3 remote jboss EJB client

Hi ladies and gents, I have some interesting issue regarding calling EJB 3 stateless deployed on Jboss 5 from Glassfish v3. I managed to do this successfully on glassfish 2.1 and jboss 5, by packing Jboss client jars with my app, but now when I do the same thing on gf3 I get ClassNotFoundException for many of jboss classes (other then ...

How to inject EJBs with custom injector?

How can I inject EJBs with my own injector? I have a distributed environment and a service locator, which can locate all EJBs. Is it possible to use the standard @EJB-Annotation, but make the lookup on my own? For example: @javax.ejb.EJB(name = "ejb/StackOverflow") private StackOverflow stackOverflowService; Should finally do: retu...

Invoking Ejb deployed in WLS 10.3.x server from sun jdk

While searching for how to invoke 3.x EJB deployed in WLS 10.3.x server from sun jdk I came across an excellent this blog post. Following the steps in this post I was able to invoke a WLS deployed SLSB from a java client uisng only sun jdk through the iiop protocol. However, to enable it I had to make some changes to my 3.x ejb remote in...

EJB3 beans JNDI lookup in Websphere 7

I have created an EAR with a web project, ejb3 project and the ejb client. I'm able to call the bean methods via injection in the servlet. I'm planning to use a ServiceDelegate which is a pojo to handle the bean invocation. So I'll call the delegate from my servlet and the delegate will call the appropriate beans and its methods. But I'...

EJB3.0: Using dependency injection as opposed to the session object

Hello there! We're learning EJB 3.0 in school and we're trying to determine best practice for a problem our teacher has posed. We don't use Spring yet. The problem is as follows: Create an EJB that keeps track of the time the bean was last called by the same user (call the first user John) and displays this in a web (servlet) context. I...

EJB3 Remoting/Security problem in JBoss with classloader isolation.

I have an application in JBoss. For some reason I had to enable classloader isolation. To do so, I had to dublicate remoting.jar inside application ear. Now, I am trying to implement EJB3 Session Bean and after InitialContext.lookup for my session I cannot do anything with it because of: at org.jboss.ejb3.BlockContainerShutdownInte...

Spring alternative to TimerService in EJB 3

We're using EJB TimerService:s for controlling tasks that needs to be executed on demand or triggered via a cron expression some will run every night e.g. statistic collectors and some will run every 10s e.g. checking for new orders needed to be processed we must also be able to turn them on and off. It works fine most of the time but so...

Are EJB3 Timers inherit to the beans they are created by?

Timers are created in EJB3 using the TimerService.createTimer(), and are then run via whatever callback method that's annotated by the @Timeout annotation, i.e: @Resource private TimerService timerService; public void createHampster() { Hampster hampster = new Hampster("Fluffy III"); timerService.createTimer(3000, 3000, hampste...

Can I access an injected ejb from an inner class?

As i clearly mentioned above, I would be glad to hear your ideas about that. btw, some other ones say; "call Component.getInstance(Facade,true) from your inner class." However, I dont understand it actually.. Thanks ...

EJB stateless session beans and stateful session bean

I have gone through various books on stateful and stateless session bean and how they work.i want to know the real usage of these ejb beans and advantages over a plain java classes.basically when do you go for stateless and statefull .i want a real time application ...

Not able to parameterize an ejb function

Hi I can write a ejb like this... @Stateless public class AnotherBean { @PersistenceContext(unitName = "VoidJPA-ejbPU") private EntityManager em; public void newTest() { System.out.println("Testing"); } } And call it using this from a servlet @EJB private AnotherBean nsb; ... ... nsb.newTest(); But whenever i put a variabl...