ejb-3.1

Startup bean not called

纵饮孤独 提交于 2019-12-04 12:05:20
问题 I created a Java Web Application Project in NetBeans, and created a startup bean in it: package malibu.util; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.ejb.LocalBean; @Stateless @LocalBean @javax.ejb.Startup public class Startup { @EJB private ProviderEJB providerEJB; @PostConstruct public void onStartup() { System.err.println("Initialization success."); } } But the code is not called after I deploy the application. What can cause

EJB3.1 System Exceptions vs javax.ejb.EJBException

落花浮王杯 提交于 2019-12-04 11:44:42
问题 Just a bit of background on EJB3.1 exceptions before bringing up my question - Application exceptions comprise of User defined checked or unchecked exceptions which have @ApplicationException annotation All checked exceptions java.lang.Exception & it's subclass exceptions except java.rmi.RemoteException & it's subclass exceptions System exceptions comprise of java.rmi.RemoteException and it's subclass exceptions All unchecked exceptions java.lang.RuntimeException and it's subclass exceptions

Hold session in stateful EJB 3.1 bean?

不羁岁月 提交于 2019-12-04 11:35:39
问题 I'm working on a Java webapp trying to combine the following technologies: Java EE 6 CDI JSF 2 EJB 3.1 Spring Security I provide CDI-based backing beans (@ViewScoped, @Named) for my JSF pages. I use @Stateless EJB beans for the actual work to be done. I only need few session information like jSessionCookie (managed by container), internal username and some other internal IDs. Now, I wonder where to put this session information so that I can access it in the backing beans for JSF, but also

what is the purpose of including empty beans.xml in CDI implemenations projects?

对着背影说爱祢 提交于 2019-12-04 09:51:36
I am using weld ,a RI of CDI as dependency injection component in my JSF-EJB-JPA web app. I see in my project we have empty beans.xml in META-INF/beans.xml in ejb.jar and WEB-INF/beans.xml in my WAR. I don't get it why we need to keep empty beans.xml when there nothing defined in that file? CDI needs to scan all the classes of a bean archive at start-up and fire a bunch of events because almost any class is automatically a managed bean (read more here ), even if it doesn't have any annotations. This would incur quite a bit of overhead, especially for jar files that are not meant to have any

EJB 3.1 asynchronous method and thread pool

大兔子大兔子 提交于 2019-12-04 09:48:47
I need to process about 250.000 documents per day with an EJB 3.1 asynchronous method in order to face an overall long time task. I do this to use more threads and process more documents concurrently. Here's an example in pseudo code: // this returns about 250.000 documents per day List<Document> documentList = Persistence.listDocumentsToProcess(); for(Document currentDocument: documentList){ //this is the asynchronous call ejbInstance.processAsynchronously(currentDocument); } Suppose I have a thread pool of size 10 and 4 core processors, my questions are: how many documents will the

Dependency injection into ResourceFilter not working?

血红的双手。 提交于 2019-12-04 09:20:34
I have a bunch of JAX-RS resources that provide an API for a new WebService. In order to understand what's happening, I'd like to store information about each request in a data warehouse. In my mind, this is a perfect example for a cross-cutting concern, which could be implemented by a ResourceFilter , right? So I built a DataWarehouseService which is supposed to store stuff in the DB: @Stateless @LocalBean public class DataWarehouseService { public void logApiCall(ContainerRequest cr) { // get interesting fields from request, store in DB ... } } And here's my filter: public class

JPA dynamic persistence unit name

百般思念 提交于 2019-12-04 08:24:11
问题 I need a way to dynamically specify the persistence unit in a EJB. Simplified example: I have an application using multiple databases as data stores. Each of the data stores are structurally the same. Depending on the client connecting to the application I need to access the data from a specific data store. Therefore, I would like to use the same EJB so that the business logic is not duplicated, but then just select the correct persistence unit based on the client. Up to this point I've only

Communicating between cdi session contexts — with database, will proper cdi context be invoked?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 21:57:49
I'm having trouble getting sessionscoped beans and ejb stateful beans to communicate between user sessions, within the same java-ee container. Through trial and error I have settled on using a database to pass messages between the user sessions. But now I have a problem, how do I notify a user's session that the DB has changed Can I start a background polling thread in each user's session context to poll the database for changes? If this would work, what is the best method to avoid blocking, but to make sure the polling bean "wakes up" in their own user's session context? I'm using Glassfish 3

Java EE 6 - The Persistent Domain Objects pattern - any successes?

人盡茶涼 提交于 2019-12-03 13:48:22
I have a moderately complex application using POJOs, and now come to migrated it to EJB3.1 so it can be deployed online, accessed through REST services and benefit from the container environment (persistence being the most major, but transactions would be useful too). I have been away from Java EE since the J2EE days, and am struggling to get my head around the "loss" of entity beans. It took me a while to realise that Entities in EJB3.1 are not actually Beans in the old sense... :) I have read a number of EJB3 books including the O'Reilly Enterprise JavaBeans 3.1 "manual", all of which

Maven repository for EJB 3.1 API

空扰寡人 提交于 2019-12-03 12:32:53
What Maven repository can I use for EJB 3.1 API dependency? This dependency from central worked. <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> 来源: https://stackoverflow.com/questions/2429245/maven-repository-for-ejb-3-1-api