ejb-3.1

JBOSS - Previos execution of timer is still progress,timer state is IN_TIMEOUT

守給你的承諾、 提交于 2019-12-10 18:25:19
问题 I am using JBOSS EAP 6.4 . I have schedule some schedulers in my ScedulerBean using EJB @Shedule annotation as follows. Here the ShedulerBean is dependson StartupBean. @Singleton @DependsOn("StartupBean") public class SchedulerBean { private Logger logger = LoggerFactory.getLogger(SchedulerBean.class); private SchedulerInterface schedulerInterface; @PostConstruct public void initialize() { // some initialization } @Schedule(second = "1/1", minute = "*", hour = "*",persistent = false) public

TransactionRolledbackLocalException Client's transaction aborted when accessing @Singleton

大城市里の小女人 提交于 2019-12-10 17:49:19
问题 NOTE: Adding this question in short form with an answer after spending far more time than I'd like to admit on finding the cause. Hopefully I'll save someone else some pain. When delegating a method call to an EJB annotated with @Singleton , the container throws an Exception along the lines of: TransactionRolledbackLocalException Client's transaction aborted The Singleton bean has no data access occurring. ServiceBeanImpl.java @Stateless @Local public class ServiceBean extends BaseBean{ @EJB

CDI inject EJB into POJO on Glassfish v3

流过昼夜 提交于 2019-12-10 17:45:48
问题 Is it possible to inject EJB 3.1 beans into POJO using CDI on Glassfish v3? My classes (in EJB module): @Singleton @LocalBean @Startup @Named public class NewSingletonBean { @PostConstruct public void init(){ System.out.println("NewSingletonBean INIT"); } } _ @Singleton @LocalBean @Startup @DependsOn(value="NewSingletonBean") public class NewSingletonBean2 { @Inject NewSingletonBean newSingletonBean; @PostConstruct public void init(){ System.out.println("NewSingletonBean2 INIT"); System.out

Suspend MDB message processing until @StartupBean has finished initialization

。_饼干妹妹 提交于 2019-12-10 15:57:39
问题 While migrating a JBoss 5 application to JBoss AS 7 (7.1.1.FINAL) I have a problem with a new JMS message driven EJB. Within message processing, some master data fields have to be checked. To enhance performance, this master data shall be preloaded into a cache structure using a @Singleton @Startup EJB, which needs about 30 seconds to load the data. My problem is that the queue message processing starts even if the cache has not been fully initialized, causing message validation errors. I

JBoss 7.1.1 and the EJB 3.1 Timer Service

爷,独闯天下 提交于 2019-12-10 14:56:25
问题 I am thinking about porting a Spring Quartz based application to EJB 3.1 to see if EJB has improved. I am having problems understanding how fail-over works with the Schedule Timer Service. In Quartz, there are database tables which clustered Quartz instances use. If one node in your cluster crashes, jobs will still get executed on other nodes. I have been looking at how the Timer Service persists things and it appears to use the file system of the server the Timer was created on. Is this true

Make EJB call with timeout

三世轮回 提交于 2019-12-10 14:55:32
问题 I have an EJB A that invokes EJB B . The UI should not wait for more than 30 seconds for a response. If some data is missing, it should return a partial response. How can I define a timeout (time limit of 30 seconds) on EJB B ? I can define EJB B as Asynchronous that returns Future , and then do Future.get(30, TimeUnit.SECONDS) . But is it the best solution? thank you P.S. I use glassfish 3.1 回答1: To configure timeout for a bean which applies to all its methods, you have to configure the

Why @Singleton over @ApplicationScoped in Producers?

不问归期 提交于 2019-12-10 13:39:37
问题 LoggerProducer.java is a class used to produce Loggers to be injected in CDI beans with: @Inject Logger LOG; Full code: import javax.ejb.Singleton; /** * @author rveldpau */ @Singleton public class LoggerProducer { private Map<String, Logger> loggers = new HashMap<>(); @Produces public Logger getProducer(InjectionPoint ip) { String key = getKeyFromIp(ip); if (!loggers.containsKey(key)) { loggers.put(key, Logger.getLogger(key)); } return loggers.get(key); } private String getKeyFromIp

JAVA-EE7/javax.ws.rs: Injection of EJB in REST-Resource

限于喜欢 提交于 2019-12-10 11:53:54
问题 I'm trying to inject a Stateless EJB into my JAX-RS webservice via Annotation @EJB. Unfortunately the EJB being injected is null and throws a NullPointerException when it is being called, see the class "RegistrationRest": @Path("/database") @Stateless public class RegistrationRest { @EJB private DbDao dbDao; @Path("getInfo/{name}") @GET @Produces(MediaType.TEXT_PLAIN) public String getInfoByName(@PathParam("name") String name { TreeSet <String> ts = new TreeSet<String>(); JsonGenerator json =

Accessing EJB in WAR from remote standalone client

二次信任 提交于 2019-12-10 11:47:56
问题 I have an EJB accessed remotely from a Swing client as well as locally by servlet/JSP. I want to switch the packaging for my EJB from a EJB/WAR/EAR to a EJB/WAR since it is simpler to work with. What do I mean by simpler? In Eclipse, for example, I can have a single project with my EJB/web classes rather than having a EJB + WAR + EAR project (My client is a separate project in Eclipse). Is it possible to package a EJB in a WAR and have it be accessible remotely? 回答1: According to the web

Deltaspike and @Stateless Bean

↘锁芯ラ 提交于 2019-12-10 10:23:22
问题 I want to secure my "Stateless" EJb with the DeltaSpike-API. @Stateless @Remote(UserServiceRemote.class) public class UserService implements UserServiceRemote At method level i have a custom annotation "Support" @Support public void doSomething() {} Therefore i wrote a custom annotation "@Support": @Retention(value = RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD }) @Documented @SecurityBindingType public @interface Support { My custom Authorizer looks like: @Secures