ejb-3.0

Server-initiated Rendering: EJB -> FacesContext?

*爱你&永不变心* 提交于 2019-12-04 15:37:29
I've already asked this question on the Icefaces forum, but meanwhile I realized that this is a more generic problem. I'd like to update parts of a JSF page when I get a message in my MDB. The problem is, how do I get the FacesContext from the EJB container? In the message processing function FacesContext.getCurrentInstance() returns null. I've also tried to make a JSF managed bean be a MDB, but I couldn't (it seems you can't have both in the same class?). Since I'm a beginner in the JSF world I'm kind of stuck now. Is there a way to make it work? (Glassfish v3 + Netbeans 6.8, JSF2 + Icefaces

EntityManager injection results in NullPointerException

一个人想着一个人 提交于 2019-12-04 14:48:00
I'm writing my first Java EE (EJB + Servlets etc.) application (please note: I'm using Eclipse). I'm stuck with a problem with EntityManager injection not working, and having some difficulties finding why due to my Java EE (and Java in general) noobness. Here is my persistence.xml file - I think this is mostly correct, since I can launch the HSQL database manager from the JMX console and my PUBLIC.USER table shows up correctly. <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

Transaction TransactionImple ActionStatus.ABORTED was already rolled back

為{幸葍}努か 提交于 2019-12-04 14:22:57
I realize a migration of a DTO Business from TomEE to JBoss . I have this entity : @NamedQueries({ @NamedQuery(name = "common.plagebusiness.plage.getAllPlages", query = "SELECT p FROM Plage p ORDER BY p.plageRgMax, p.plageCReseau") }) @Entity @Table(name = "PLAGE") public class Plage { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "idPlage") private Integer idPlage; @Column(name = "rgMin") private String plageRgMin; With this Interface : @Local public interface PlagePersistenceManager { public void importPlages(List<DetailFH55> listeEnregDetail) throws

How to test EJB method call with Arquillian Weld EE Embedded

我的梦境 提交于 2019-12-04 12:02:28
I would like to test an EJB, and I want to test it with Weld EE Embedded as I don't want to deploy an applicatoin server for that. Here is my class : @RunWith(Arquillian.class) public class EJBTest { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap .create(JavaArchive.class, "test.jar") .addAsManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); } @Stateless public static class SomeService { public String someMethod() { return "test"; } } @Inject SomeService someService; @Test public void testStatelessCall() { Assert.assertEquals("test",

Caching remote EJB 3.0 reference

倖福魔咒の 提交于 2019-12-04 11:50:47
问题 I was thinking how could i save time on looking up remote ejb reference through jndi. I had an application that needed to work very fast, but it also had to call remote ejb which slowed it down. So my solution was something like this: I took apache commons-pool library and used its StackObjectPool implementation for my remote ejb references cache. private static final ObjectPool pool = new StackObjectPool(new RemoteEjbFactory()); Factory looks something like this: public static class

Is using data transfer objects in ejb3 considered best practice

风格不统一 提交于 2019-12-04 10:26:12
问题 Although obviously not all scenarios can be covered by a single design, is it generally felt now that ORM classes should be passed to and fro between the presentation and business layer (either local or remote), replacing the need for data transfer objects? As far as I can see, using ORM classes presents problems of unnecessary eager loading, context management issues and tight coupling, but also saves a great deal of time and keeps things simple. Is there now a standard approach that

javax.naming.NameNotFoundException

时光毁灭记忆、已成空白 提交于 2019-12-04 10:17:49
问题 I am running an example of ejb using JBoss5 Container. I am using an example from here(Part one). In the example I deployed bean in JBoss and an application in Tomcat(to acces the bean from JBoss). I am getting the error in the screen of tomcat server javax.naming.NameNotFoundException: greetJndi not bound ( greetJndi is the jndi-name in jboss.xml file ) Is there any specific directory structure to deploy in JBoss? Thanks 回答1: I am getting the error (...) javax.naming.NameNotFoundException:

What is an Enterprise Java Bean really?

柔情痞子 提交于 2019-12-04 09:15:43
问题 On the Tomcat FAQ it says: "Tomcat is not an EJB server. Tomcat is not a full J2EE server." But if I: use Spring to supply an application context annotate my entities with JPA annotations (and use Hibernate as a JPA provider) configure C3P0 as a connection pooling data source annotate my service methods with @Transactional (and use Atomikos as JTA provider) Use JAXB for marshalling and unmarshalling and possibly add my own JNDI capability then don't I effectively have a Java EE application

How to configure embedded OpenEJB container for tests properly?

感情迁移 提交于 2019-12-04 08:18:10
This is my SLSB: @Stateless public class MyService { PersistenceContext(unitName = "abc") EntityManager em; public boolean exists(int id) { return this.em.find(Employee.class, id) != null; } } This is my persistence.xml (I'm using Glassfish v3): <persistence> <persistence-unit name="abc"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/MyDS</jta-data-source> <properties> <property name="hibernate.archive.autodetection" value="class" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" /> </properties> </persistence-unit> <

Top reason not to use EJB 3.0 again?

可紊 提交于 2019-12-04 05:55:48
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? Yes : Don't answer this question, answer this one instead. No : Provide the top reason for not using EJBs again, based on your personal experience. Let the answer contain just one reason. This will let other readers vote up the number one reason to stay away from EJB 3. The project did not have any of the problems that EJBs are supposed to solve. Using EJBs just made it harder to code, to