ejb

Cannot import javax.ejb.* packages

人走茶凉 提交于 2019-12-18 11:07:36
问题 I am having trouble in building an EJB session bean. The following packages cannot be found: import javax.ejb.LocalBean; import javax.ejb.Stateful; import javax.ejb.TransactionManagement; import javax.ejb.TransactionManagementType; Some solutions implied adding the libraries j2ee.jar and javaee .jar to the java build path. I am using jdk-7u75-windows-x64 and java_ee_sdk-7-windows-ml and cannot find any of these libraries at the given location($JAVA_HOME\lib). I am using eclipse(kepler) on a

Choose EJB to be injected without recompiling

末鹿安然 提交于 2019-12-18 08:46:29
问题 Imagine you have two implementations of a @Local interface @Local public interface LocalInterface { } @Stateless public class MyFirstImplementation implements LocalInterface { } @Stateless public class MySecondImplementation implements LocalInterface { } And I want to choose, without recompiling the project (that is, at runtime or using an external configuration property) which one (MyFirstImplementation or MySecondImplementation) I want to use. public class MyClass { @EJB LocalInterface

Choose EJB to be injected without recompiling

北城余情 提交于 2019-12-18 08:45:30
问题 Imagine you have two implementations of a @Local interface @Local public interface LocalInterface { } @Stateless public class MyFirstImplementation implements LocalInterface { } @Stateless public class MySecondImplementation implements LocalInterface { } And I want to choose, without recompiling the project (that is, at runtime or using an external configuration property) which one (MyFirstImplementation or MySecondImplementation) I want to use. public class MyClass { @EJB LocalInterface

How does Gradle resolve the javaee-api dependency to build an EAR?

蓝咒 提交于 2019-12-18 07:24:39
问题 I see that there's an EAR plugin for Gradle. How is it used to build an EAR ? Yes, there's an ear task. To build an EAR with an EJB module there's a dependency on java-ee. How is that dependency resolved? https://virgo47.wordpress.com/2015/05/13/why-gradle-doesnt-provide-provided/ http://www.lordofthejars.com/2015/10/gradle-and-java-ee.html http://www.adam-bien.com/roller/abien/entry/the_only_one_dependency_you I don't mind reading the fine manual -- just please specify a chapter at least

Portable JNDI Syntax lookup for EJB on Glassfish

为君一笑 提交于 2019-12-18 07:23:19
问题 Previous attempts were to have Netbeans deploy an EJB module, which builds as a JAR rather than an EAR, onto the Glassfish server which Netbeans has access to. However, deploying that JAR to Glassfish through the CLI with asadmin possibly runs into a bug. The EAR deploys through the CLI without issue -- however, the JNDI names for the EJB doesn't appear to work. What is the discrepancy? 32.4.1.1 Portable JNDI Syntax Three JNDI namespaces are used for portable JNDI lookups: java:global, java

Inject PersistenceContext with CDI

99封情书 提交于 2019-12-18 07:01:57
问题 Currently, I'm using PersistenceContext to inject an EntityManager. The EM is injected perfectly. @Stateless public StatelessSessionBean implements StatelessSessionBeanLocal { @PersistenceContext(unitName = "MyPersistenceUnit") private EntityManager em; @Override public Collection<MyObject> getAllObjects(){ CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriqQuery<MyObject> query = cb.createQuery(MyObject.class); query.from(MyObject); return em.createQuery(query).getResultList(); } } Now I

Inject PersistenceContext with CDI

拜拜、爱过 提交于 2019-12-18 07:01:53
问题 Currently, I'm using PersistenceContext to inject an EntityManager. The EM is injected perfectly. @Stateless public StatelessSessionBean implements StatelessSessionBeanLocal { @PersistenceContext(unitName = "MyPersistenceUnit") private EntityManager em; @Override public Collection<MyObject> getAllObjects(){ CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriqQuery<MyObject> query = cb.createQuery(MyObject.class); query.from(MyObject); return em.createQuery(query).getResultList(); } } Now I

access a Local Session Bean from another EAR?

回眸只為那壹抹淺笑 提交于 2019-12-18 05:22:50
问题 How can I call a Local Session Bean inside an EAR from another EAR, both deployed in the same Glassfish v3 domain? This is the structure: Glassfish v3 Domain1 EAR1 EAR1-EJB.jar class TestSessionBean <-- @Stateless common.jar interface TestSessionLocal <-- @Local EAR2 EAR2-EJB.jar class TestSessionBeanClient <-- @Singleton, @LocalBean common.jar interface TestSessionLocal <-- @Local TestSessionBean implements TestSessionLocal, boths EARs has common.jar. I need to use TestSessionBean from

Interceptor method not called with interceptor binding

旧巷老猫 提交于 2019-12-18 04:38:08
问题 I'm using Java EE 6 & Jboss AS7.1 and try to use interceptor binding (Example from jboss site). I have an InterceptorBinding annotation: @InterceptorBinding @Target({ ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface GeoRestrictedEquipment { } The interceptor: @GeoRestrictedEquipment @Interceptor public class GeoRestrictedEquipmentInterceptor { @EJB EquipmentDao equipmenttDao; @EJB SecurityService securityService; @AroundInvoke public Object checker

Transactions don't rollback

假如想象 提交于 2019-12-18 04:10:35
问题 I am call two methods, the first one update a table and the next one insert a record in another table. When the second transaction fails the EJB is not doing the rollback of the first transaction. This is my backing bean: @ManagedBean @ViewScoped public class TransactionTestBean implements Serializable { @EJB private TransactionTestService service; public String loadView() { return "/test/transactionTest"; } public void test() { try { service.updateTest(); } catch (Exception e) { } } } The