ejb

Accessing @Local Session Bean from an exposed RESTeasy interface

杀马特。学长 韩版系。学妹 提交于 2019-12-22 16:53:00
问题 What I am trying to do should be very straight forward BUT thus far has been impossible. Can someone tell me how to access a @Local Session Bean from an exposed RESTeasy interface? I have trawled the length and breadth of the internet and all I can find is variations of the same example I am trying to find out how I can access a session bean in the normal way using RESTeasy. This is what things look like so far: USING: EJB 3 RESTeasy 2.1 PUBLISHED EJB INTERFACE: @Local @Path("RequestReport")

Business Delegate Vs Service Locator

泄露秘密 提交于 2019-12-22 14:48:12
问题 What is the difference between Business Delegate and Service Locator.Do both responsible for encapsulating lookup and creation mechanism.If Business Delegate uses Service Locator for hiding lookup and creation mechanism then what is Business Delegate exclusively meant for, can't Service Locator replace Business Delegate. 回答1: I don't know if you already checked this out, but it's a good start. Use a Business Delegate to encapsulate access to a business service. The Business Delegate hides the

Cant inject Bean class into Restfull WebService (JAX-RS) [duplicate]

亡梦爱人 提交于 2019-12-22 12:38:15
问题 This question already has answers here : Inject an EJB into JAX-RS (RESTful service) (7 answers) Closed 3 years ago . I'm trying to save data acquired by Rest web service to database using hibernate/persistence. In one of my web modules i implemented that service. Database ejb connector is placed in EJB module. They are parts of EAR application. Every time when i call pb.addDevice() im getting java.lang.NullPointerException when puting proper url with params in browser(worked till i wanted to

Cant access EJB from a Java SE client - Lookup Failed Error

孤街醉人 提交于 2019-12-22 10:33:51
问题 I am using Netbeans and am experimenting with EJBs. I have two projects (2 separate applications) 1- A Java ME Project called EnterpriseApp 2- A standard Java SE Project called Test Now here is what I did - in EnterpriseApp I generated a stateless EJB called TestEJB with both local and remote interfaces. For the remote project selection I selected the Test App. In short the bean code looks like this @Stateless public class TestEjb implements TestEjbRemote, TestEjbLocal { @Override public

EJB Glassfish v3.1.2 client passed data to session bean is always null

本小妞迷上赌 提交于 2019-12-22 09:45:31
问题 I am having a problem when calling session bean method passing method parameters from client application, the data reaches the method call is always null or set to default value. while the process of the method works well with the object for example: -we have method to persist an object entity addStudent(Student student); - from the client we create the student object setting student fields like student name and so on, calling the method addStudent(ourStudent); this ourStudent reaches method

When should I close a JMS connection that was created in a stateless session bean?

╄→гoц情女王★ 提交于 2019-12-22 08:47:34
问题 I have a general question about when to close connections that have been created within a stateless session bean (EJB). The connections are to ActiveMQ and they are created within the bean's constructor. The connection is then used within a method, and I'm wondering when the appropriate time/place to close this connection is. Would it be appropriate to have a separate method for closing the connection, that must be called by the class using the bean? Or should I simply close the connection

What is the difference between mappedName and lookup attributes of @Resource annotation in EJB?

蹲街弑〆低调 提交于 2019-12-22 05:23:36
问题 I'm confused between two attributes of @Resource annotation. Java Documentations says : mappedName : A product specific name that this resource should be mapped to. The name of this resource, as defined by the name element or defaulted, is a name that is local to the application component using the resource. (It's a name in the JNDI java:comp/env namespace.) Many application servers provide a way to map these local names to names of resources known to the application server. This mapped name

How to prevent “Local transaction already has 1 non-XA Resource” exception?

风格不统一 提交于 2019-12-22 04:15:12
问题 I'm using 2 PU in stateless EJB and each of them is invoked on one method: @PersistenceContext(unitName="PU") private EntityManager em; @PersistenceContext(unitName="PU2") private EntityManager em2; @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW ) public void getCandidates(final Integer eventId) throws ControllerException { ElectionEvent electionEvent = em.find(ElectionEvent.class, eventId); ... Person person = getPerson(candidate.getLogin()); ... } @TransactionAttribute

JPA: check whether an entity object has been persisted or not

馋奶兔 提交于 2019-12-22 03:40:33
问题 Is there a general method that can if(entity is persisted before){ entity = entity.merge(); }else{ entity.persist(); } So the method contain above logic is safe everywhere? 回答1: If you need to know is object already in persistence context you should use contains method of EntityManager . Only EntityManager can tell you is entity persisted or not, entity does not have such information. Here you can check javadoc for contains method. if (!em.contains(entity)) { em.persist(entity); } else { em

How to lookup ejb on JBoss AS 7.x

*爱你&永不变心* 提交于 2019-12-22 00:17:12
问题 I try ejb lookup for jndi name. That ejb is same jboss server then is success. But ejb is other jboss server then is failed. My source code: Hashtable<String, String> env = new Hashtable<String, String>(); env.put("java.naming.provider.url","jnp://192.168.100.10:8484"); env.put("java.naming.factory.initial", "org.jboss.as.naming.InitialContextFactory"); env.put("java.naming.factory.url.pkgs", "org.jboss.as.naming.interfaces.java"); env.put("java.naming.security.principal", "Admin"); env.put(