ejb

Is it possible to inject EJB implementation and not its interface using CDI?

元气小坏坏 提交于 2019-12-20 09:37:32
问题 My configuration is: Wildfly 8.2.0, Weld Is it possible to inject in bean and not in its interface in CDI ? @Stateless class Bean implements IBean { ... } interface IBean { ... } @SessionScoped class Scoped { @Inject Bean bean; //Fail @Inject IBean iBean; //OK } EDIT : More Info in my previous question: Stateless EJB implements interface injection failed 回答1: Yes you can, but as EJB inject the business view the only business view you are exposing is the @Local view which is the default when

Default EJB transaction mode for asynchronous methods?

故事扮演 提交于 2019-12-20 09:30:45
问题 When I have an @Asynchronous method in an EJB, and I don't specify the @TransactionAttribute , then how exactly does the container handle the transaction boundaries? Obviously, it can't use the calling thread's transaction, so what does it do? Same question, but regarding methods that are triggered by the TimerService. EDIT: I think I phrased that poorly. I already know that the default mode is 'REQUIRED'. So it should be safe to assume that those methods will always be called within a

EJB @PersistenceContext EntityManager Throws NullPointerException

荒凉一梦 提交于 2019-12-20 06:39:54
问题 I'm having a problem with injecting EntityManager by using @PersistenceContext. I try to inject EntityManager in EJB class with @PersistenceContext and I always get NullPointerException. Here is EJB class: @Stateless public class BookEJB { public BookEJB(){ } @PersistenceContext(unitName = "BookWebStorePU") private EntityManager em; public Book createBook(Book book) throws Exception { System.out.println("EM: " + em); em.persist(book); return book; } public Book findBookByIsbn10(String isbn10)

How to propagate a client-side UserTransaction into a stateless session bean using BMT

£可爱£侵袭症+ 提交于 2019-12-20 05:17:05
问题 This scenario using CMT is working: Stateless session bean with CMT, one method annotated with @TransactionAttribute(TransactionAttributeType.MANDATORY) . Within this method, a record is written into a RDBMS using an XA data source and plain JDBC. The stand-alone client (separate JVM, command-line Java application) is getting a UserTransaction from the application server (by JNDI lookup), starts the transaction, and calls the EJB. If the client commits the UserTransaction , the record is

WFLYNAM0027 : ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory

主宰稳场 提交于 2019-12-20 04:31:06
问题 Enviornment- wildfly-9.0.2.Final, EJB 3.0 Following error occurred while trying to connect Test.java class(deployed as module at wildfly-9.0.2.Final@machine-A) to EJB whilch is deployed on jboss at machine-B(291.861.301.732). 17:02:46,666 ERROR [stderr] (default task-1) javax.naming.NamingException: WFLYNAM0027: Failed instantiate InitialContextFactory org.jboss.naming.remote.client.InitialContextFactory from classloader ModuleClassLoader for Module "deployment.test.ear.test.war:main" from

Enabling EJB Injection into Vaadin 7 UI via Usage of Vaadin-CDI-Integration Addon

本小妞迷上赌 提交于 2019-12-20 04:18:05
问题 I wasn't able to successfully integrate the official Vaadin-CDI-Integration-Addon, since after finishing the official integration instructions, the following Exception was thrown in case I reloaded the already published URL localhost:8080/App/?restartApplication . javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.IllegalStateException: UI id has already been defined The following little workaround is a tested, working solution, which completes the official

ejbFacade is null

╄→гoц情女王★ 提交于 2019-12-20 02:54:22
问题 I call the managedBean OverzichtAlle.java from the jsf page overzichtAlleGroepen.xhtml But when I get on this page i get the errormessage can't instantiate managedBeans.OverzichtAlle due to a Nullpointerexception... When I debug, I see that my ejbFacade is null.. this is the EJB @EJB private ProjecttypeEFacade ejbFacade; and this is my constructor: public OverzichtAlle() { projE = ejbFacade.findAll(); omvormenProjectTypes(); } projE is a List (entity-list) What am i doing wrong? 回答1: @EJB s

Is it possible to define a servlet filter for a stateless ejb webservice, on GlassFish 3.1

你。 提交于 2019-12-20 02:39:18
问题 I want to export a Web-Service which was implemented as a stateless EJB. I know that these WebServices were hanled by the EJB Container, when they are annotated as @Stateless + @Webservice. Is it possible to route all incoming requests to this Webservice through a Servlet-Filter. The Servlet-Filter works when my Java-Class is annotated @Stateful and @Webservice, or just @Webservice. But not in conjunction with @Stateless. Anyway to register a Servlet Filter for an EJB Webservice? Many thanks!

Automatic EJB Timer on Glassfish Server not triggering

落爺英雄遲暮 提交于 2019-12-20 01:59:13
问题 So I'm running a Java EAR application on a Glassfish 3.1. I created a stateless session bean with a single annotated timer function in my EJB Module. I don't have the exact code but it looks something like this: @Stateless public class SessionTimerBean { public SessionTimerBean(){ System.out.println("Constructor Called"); } @Schedule(second="*/10", minute="*", hour="*") public void scheduleTimer(final Timer t) { System.out.println("Timer Called"); } } When I launch Glassfish the debug info

Does OpenJPA work well with Glassfish?

空扰寡人 提交于 2019-12-19 21:20:28
问题 Is anyone successfully using OpenJPA with Glassfish? I'm trying to use OpenJPA 2.1 with Glassfish 3.1 Open Source. I've followed the instructions to integrate the two here -> http://weblogs.java.net/blog/ss141213/archive/2006/07/using_openjpa_a.html I have a very simple EJB project in Eclipse Indigo with the following: com.rares.test.Person - @Entity com.rares.test.PersonManager - interface com.rares.test.PersonDao - @Stateless However, when I try to deploy I get a ClassNotFoundException on