ejb-3.1

Can a startup singleton bean delay a J2EE container initialization?

眉间皱痕 提交于 2019-12-13 03:46:06
问题 According to the Java EE 6 Tutorial: The EJB container is responsible for determining when to initialize a singleton session bean instance unless the singleton session bean implementation class is annotated with the javax.ejb.Startup annotation. In this case, sometimes called eager initialization, the EJB container must initialize the singleton session bean upon application startup. The singleton session bean is initialized before the EJB container delivers client requests to any enterprise

Eclipselink library java.lang.ClassNotFoundException

陌路散爱 提交于 2019-12-13 01:24:18
问题 I'm trying to resolve the problem with ClassNotFoundException for 3 days, and I can't find the solution, so I'm asking for help, the problem happens when i try to use every method except find or findAll on EJB Entity Beans. For example when I try to use method remove(): ctx = new InitialContext(); remote = (CategoriesRemote) ctx.lookup("CategoriesFacade/remote"); remote.remove(category); I get not nice looking Exception: Exception in thread "Thread-7" java.lang.RuntimeException: java.lang

JNDI name for EJB 3.1 running on JBoss 7

↘锁芯ラ 提交于 2019-12-12 23:30:13
问题 I'm trying to run this EJB example on JBoss 7 but it always throws NameNotFoundException. The EJB that I try to test is: Calculator. When I deploy it on JBoss 7 show this next lines in the server console: java:global/CalculadoraProject/Calculator!demo.CalculatorRemote java:app/CalculadoraProject/Calculator!demo.CalculatorRemote java:module/Calculator!demo.CalculatorRemote java:jboss/exported/CalculadoraProject/Calculator!demo.CalculatorRemote java:global/CalculadoraProject/Calculator java:app

How to get CDI in war AND EJB running if both are bundled in an EAR

会有一股神秘感。 提交于 2019-12-12 17:15:26
问题 I'm trying to build an enterprise application which is assembled in an EAR. This application should contain one or more ejb-jars and one or more war 's. I want to make heavily use of CDI , Interceptors and Producers. In the first step I want to use a Log-Producer which is placed in the ejb-jar in all areas of the application. What I did is creating a beans.xml in the ejb/META-INF and the war/WEB-INF/ folders. Creating the EAR works. But deploying to the Glassfish Server (3.1) fails with a

Is it possible to use @WebService, @Stateless and @Singleton altogether in one EJB 3 bean?

帅比萌擦擦* 提交于 2019-12-12 16:08:47
问题 I'm using EJB 3 and JBoss AS 6.0.0.Final. I have a stateless session bean with the annotations @Stateless and @WebService . When I add the annotation @Singleton , the deployment is in error showing the message: ...name=ServiceBean, service=ejb3 is already installed What can I do to avoid the deployment error? 回答1: You can use @WebService and @Stateless or @WebService and @Singleton in the same bean which makes perfectly sense if you want to expose a POJO as both a web service and EJB. Don't

java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistry

帅比萌擦擦* 提交于 2019-12-12 13:49:44
问题 I am using hibernate-search 5.5.4.Final with hibernate-entitymanager 5.0.9 (matched with hibernate-core 5.0.9). But when i deployed the ejb maven module on glassfish 4.1. I obtained the following exception: Grave: java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistry at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:34) at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:165) at

@EJB injection fails but JNDI lookup works in web service class in Glassfish

﹥>﹥吖頭↗ 提交于 2019-12-12 12:24:57
问题 I have a @WebService class that injects an @EJB. The EJB is packaged in a .jar file which is in the same .war file as the web service classes. The @EJB injection always fails, but I can do a JNDI lookup on the EJB. I've tried making the EJB and its interface @Remote, but that didn't matter. Injection still fails and JNDI lookup still works. I'm using a version 3.0 web.xml. There's no ejb deployment descriptor in the ejb.jar file, but that is not suppose to matter in EJB 3.1. An I missing

Calling Remote EJB in EJB 3.1

北城以北 提交于 2019-12-12 12:13:55
问题 I need to call Remote stateless EJB from another Web application with in same glassfish( 3.1 final version) which return Entity Bean( JPA 2/Eclipselink).Iam getting ejb referance in web application through Dependancy Injection ( @EJB ) but entity becoming null.I google it and found that it is might be Serializable issue. Somewhere I found this TopLink either modifies entity classes ("weaves" them) on load or substitutes collection access at runtime to be able to detect lazily accessed or

How to unit testing EJBs when using JPA2?

Deadly 提交于 2019-12-12 09:46:38
问题 How would you go about unit testing an EJB that uses JPA? For example, if I have an Order entity and and OrderEJB that is supposed to calculate the total of an order (as defined below) how would I go about unit testing the EJB without touching the database? Also, how would you define values for your entities, so you can assert the expected calculation? Here is some example code below... @Entity public class Order { @Id private long OrderId; private LineItem[] items; } And an orderEJB

Stateless Session Beans Identity with @EJB and @Inject

做~自己de王妃 提交于 2019-12-12 09:07:05
问题 I have been looking into section 3.4.7.2 of the EJB3.2 specifications lately und done some tests. The specifications: @EJB Cart cart 1 ; @EJB Cart cart 2 ; … if (cart1.equals(cart1)) { // this test must return true ...} … if (cart 1 .equals(cart 2 )) { // this test must also return true ...} The equals method always returns true when used to compare references to the same business interface type of the same stateless session bean. The specifications cite explicitly the @EJB Annotation so I