java-ee-5

Java EE 5 dependency injection?

99封情书 提交于 2021-02-07 06:17:21
问题 Since Java EE 5 does not have CDI, how does DI work in here? Can an EJB be injected with @EJB in a class that is a non-EJB? Can an EntityManager be injected with @PersistenceContext in a class that is a non-EJB (container managed not resource local EntityManager )? Or the only solution to bring the resources in non-EJB classes is by JNDI lookup? By non-EJB class I mean a class that is not annotated with @Stateless / @Statefull or others. 回答1: Taken from: http://www.oracle.com/technetwork

Question about xa and transaction on ejbs

白昼怎懂夜的黑 提交于 2021-01-29 10:29:54
问题 I have two question/doubt: If two ejbs are deployed in different ear or different applicationserver, and one call the other, they still required XA indipendent that each one use one or more db as ? if two ejbs are deployed in different server, both are annotated with trans type = required,and when teh first ejb call the second, a new transaction start or use the propagation of first ejb? **My ejbs are deployed on Webpshere, Jboss, WebLogic and can be written with JEE 5/6/7 technology(EJB 2/3)

Stateful bean injecting stateless bean, will they both use the same instance of EntityManagerFactory?

核能气质少年 提交于 2020-01-25 07:18:48
问题 I have a Stateful Bean injecting a JPA PersistenceUnit and another stateless bean. The stateless bean is injecting the same PersistenceUnit as well. My question is, will the EJB container inject the same instance of PersistenceUnit in both beans. I have to be very sure about the behaviour here. @Stateful public class MyStatefulBean { @PersistenceUnit(unitName = "MY_PU") private EntityManagerFactory emf; @EJB MyStatelessLocal statelessEJB; public void doSomething() { // Question will

how to implement a cache in ejb 3.0?

为君一笑 提交于 2020-01-22 15:38:51
问题 I have a customer who's stuck in an EJB 3.0 environment. No @Singleton, no bean-managed concurrency :-( Considering thread management and synchronization is forbidden by the ejb specification, how to implement a cache? In essence, I want an non-synchronized object cache for some costly operations. 回答1: The restriction of using static field and synchronization is stated in EJB 3.0 spec chapter 21.1.2. It also explains why. • An enterprise bean must not use read/write static fields. Using read

Navigate to the Same Page After Action in JSF 2

大兔子大兔子 提交于 2020-01-03 09:11:26
问题 I have a component done in JSF 1.x, this component has a command button as follows <h:commandButton ... action="#{templateController.next}" /> Where templateController was passed as an EL binding and can be any object that implements a certain interface. The generic implementation of next() was just executing code and then returning an empty string causing the same page to refresh: public String next() { ..... return ""; } Now I am trying to port that component to JSF 2, my problem is that an

java.lang.NoClassDefFoundError: HttpSessionListener

你。 提交于 2020-01-02 18:05:10
问题 I am trying to deploy a war that i didnt write and i am getting this error in my logs: java.lang.NoClassDefFoundError: HttpSessionListener i know that HttpSessionListener lives in servlet-api.jar which is found in the lib dir of tomcat(my app server). I tried including servlet-api.jar in the war's WEB-INF/lib folder, but the logs yelled at me for doing that: INFO: validateJarFile(/home/test/apache-tomcat-6.0.18/webapps/test/WEB-INF/lib/servlet-api.jar) - jar not loaded. See Servlet Spec 2.3,

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

前提是你 提交于 2019-12-30 05:24:04
问题 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. 回答1: yes it's true. that's generally

How can I improve this design that calls third party methods from JSF based front end

故事扮演 提交于 2019-12-24 10:02:45
问题 I want opinions and expert advice on design . I am developing an application using JSF2 and EJB3 and I am not using CDI. I have been given an API (jar) from an other team and there are three main methods in it. One searches the database and returns a list of cars and one returns a list of pushbikes and one returns list of boats. So basically we have three different lists of different vehicles. At the ui side user has a search form with three radio buttons one for each type of vehicle that

@Resource annotation not working properly with JBoss5.0.1

∥☆過路亽.° 提交于 2019-12-23 18:37:39
问题 I'm tring to deploy my app in JBoss 5.0.1. Some of my beans in this app are using @Resource annotations. If i understood the problem, my guess is JBoss is tring to process this annotation before spring-core. And i noticed that "Mapped-name" is mandatory for JBoss implementation of @Resource annotation. 15:53:04,037 ERROR [StandardContext] Context [/***] startup failed due to previous errors java.lang.RuntimeException: mapped-name is required for com.***.***.**ServiceImpl/XXprocess at org

Single/complete Maven dependencies for Java EE 5 API

旧时模样 提交于 2019-12-23 07:45:45
问题 Is there a single maven dependency containing whole Java EE 5 spec API. Just like <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency> for Java EE 6. I'm using JBoss 5 and want to add single (or several) dependency as provided scope and be sure that I have everyting that is available in JBoss. Maybe some kind of archetype exist for JBoss 5.x.x deployed project? 回答1: Based on maven central I think you need the following: <dependency>