ejb-3.0

EJB3 & How JAAS subject/principal is propagated to EJB Tier from servlet container?

北城以北 提交于 2019-11-30 15:55:16
I'm trying to understand how the JAAS principal propagates to the Business/EJB tier from web tier. I've read that the if the roles/realm is configured in login-config & security-context of web.xml then the servlet container will also transparently pass the authenticated principal to the EJB Tier. Two questions 1.) First & more importantly is that true ? Without any intervention from the developer ! 2.) And secondly any idea how that works under the hood. yes it's true. that's generally the point of ejb, to take the "hard" stuff out of the hands of the developer (e.g. security, transactions,

Mocking Reflection based calls

大憨熊 提交于 2019-11-30 14:50:18
问题 I am trying to mock some reflection based methods. Below you can see the details, Class Under Test public class TracerLog { @AroundInvoke public Object logCall(InvocationContext context) throws Exception { Logger logger = new Logger(); String message = "INFO: Invoking method - " + context.getMethod().getName() + "() of Class - " + context.getMethod().getDeclaringClass(); logger.write(message); return context.proceed(); } } Test public class TracerLogTest { @Mock InvocationContext mockContext;

What's the best way to share business object instances between Java web apps using JBoss and Spring?

老子叫甜甜 提交于 2019-11-30 14:45:59
问题 We currently have a web application loading a Spring application context which instantiates a stack of business objects, DAO objects and Hibernate. We would like to share this stack with another web application, to avoid having multiple instances of the same objects. We have looked into several approaches; exposing the objects using JMX or JNDI, or using EJB3. The different approaches all have their issues, and we are looking for a lightweight method. Any suggestions on how to solve this?

EJB3 + JEE6: What is a persistent Timer?

孤者浪人 提交于 2019-11-30 12:59:52
问题 I'm just about to use the new EJB3 TimerService (as part of Java EE 6), and as usual, I'm impressed by the brevity of JavaDoc :) Do you know what is the effect of the persistent property of the TimerConfig object? JavaDoc TimerConfig says: The persistent property determines whether the corresponding timer has a lifetime that spans the JVM in which it was created. It is optional and defaults to true. 回答1: The persistent property means that the container is required to persist the timer state

Mocking Reflection based calls

孤人 提交于 2019-11-30 12:23:16
I am trying to mock some reflection based methods. Below you can see the details, Class Under Test public class TracerLog { @AroundInvoke public Object logCall(InvocationContext context) throws Exception { Logger logger = new Logger(); String message = "INFO: Invoking method - " + context.getMethod().getName() + "() of Class - " + context.getMethod().getDeclaringClass(); logger.write(message); return context.proceed(); } } Test public class TracerLogTest { @Mock InvocationContext mockContext; @Mock Logger mockLogger; @InjectMocks private TracerLog cut = new TracerLog(); @BeforeMethod public

How can I avoid the Warning “firstResult/maxResults specified with collection fetch; applying in memory!” when using Hibernate?

≯℡__Kan透↙ 提交于 2019-11-30 11:53:50
问题 I'm getting a warning in the Server log "firstResult/maxResults specified with collection fetch; applying in memory!" . However everything working fine. But I don't want this warning. My code is public employee find(int id) { return (employee) getEntityManager().createQuery(QUERY).setParameter("id", id).getSingleResult(); } My query is QUERY = "from employee as emp left join fetch emp.salary left join fetch emp.department where emp.id = :id" 回答1: Reason for this warning is that when fetch

What's the best way to share business object instances between Java web apps using JBoss and Spring?

天大地大妈咪最大 提交于 2019-11-30 11:36:55
We currently have a web application loading a Spring application context which instantiates a stack of business objects, DAO objects and Hibernate. We would like to share this stack with another web application, to avoid having multiple instances of the same objects. We have looked into several approaches; exposing the objects using JMX or JNDI, or using EJB3. The different approaches all have their issues, and we are looking for a lightweight method. Any suggestions on how to solve this? Edit: I have received comments requesting me to elaborate a bit, so here goes: The main problem we want to

WebSphere 7. Inject EJB from another application

风流意气都作罢 提交于 2019-11-30 11:09:48
问题 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 (non-declared) exception during invocation of method "sayHello". Exception data: javax.ejb.EJBException: Injection failure; nested exception is: com.ibm.ejs.container.EJBNotFoundException: EJB with interface com.mycompany.myapp.ejb.test2 not present in

EJB stateless session beans and stateful session bean

巧了我就是萌 提交于 2019-11-30 10:09:18
I have gone through various books on stateful and stateless session bean and how they work. I want to know the real usage of these ejbs and advantages over using plain java classes. Basically when do you go for stateless ejbs and when do you go for stateful ejbs. I want a real time application. the usage of these type of ejbs are usually in service layer as service classes. EJB3 stateless and stateful bean are actually POJO (with some annotations) and they don't have any big difference with normal classes. but in term of usage, they have some abilities that you can't find in normal classes

EJB - Performance issue (having more number of EJBs have effect on the performance)

余生颓废 提交于 2019-11-30 07:41:34
We are developing an application with around 400 database tables. and have equal number of EJBs (All are Local interfaces and EJB is stateless) and one EJB is injected into another EJB by @EJB tag. My doubt is, is having more number of EJBs have any effect on the performance on the application? Configuration and tuning You might need to size the system accordingly. Usually, each EJB has an associated pool (but it's app. server specific and I have only experience with Glassfish). So if you have 400 different EJB, that may represent a significant number of object. But all that can be tuned.