ejb-3.1

Are CDI event observer methods compatible with EJBs?

守給你的承諾、 提交于 2019-12-10 03:03:30
问题 I have a Singleton EJB (javax.ejb.Singleton version. sigh.) which has a CDI observer method on it. When I try to deploy this to glassfish 3.1 the server fails to deploy the EAR file without any real explanation - simply saying there was an exception during deployment without any more details. SEVERE: Exception while loading the app SEVERE: Exception while shutting down application container .... SEVERE: Exception while shutting down application container : java.lang.NullPointerException This

Add Java EE Security Roles dynamically without using deployment descriptor

流过昼夜 提交于 2019-12-10 03:01:37
问题 I'm developing a Java EE 6 application using Glassfish 3.1, B06. To secure my app, i'm using a JDBCRealm and programmatic security. This works fine to check username and password. But when it comes to declaring security roles, i have a problem: To use Security Roles in Java EE 6, i have to declare those roles both in the EJB deployment descriptor and in the Glassfish-specific deployment descriptor to link those roles (as explained in the Java EE 6-tutorial) Only than i can use the method

EJB 3.1. Is @Local annotation needed?

六月ゝ 毕业季﹏ 提交于 2019-12-09 11:39:56
问题 So far, I almost always worked with no-interface EJBs and have a slight understanding about the need of @Local annotation. Consider this example: public interface MyBeanIntf { void doStuff(); } @Stateless public class MyBean implements MyBeanIntf { public void doStuff(){ } } Should the MyBeanIntf be marked as @Local ? I don't see any benefit from that, because even when I don't annotate it as @Local , I still can use DI to properly inject it into UI Controller: @Named @SessionScoped public

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

我怕爱的太早我们不能终老 提交于 2019-12-09 03:39:09
问题 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 = "*", minute = "*", second = "*/15") public void baseRegistration() { System.out.println("call from ejb!!"); } public void saveTempPartner(OasysPartnerTempEntity part) { em.persist

Using EJBContext getContextData - is this safe?

≡放荡痞女 提交于 2019-12-08 22:19:30
问题 I am planning to use EJBContext to pass some properties around from the application tier (specifically, a message-driven bean) to a persistence lifecycle callback that cannot directly be injected or passed parameters (session listener in EclipseLink, entity lifecycle callback, etc.), and that callback is getting the EJBContext via JNDI. This appears to work but are there any hidden gotchas, like thread safety or object lifespan that I'm missing? (Assume the property value being passed is

Lookup of same EJB on multiple servers

我们两清 提交于 2019-12-08 12:54:35
问题 I am trying to do a lookup from one deployment to another deployment, using exactle the same bean implementations. It is basically a consumer/producer setup with the same beans in both deployments on both machines. ear ejb-api com.example.bean ConsumerBean ProducerBean ejb-jar com.example.bean ConsumerBeanRemote ProducerBeanRemote The ProducerBeanRemote should look up the ConsumerBeanRemote and call its public method. Our machines are communicating like this: (Machine A) ProducerBeanRemote --

Correct way to lookup local EJB in websphere - Getting ClassCastException

匆匆过客 提交于 2019-12-08 10:52:08
问题 I have an EJB which is exposed by both local and remote interfaces package com.sam.enqueue; import javax.ejb.Local; import javax.ejb.Remote; import javax.ejb.Singleton; @Singleton @Local(SamEnqueueLocal.class) @Remote(SamEnqueueRemote.class) public class SamEnqueue implements SamEnqueueRemote, SamEnqueueLocal { } // remote interface package com.sam.enqueue; import javax.ejb.Remote; @Remote public interface SamEnqueueRemote { } // local interface package com.sam.enqueue; @Local public

Can i make my own Singleton Stateless Bean with EJB 3.0?

家住魔仙堡 提交于 2019-12-08 07:51:09
问题 Now, with EJB 3.1, we can find the javax.ejb.Singleton annocation that can ensure that this bean is going to be singleton. Is there a way that i can ensure singleton using stateless beans in EJB 3.0 with some modifications in my code (use of the keyword static, or other way to do that....) 回答1: If you're able to limit your @Stateless bean pool size to exactly 1, then you can get pretty close to an @Singleton . The effect would be like having an @Singleton that uses @Lock(WRITE) for all calls

Expose current progress of an @Asynchronous function to use in View

孤者浪人 提交于 2019-12-08 07:18:14
问题 In my JEE6-App (running on Glassfish 3.0.1) I have an EmailEJB which has to send lots of mails. The mails are sent asynchronously, so its annotated with the new EJB3.1 @Asynchronous, letting it be run in a separate Thread. Now i want the user to be informed about the current status of the method: How many mails have already been sent? Sending the mails asynchronously works fine, but i can't figure out how to let the progress be accessible from outside. Seems like my approach to do that is

EntityManager.persist() method hanging

試著忘記壹切 提交于 2019-12-08 06:49:53
问题 Not sure if somebody faced this problem. I'm using Jboss7.1 Application server with EJB3.1 and JPA2.0 with Hibernate implementation. I'm using back-end Oracle 11g database. Please see the below code. I'm invoking my EJB using a servlet driven by a HTTP GET request. When I comment out context.setRollbackOnly() in the below code, my web page just hangs forever and I get below stack trace after a while(if I debug, it takes me till persist() method and then doesn't go anywhere). 21:56:22,765 WARN