ejb-3.0

CDI params in @PostConstruct

前提是你 提交于 2019-12-10 11:26:55
问题 I think my question is similar to this but haven't found it to work <f:metadata> <f:viewParam id="id" name="id" value="#{detailsBean.id}"/> </f:metadata> Why can't I do this with @Named and utilize CDI: @Named @RequestScoped public class DetailsBean { private Contacts detailsContact; @EJB ContactsFacade contactsEJB; private int id; public DetailsBean() { System.out.println("details bean called"); } @PostConstruct public void onLoad() { detailsContact = contactsEJB.find(id); } I'm not able to

Possible to access remote EJBs from a custom LoginModule?

ぃ、小莉子 提交于 2019-12-10 11:02:07
问题 I found some nice hints on how to write a custom realm and loginModule. I'm wondering though if it is possible to access a remote EJB within the custom loginModule. In my case, I have remote EJBs that provide access to user-entities (via JPA) -- can I use them (e.g. via @EJB annotation)? 回答1: Ok, I found the answer myself: works fine! I can get a reference to the remote SLSB via an InitialContext. Here's the code: public class UserLoginModule extends AppservPasswordLoginModule { Logger log =

mulitple queues in EJB messagedriven annotation

白昼怎懂夜的黑 提交于 2019-12-10 10:45:55
问题 I have 3 queues and these three queues need to be listened by MDBbean and accordingly based on reading input, i will split out the task for each category of input. As of now, the code is working fine for only one queue and i don't know how to implement it for more than one queue. Could you please guide me @MessageDriven(mappedName="receiver1") public class MDBMessages implements MessageListener How i can make my MDBMessage to listen for receiver2 and receiver 3 queue. Thanks Prabhakar 回答1:

WebLogic ERROR: No credential mapper entry found for password indirection user=db_user?

别说谁变了你拦得住时间么 提交于 2019-12-10 09:35:16
问题 Every time I try to deploy my EJB service app to Weblogic 10.3 server, I get following error: java.security.PrivilegedActionException: weblogic.common.ResourceException: java.security.PrivilegedActionException: weblogic.common.ResourceException: No credential mapper entry found for password indirection user=db_user for data source my_ds How to solve this?? 回答1: The Oracle forums have posted a solution for this, if you are deploying to another Weblogic server other than the Integrated one with

How to use Container Managed Transaction (CMT) with JBoss AS 6, Hibernate 3.6, JPA, JTA and EJB3

浪子不回头ぞ 提交于 2019-12-10 09:27:53
问题 I'm attempting to setup a web app using CMT. I've got it running standalone within Eclipse ok, and now I'm trying to get it working within Jboss AS 6, using Struts 1.0. I've chosen CMT because the doco I've read hints that it's the best and "least verbose to use". So seems like contempory/good-practice use of Hibernate 3.6. I can load objects from a MySQL database with the following code extracts, but persisted objects are not being flushed/synchronised/saved to the database: From within

How do I start with EJB3 and JBoss?

守給你的承諾、 提交于 2019-12-10 08:31:31
问题 I'd like to get into ejb3 to gain some practice in writing for it. I searched for tutorials and how-to's but could find some scarce unhelpful information. I'm looking for a tutorial or walkthrough that will guide me from the very basics (Which software do I need to install?) to write a "Hello World" for EJB3 with JBoss. In short - Where do I start? Thanks! 回答1: It would make sense to start with JBoss Seam as it's an easy introduction into EJB3 (and JSF). Have a look at their "Getting Started"

Using EJB interceptors after a method call

我与影子孤独终老i 提交于 2019-12-10 01:52:42
问题 I know one can use interceptors before a method call by using the @AroundInvoke annotation. What I would like to do is execute certain code after the method call, so that I can for example create a log entry before and after a method execution. Is this possible with EJB3, or do I need to use AOP? 回答1: @AroundInvoke interceptor is passed InvocationContext, and proceed() must be called to advance the method. Thus: @AroundInvoke public Object log(InvocationContext ic) throws Exception { logEntry

Interface between two related JPA entities

ぐ巨炮叔叔 提交于 2019-12-09 22:17:42
问题 The scenario is as below (tables shown) Delivery table ------ id channelId type 10 100 fax 20 200 email Fax table ---- id number 100 1234567 101 1234598 Email table ----- id email 200 a@a.com 201 b@b.com basically a one to one relationship between the delivery and the channel entity but since each concrete channel(fax, email) has different members I want to create a generic interface (channel) between the two entities and use it for the @OneToOne relationship. Seems to me a simple scenario

call method on server startup [duplicate]

℡╲_俬逩灬. 提交于 2019-12-09 15:49:01
问题 This question already has answers here : Is there a way to run a method/class only on Tomcat/Wildfly/Glassfish startup? (3 answers) Closed 2 years ago . I am trying to call a method when my webapplication starts. The purpose is to kick-off a timer that does some work at defined intervals. how do i call a function helloworld when my jboss 7.1 web application starts up? 回答1: Other then ContextListeners, you can also have a servlet in web.xml loading on startup: <servlet> <servlet-name>mytask<

What is EJB alternative in Spring Framework

╄→尐↘猪︶ㄣ 提交于 2019-12-09 13:04:43
问题 I am trying to learn Spring Framework, before that I used to create application with EJBs [Web services]->[Business Layer]->[DAO Layer] | [Database] in following way WebServices : Restful API using Jersey with url mappings , that support both JSON and XML format( news/list.json , news/list.xml ). Once a request is received by an endpoint(url-mapped-method) it is forwarded to a relevant EJB through lookup(remote, local). EJB process every thing, apply business rules and return result as DTO