ejb-3.1

EJB 3.1 @EJB Injection into POJO

Being a complete turbot this afternoon and cant seem to find the answer anywhere. With the new EJB 3.1 spec is it possible to inject an EJB into a pojo? I know in EJB 3.0 the @EJB annotation could be used to inject an EJB but this did not work on simple pojos. If it is not do I have to look the bean up in JNDI as I know you cannot sim...

JEE DependsOn Local EJB

I have an EJB Project with a @Singleton EJB defined as: @LocalBean @Singleton @Startup public class DataModelBean implements DataModelBeanLocal { I then have another EJB Project with another EJB: @LocalBean @Singleton @Startup @EJB(beanInterface=DataModelBeanLocal.class,name="DataModelBeanLocal") @DependsOn("DataModelBeanLocal") pu...

Glassfish initialising Singleton bean twice

Hi, I have a singleton ejb which is getting initialised twice. I have no idea why and it is completly defenting the point in having a singleton bean as far as I can tell. Any help will be appreciated. As you can see I tried to put a static boolean in to prevent the multiple initialisation (not that it should be required) but it made no ...

Maven repository for EJB 3.1 API

What Maven repository can I use for EJB 3.1 API dependency? ...

How to inject a Session Bean into a Message Driven Bean?

I'm reasonably new to JEE, so this might be stupid.. bear with me pls :D I would like to inject a stateless session bean into a message-driven bean. Basically, the MDB gets a JMS message, then uses a session bean to perform the work. The session bean holds the business logic. Here's my Session Bean: @Stateless public class TestBean im...

EJB3 Remote vs Webservices, performances?

Hello I'm planning to a webapp where every guy using it would have a client that would run computations on its computer (because these computations can't be done on the server, too much load...), and then send results to the server. I guess there will be lot of people interested in my application and that's why i'm wonder if my archite...

Maven2 multi-module ejb 3.1 project - deployment error

The problem is taht I get the following error qhile deploying my project to Glassfish: java.lang.RuntimeException: Unable to load EJB module. DeploymentContext does not contain any EJB Check archive to ensure correct packaging But, let us start on how the project structure looks like in Maven2... I've build the following scenario: ...

How to use EJB 3.1 DI in Servlet ? (Could not inject session bean by @EJB from web application)

I am tying to merging web application(gwt, jpa) to an separate 2 application(business login in ejb/jpa and web client in gwt). Currently i can`t inject my beans from web application (simple servlet) I am using glassfish v3. module limbo(ejb jar) is in dependency of module lust (war). If I use lust with compiler output of limbo everythi...

Injecting jms resource in servlet & best practice for MDB

using ejb 3.1, servlet 3.0 (glassfish server v3) Scenario: I have MDB that listen to jms messages and give processing to some other session bean (Stateless). Servelet injecting jms resource. Question 1: Why servlet can`t inject jms resources when they use static declaration ? @Resource(mappedName = "jms/Tarturus") private static Conne...

EJB 3.1 Embedded API - Unit test EJB + JPA entities.

Has anyone done this or attempted to do this for a preexisting project? It seems there are two options to go with here, either using the embedded EJB API basically the following class javax.ejb.embeddable.EJBContainer Which expects a configured glassfish v3 install to be available (application scoped resources will make this easier)...

Deployment secription of Basic Authentication with JAX-WS for EJB 3.1

Hi! There is good tutorial Basic Authentication with JAX-WS But it describe deployment description for web based application (war). Is it passable describe in ejb jar deployment description ? For web.xml <security-constraint> <display-name>SecurityConstraint</display-name> <web-resource-collection> <web...

new Stateful session bean instance without calling lookup

Scenario: I have @Singleton UserFactory (@Stateless could be) , its method createSession() generating @Stateful UserSession bean by manual lookup. If I am injecting by DI @EJB - i will get same instance during calling fromFactory() method(as it should be) What I want - is to get new instance of UserSession without preforming lookup. ...

Is it possible to get collection of some ejb`s instances from container?

Scenario: I have some @Statefull bean for user session (not an HTTP session, it is web services session). And I need to manage user's session per user. Goal: I need to have possibility to get collection of @Statefull UserSession instances and control maximum number of session`s per user, and session`s life time. Question: Is it possibl...

@WebServices as @Stateless session bean in ejb jar

Hi! Scenario: Creating some web service as @Stateless bean, package it as ejb jar. Result - can`t access to wsdl file. Goal: I want to use @WebServices as @Stateless session using ejb jar packaging with accessible wsdl file form web. Web service: @Stateless @WebService(serviceName = "ws.isp.SecurityService", wsdlLocation = "META-INF/...

EJB injection in Glassfish webapp

I've got an app that is trying to use @EJB annotation to inject remote references to EJBs in my ejb.jar file. I'm getting inconsistent results. In one case, I have a listener in web.xml that gets called and apparently has the EJB injected correctly, since I can see it connecting to the EJB and calling methods on it. In another class (...

EJB 3.1 in war package in WEB-INF/classes - javax.ejb.CreateException: Could not create stateless EJB

I think, I misunderstood rules of packaging ejb beans in war package. Goal: I want to use ejb beans in war package. Scenario: I have some bean in my war: @Stateless public class RegistrationServiceBean { @PersistenceContext(unitName = "Utopia") EntityManager em; public RegistrationServiceBean() {} @Schedule(hour = "...

CDI not working in ear deployed to glassfish v3.0.1

I have some problem with using weld logger injection. Scenario: I have ear with ejb-jar inside. This is my ejb bean: @Stateless @LocalBean public class PartnersService { @Inject Logger log; @PersistenceContext(unitName = "Utopia") EntityManager em; public PartnersService() { } public OasysPartnerEntity g...

CDI with ejb 3.1 , weld-logger on glassfish v3.0.1

Scenario: 1) create maven ear project, create war project inside 2) add beans.xml to war project`s WEB-INF/ 3) creat simple @Steateless bean project - http://drp.ly/1j5C3t ejb bean : @Stateless @LocalBean public class TestEjb { @Inject Logger log; public TestEjb() { } @Schedule(hour = "*", minute = "*", secon...

JavaEE6 DAO: Should it be @Stateless or @ApplicationScoped?

I'm currently creating an EJB3 Data Access Class to handle all database operations in my JavaEE6-application. Now, since JavaEE6 provides the new ApplicationScoped-Annotation, i wonder what state my EJB should have, or if it should be stateless. Whould it be better to let the DAO be a @Stateless Session Bean, or an @ApplicationScoped B...

Getting Entitymanager/EJB inside a @FacesConverter/Validator of a WAR-packaged app

I have a JavaEE6-application running on Glassfish v3.0.1 with EJB 3.1 (app is packaged as WAR), and all my EJBs are @LocalBeans. Currently, i'm writing a FacesConverter for use in JSF2, in which i need the EntityManager to get an Entity back from an id. Now i wonder, which is the best and cleanest way to get the Entitymanager inside th...