ejb-3.0

EJB 3.0 JNDI lookup (Weblogic 10.x)

青春壹個敷衍的年華 提交于 2019-12-24 03:23:38
问题 I use weblogic 10.3.6 and so EJB 3.0. I have EJB and local interface. Both packaged in ejb-jar inside ear. @Local public interface TestLocal { ... } @Stateless public class TestEJB implements TestLocal { ... } To access this EJB from war I have in my web.xml <ejb-local-ref> <ejb-ref-name>ejb/TestLocal</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local>testpackage.TestLocal</local> </ejb-local-ref> And lookup looks like test = (TestLocal) new InitialContext().lookup("java:comp/env/ejb

EJB 3.0 JNDI lookup (Weblogic 10.x)

三世轮回 提交于 2019-12-24 03:23:06
问题 I use weblogic 10.3.6 and so EJB 3.0. I have EJB and local interface. Both packaged in ejb-jar inside ear. @Local public interface TestLocal { ... } @Stateless public class TestEJB implements TestLocal { ... } To access this EJB from war I have in my web.xml <ejb-local-ref> <ejb-ref-name>ejb/TestLocal</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local>testpackage.TestLocal</local> </ejb-local-ref> And lookup looks like test = (TestLocal) new InitialContext().lookup("java:comp/env/ejb

EJB3 - Session Bean calling method of another bean interface

笑着哭i 提交于 2019-12-24 02:16:11
问题 I have a little question... I search the difference in local access between accessing a method that is only declared in the remote interface of a bean and not in the local interface... does the interface declaration (remote or local) determine the access protocol of the method? or does the ejb container understand that both beans are running the same JVM? is there a big performance difference? Do you have any source about this? BR's Laurent 回答1: I would suggest testing it on your EJB

Getting ParseException on Transport.send(message)

时光毁灭记忆、已成空白 提交于 2019-12-24 00:39:41
问题 For some reason I'm getting a javax.mail.internet.ParseException when I call Transport.send() on a MimeMessage. This worked before when it was only a plain text email, but when I changed it to have both text and html it started blowing up. Any ideas what I'm doing wrong? @Resource(mappedName = "java:/Mail") private Session mailer; public void sendMessage(String toEmailAddress, String subject, String content, String text) throws Exception { try { Message message = new MimeMessage(mailer);

Concept for reusable login session in rmi ejb calls

天大地大妈咪最大 提交于 2019-12-23 17:19:03
问题 This is not a simple question its just because i'm rethinking our architecture for securing our EJB 3.0 service by a login and security. We have a EJB3.0 application on JBoss 5.1 that offers various services to a SWT client to read and write data. To use a service, the client must login with a valid user and password which is looked up by SpringSecurity in a LDAP server. SpringSecurity generates a session id which is passed back to the client to be resused in any further service call. client

How to determine type of Application Server an application is running on?

﹥>﹥吖頭↗ 提交于 2019-12-23 17:14:46
问题 Our EJB3 application can run on top of Oracle AS or JBoss AS. Is there a way to find out type of AS during runtime? 回答1: You can check the concrete type of object at runtime using reflection, e.g. the EJBContext that is injected by the app. server. 回答2: Another way is to check for an app-server specific value in System properties. // EXAMPLE: if (System.getProperty("catalina.base") != null) { // Using Tomcat ... else if (System.getProperty("jboss.server.name") != null) { // Using JBoss ...

Java ee interface conditional inject

狂风中的少年 提交于 2019-12-23 17:10:16
问题 I have the following interface: public interface ResultEvaluationInterface { public void evaluateResults(Event e); } and I want to inject in my class depending on my Event.type different classes with the same implementation. Something like that: @Stateless @LocalBean public class ResultEvaluation implements ResultEvaluationInterface { @Override public void evaluateResults(Event e) { switch (e.getType()) { case Type.Running: // inject and call ResultEvaluationRunningEJB.evaluateResults(e) case

static block is called twice, maybe multiple class loaders?

痞子三分冷 提交于 2019-12-23 16:15:59
问题 I have an MDB EJB, with static block inside it. I used the static block to initialize some components only once at the first time the application runs (i.e at deployment). The MDB EJB is deployed on a separate sever (My_Server) other than the Admin_Server. The problem is that the static block is called twice! The first time: just after deploying the MDB EJB (tageted to the My_Server). The second time: after the JMS queue (that the MDB is associated with) receives a message. Also, I printed

Simple but good pattern for EJB

两盒软妹~` 提交于 2019-12-23 15:34:45
问题 What would you suggest as a good and practical but simple pattern for a solution with: HTML + JSP (as a view/presentation) Servlets (controller, request, session-handling) EJB (persistence, businesslogic) MySQL DB And is it necessary to use an own layer of DAO for persistence? I use JPA to persist objects to my DB. Should I withdraw business logic from my EJB? All online sources tell me different things and confuses me... 回答1: I would definitely put the business logic in Stateless Session

Can I use inheritance in remote/local interfaces? (EJB3)

橙三吉。 提交于 2019-12-23 13:08:14
问题 An example: @Remote public interface SomeComponentRemote{ public Something processStuff(); } //-- @Local public interface SomeComponentLocal extends SomeComponentRemote{ } Is that allowed? Can i do this regularly? 回答1: Your way is not allowed as you can not mark your interface with both @Local and @Remote annotations according to specification. And it is not a good idea from point of code reading. Recommended solution is public interface SomeComponent { public Something processStuff(); }