ejb-3.1

EJB 3.1 container managed concurrency vs. synchronized

▼魔方 西西 提交于 2019-11-30 09:07:30
I've started reading about the singleton session bean and the annotations used to employ container managed concurrency. I don't see the benfit of this compared to simply using the 'synchronized' keyword, so I suspect there is something important I am missing. Consider this example from the book " Enterprise JavaBeans 3.1 " by Rubinger & Burke, O'Reilly: @javax.ejb.Lock(javax.ejb.LockType.READ) public String concurrentReadOnlyMethod(){...} @javax.ejb.Lock(javax.ejb.LockType.WRITE) public void allowOnlyOneWriteAtATimeMethod(String stringToSet){...} How is this better than omitting the annotation

In TDD, why OpenEJB and why Arquillian?

霸气de小男生 提交于 2019-11-30 07:25:46
I'm a web developer ended up in some Java EE development (Richfaces, Seam 2, EJB 3.1, JPA). To test JPA I use hypersonic and Mockito. But I lack deeper EJB knowledge. Some may argue that we should use OpenEJB and Arquillian, but for what? When do I need to do container dependent tests? What are the possible test scenarios where I need OpenEJB and Arquillian? Please enlighten me :) Piotr Nowicki There are two aspects in this case. Unit tests . These are intended to be very fast (execute the whole test suite in seconds). They test very small chunks of your code - i.e. one method. To achieve this

Can the EJB 3.1 @Schedule be configured outside of the application code?

穿精又带淫゛_ 提交于 2019-11-30 04:54:34
How can I configure a schedule intervals: @Schedule(persistent=true, minute="*", second="*/5", hour="*") outside of the application code? How can I configure it in ejb-jar.xml? Can I configure it outside the application (kind of properties file)? Here is an example of a scheduling in the deployment descriptor: <session> <ejb-name>MessageService</ejb-name> <local-bean/> <ejb-class>ejb.MessageService</ejb-class> <session-type>Stateless</session-type> <timer> <schedule> <second>0/18</second> <minute>*</minute> <hour>*</hour> </schedule> <timeout-method> <method-name>showMessage</method-name> <

WELD-001408 Unsatisfied dependencies when injecting EJBs that implement interfaces

回眸只為那壹抹淺笑 提交于 2019-11-30 03:41:18
Here is the situation. I've got the following interfaces: public interface Parent { } public interface ChildOne extends Parent { } public interface ChildTwo extends Parent { } and 2 EJBs: @Stateless public class FirstBean implements ChildOne { } @Stateless public class SecondBean implements ChildTwo { } And also this CDI Bean: @Named @SessionScoped public class TestController implements Serializable { @Inject private FirstBean firstBean; @Inject private SecondBean secondBean; } While trying to deploy this on Glassfish 3.1 I get the following exception: Exception while loading the app : WELD

Difference between @Stateless and @Singleton

泄露秘密 提交于 2019-11-29 23:54:20
I'm following this tutorial which also uses an EJB: package exercise1; import java.util.Random; import javax.ejb.Stateless; import javax.inject.Named; @Stateless public class MessageServerBean { private int counter = 0; public String getMessage(){ Random random = new Random(); random.nextInt(9999999); int myRandomNumber = random.nextInt(); return "" + myRandomNumber; } public int getCounter(){ return counter++; } } Here is an output example: Hello from Facelets Message is: 84804258 Counter is: 26 Message Server Bean is: exercise1.MessageServerBean@757b6193 Here's my observation: When I set the

EJB 3.1 or Spring 3.. When to choose which one?

試著忘記壹切 提交于 2019-11-29 19:58:04
EJB achieved many improvements in 3.x versions, Spring is also commonly used and version 3 is a good alternative. There are many articles on web, but no exact comparison about ejb3x versus spring3x.. Do you have any ideas about them, in real world examples which one is better at which conditions? For example, we want to separate db and server, which means our application will be on a server, our database will be in another server.. EJB remoting vs Cluster4Spring etc ? Doing everyting @Annotation is always good? configuration never needed? For your use case where the application runs on one

Jboss AS 7.1.1 ejb 3 : EJB pool error

孤街醉人 提交于 2019-11-29 16:06:30
We have an application running on Jboss AS 7.1.1 and uses EJB 3. We are intermittently seeing the following errors javax.ejb.EJBException: JBAS014516: Failed to acquire a permit within 5 MINUTES at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:109) at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47) at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor

Pass Default Application Context to Remote EJB Anonymously

拈花ヽ惹草 提交于 2019-11-29 15:49:45
问题 I have a complicated scenario, for which i have no idea how to go about: I have my ejbs running in a remote server. And my web application running in a different server. I have an ApplicationContext, that will differ based on domain, language, country etc. I would like this application context to be passed to the remote EJB anonymously, in such a way that developers dont have to invoke all of their backend requests with the ApplicationContext as a parameter. This is the scenarion, lets says i

Jetty 8 + EJB 3.1 + JTA + CDI + JPA 2 stack?

早过忘川 提交于 2019-11-29 14:34:15
问题 Can anyone tell me if it is currently possible to "glue together" a partial Java EE 6 Web Profile over Jetty? I've found a lot of articles about integrating standalone EJB 3 containers, JTA providers, etc with older Jetty versions, so I wounder if I could make it all work together. I would like to assemble a Servlet 3.0 + CDI + EJB 3.1 + JTA (if needed, all I really want is declarative transaction management) + JPA 2 environment over Jetty 8 (or Tomcat 7 if no Jetty alternatives are available

Need clarification on JMS vs ActiveMQ bean/resource configuration

此生再无相见时 提交于 2019-11-29 11:01:28
There appears to be some inconsistency on how to use JMS resources, and setting up activationConfig with proper @ActivationConfigProperty on a @MessageDriven annotation. First, here is my resource config ( glassfish-resources.xml , but translatable to other deployment descriptors). This is applied to Glassfish ( asadmin add-resources glassfish-resources.xml ) along with the ActiveMQ Resource Adapter : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources