Questions tagged [ejb-3.0]

This tag is used for question related to the session bean and message-driven bean component types of the EJB 3.0 programming model. For questions about the persistent entities defined in the document "Java Persistence API" of the EJB 3.0 specification, use the [JPA] tag.

JSR 220: Enterprise JavaBeans 3.0

The Enterprise JavaBeans architecture is a component architecture for the development and deployment of component-based business applications.

The purpose of Enterprise JavaBeans (EJB) 3.0 is to improve the EJB architecture by reducing its complexity from the developer's point of view.

The goal of EJB 3.0 is to target ease of development, the main theme of the Java EE 5 platform release. EJB 3.0 is a major simplification over the APIs defined by the EJB 2.1 and earlier specifications. The simplified EJB 3.0 API allows developers to program EJB components as ordinary Java objects with ordinary Java business interfaces rather than as heavy weight components. Both component and client code are simplified, and the same tasks can be accomplished in a simpler way, with fewer lines of code. Because it is much simpler, EJB 3.0 is also much faster to learn to use than EJB 2.1.

2345 questions
12
votes
4 answers

Is it safe to inject an EJB into a servlet as an instance variable?

We all know that in the web tier there is the possibility that only a single instance of a given Servlet exists which services multiple requests. This can lead to threading issues in instance variables. My question is, is it safe to inject an EJB…
Brett Hannah
  • 4,307
  • 4
  • 30
  • 33
12
votes
3 answers

EJB 3 or Hibernate 3

Regarding a Java EE Web application which is going to be served by a full Java EE Application server e.g. GlassFish, which is the best ORM Solution? EJB 3 or Hibernate 3 And why?
ehsun7b
  • 4,796
  • 14
  • 59
  • 98
12
votes
3 answers

Replace EJBAccessException stacktrace logged by JBoss

I have a REST endpoint in my application that is protected with EJB security. @Path("/somepath") @Produces(MediaType.APPLICATION_JSON) @Stateless @SecurityDomain("mydomain") @RolesAllowed({"user"}) public class MyResource extends…
Aleksandr Kravets
  • 5,750
  • 7
  • 53
  • 72
12
votes
2 answers

Using the client jar in EJB 3 and design patterns

I'm new to EJB 3 and pretty confused with some doubts which Google didn't provide with a satisfactory answer. I'm trying to create a framework with some base classes and some utility methods which my other applications can use. All applications are…
jobinbasani
  • 2,075
  • 6
  • 47
  • 66
12
votes
3 answers

Injecting a static EJB, nonsense?

I want to write this piece of code : @Stateless public class MyEjb { @EJB private static MyOtherEjbWhichIWantStatic myOtherEjb; } It makes sense to me, that I want to inject an EJB in my class, as a static element, for various reason. Java…
Cyril Gandon
  • 16,830
  • 14
  • 78
  • 122
12
votes
7 answers

What is an Enterprise Java Bean really?

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…
Dave
  • 21,524
  • 28
  • 141
  • 221
12
votes
3 answers

JPA/EJB3 Relationship

I have been reading about JPA and EJB3 and would like to confirm that my understanding of their relationship is correct. Here's what I think I know... JPA is a specification that has been implemented by a number of vendors…
sdoca
  • 7,832
  • 23
  • 70
  • 127
12
votes
2 answers

What are the main differences between EJB 2.0 and EJB 3.0 in the orientation of an object

I want to try EJB and I am studying the theory behind EJB 3.0. I know that in EJB 3.0 you don't have to use deployment descriptor but you can use annotations, and also you don't have to write Home and Remote Interfaces. Are there any other key…
Avraam Mavridis
  • 8,698
  • 19
  • 79
  • 133
12
votes
2 answers

Error invoking timeout for timer - could not obtain lock within 5MINUTES at EJB 3 timerservice

I have an application running on jboss 6.1 that defines a lot of dinamyc timers at the startup (e.g doSomething every minute) based on informations already persisted on the database. The timers are created programmatically based on these…
jonfornari
  • 530
  • 1
  • 4
  • 20
12
votes
6 answers

Is using data transfer objects in ejb3 considered best practice

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…
El Moz
  • 123
  • 1
  • 5
11
votes
11 answers

Singleton in Java App Server.. How bad of an idea is this?

I am currently working on some older java code that was developed without App Servers in mind. It is basically a bunch of "black box code" with an input interface, and an output interface. Everything in the "black box" classes are static Data…
mainstringargs
  • 13,563
  • 35
  • 109
  • 174
11
votes
1 answer

Transaction is alternating Timeouts

I am using jboss 5.1.x, EJB3.0 I have MDB which listens to JMS queue. when the MDB taking a message, it dispatch a msg via TCP to some modem. sometimes that Modem doesnt response when the server is waiting for an answer: byte[] byteData =…
rayman
  • 20,786
  • 45
  • 148
  • 246
11
votes
5 answers

Where can I find good unit testing resources for EJB and J2EE?

Which online resources, tutorials or books can you recommended to get started with unit testing J2EE / EJB3 applications? So far I have found ejb3unit, Jakarta Cactus (retired 2011/08) and the Maven Cargo plugin. It would be helpful if there are…
mjn
  • 36,362
  • 28
  • 176
  • 378
10
votes
1 answer

WebSphere 7. Inject EJB from another application

I am trying to inject an EJB with the @EJB annotation: when I inject an EJB into another EJB in the same ear it works fine. when I inject an EJB into another EJB from another ear in the same server I get an exception: EJB threw an unexpected…
Denis Tulskiy
  • 19,012
  • 6
  • 50
  • 68
10
votes
3 answers

Read Environment Variables in persistence.xml file

I want to read environment variables inside persistence.xml file. Idea is that i don't want my database details to be read from properties file as there is a change of getting properties file override.Instead i want to read details from environment…
Prathap
  • 1,023
  • 7
  • 19
  • 33