ejb-3.0

EJB Factory Class

随声附和 提交于 2019-12-03 20:30:42
I'm trying to create an EJB factory class, which works like this: You have a method which takes as argument a class of an EJB, then it checks whether the EJB has a remote interface (if not throw an exception) and if it does, it returns the concerning EJB. The code below does exactly this. However the object it returns is of the type of the remote interface of the concerning bean and not of the bean itself. How can I change this? Is there a way to tell Java that the generic type T is of the same type as the class passed to the methods. import java.util.Properties; import javax.ejb.Remote;

Successful build in Maven still showing errors in Eclipse

只谈情不闲聊 提交于 2019-12-03 18:38:17
问题 I'm having something quite peculiar here, my build is successful in maven when I type "mvn clean install" however once imported into Eclipse it's showing errors. See for yourself: I guess exluding quartz from the `pom.xml solved the problem but I'd like to know why. PS: Here is the pom.xml in case you want to see it: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache

Is it safe to inject an EJB into a servlet as an instance variable?

柔情痞子 提交于 2019-12-03 16:44:56
问题 We all know that in the web tier there is the possibility that only a single instance of a given Servlet exists which services multiple requests. This can lead to threading issues in instance variables. My question is, is it safe to inject an EJB using the @EJB annotation into a servlet as an instance variable? My initial instinct would be no, under the assumption that the same instance of the EJB would service multiple requests at the same time. It would seem that this would also be the

how to implement a cache in ejb 3.0?

孤者浪人 提交于 2019-12-03 16:37:43
I have a customer who's stuck in an EJB 3.0 environment. No @Singleton, no bean-managed concurrency :-( Considering thread management and synchronization is forbidden by the ejb specification, how to implement a cache? In essence, I want an non-synchronized object cache for some costly operations. The restriction of using static field and synchronization is stated in EJB 3.0 spec chapter 21.1.2. It also explains why. • An enterprise bean must not use read/write static fields. Using read-only static fields is allowed. Therefore, it is recommended that all static fields in the enterprise bean class

What is EJB alternative in Spring Framework

白昼怎懂夜的黑 提交于 2019-12-03 16:32:27
I am trying to learn Spring Framework, before that I used to create application with EJBs [Web services]->[Business Layer]->[DAO Layer] | [Database] in following way WebServices : Restful API using Jersey with url mappings , that support both JSON and XML format( news/list.json , news/list.xml ). Once a request is received by an endpoint(url-mapped-method) it is forwarded to a relevant EJB through lookup(remote, local). EJB process every thing, apply business rules and return result as DTO(Data transfer object),Service then transform the result into required format (JSON, XML) Business Layer :

REQUIRES_NEW within REQUIRES_NEW within REQUIRES_NEW … on and on

杀马特。学长 韩版系。学妹 提交于 2019-12-03 16:22:56
JBoss 4.x EJB 3.0 I've seen code like the following (greatly abbreviated): @Stateless @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public class EJB1 implements IEJB1 { @EJB private IEJB1 self; @EJB private IEJB2 ejb2; @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public boolean someMethod1() { return someMethod2(); } @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public boolean someMethod2() { return self.someMethod3(); } @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public boolean someMethod3() { return ejb2.someMethod1(); } } And

EJB3 Local and Remote interfaces

点点圈 提交于 2019-12-03 14:59:16
问题 I understood that Local interface is designed for clients in the same container's JVM instance and remote interface is designed for clients residing outside the EJB container's JVM. How about the web application client which is not reside (or packaged) in the same .ear but reside on the same Java EE server? 回答1: Officially @Local annotated beans can only be accessed if they're in the same application. A .war deployed separately from an .ear (or other .war or other .jar EJB) is a different

NameNotFoundException when calling a EJB in Weblogic 10.3

风格不统一 提交于 2019-12-03 13:08:32
问题 I have a EJB defined as this: package com.foo; @Stateless (mappedName="HelloWorld") public class HelloWorldBean implements HelloWorld, HelloWorldLocal .... When it's deployed to Weblogic (WL), it gets the name myBean. I'm not sure if this is important. I try to call the bean with this code: Hashtable ht = new Hashtable(); ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); ht.put(Context.PROVIDER_URL, "t3://localhost:7001"); ic = new InitialContext(ht); tp =

Can an EJB3 bean “self inject” and call its own methods via EJB container?

别来无恙 提交于 2019-12-03 11:39:04
Is it possible to "self inject" an EJB in order to call local methods as bean methods? There are some cases where this could be favorable, for example if container managed transactions are used and something should be accomplished in a new transaction. An example how this could work: Foo.java: @Local public interface FoO { public void doSomething(); public void processWithNewTransaction(); // this should actually be private } FooBean.java: @Stateless public class FooBean implements Foo { @EJB private Foo foo; public void doSomething() { ... foo.processWithNewTransaction(); ... }

Best features of EJB 3

偶尔善良 提交于 2019-12-03 11:03:53
问题 The scenario You have developed a webapp using EJBs version 3. The system is deployed, delivered and is used by the customer. If you would have to rewrite the system from scratch, would you use EJBs again? No : Don't answer this question, answer this one instead. Yes : Provide one important, real problem that EJBs solved, based on your personal experience. Let the answer contain just one problem. This will let other readers vote up the best feature of EJBs. 回答1: I think it depends on what