java-ee-6

I need a thread in Web/JavaEE container to complete AsyncContext objs in same JVM

邮差的信 提交于 2019-12-24 02:13:20
问题 I need a thread in Web/JavaEE container to fetch information from an external source and complete corresponding AsyncContext objs in same JVM. I wish to have a zero-added-latency solution, so periodic polling or a timer is ruled out. I could start a thread but I believe it is frowned upon in a Web container and not portable. Q1. Is it possible to run a thread portably in a Java EE container instead? Q2. If I want to run a thread in a Web Container anyway, what is the "least of all evil" ways?

Bean Validation Through JPA Relationships

萝らか妹 提交于 2019-12-24 00:12:24
问题 I would like to use Bean Validation to annotate constraints in my entities , now the question is, will the relationships on the entities be validated as well?. For example suppose I have the following entities: @Entity @Table(name = "css_empresa") public class Empresa extends EntidadContactable implements Serializable, Convert { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name = "EMPRESA_ID_GENERATOR", sequenceName = ConstantesSecuencias.SEQ_EMPRESA)

Passivation issue with Stateful Session Bean

痞子三分冷 提交于 2019-12-23 19:55:34
问题 I'm using JBoss 6.1 Final, and get the following error message after my web application is running for a while (note the application doesn't crash), followed by a very long stack trace. I notice that this problem only occurs with stateful session beans that have other stateful session beans injected into them. 16:10:59,769 ERROR [org.jboss.ejb3.cache.simple.SimpleStatefulCache.UutSerialNumberServiceBean] problem passivation thread: javax.ejb.EJBException: Could not passivate; failed to save

Does it make sense to have static methods in stateless ejbs?

痴心易碎 提交于 2019-12-23 19:09:56
问题 Stateles ejbs are intended to be idempotent and have no memory of previous user interactions. That sounds like a static method to me. so instead of having public void save(Entity e) { em.persist(e); } is it safe to have public static void save(Entity e) { em.persist(e); } inside an EJB? 回答1: No, because static methods do not participate in container-managed transactions, AOP, security, etc. BTW your second example won't compile, em is injected by the application server and it can't be static

How to modularize an Enterprise Application with OSGi and EE6?

跟風遠走 提交于 2019-12-23 09:38:03
问题 I know that there are already some questions related to this topic but I couldn't find a real solution yet. Currently I am developing applications with EE6, using JPA, CDI, JSF. I would like to take a more modular approach than packaging everything into a WAR or EAR and deploy the whole thing on an Application Server. I am trying to design my applications as modular as possible by separating a module into 3 maven projects: API - Contains the interfaces for (stateless) services Model -

WELD-001408 Unsatisfied dependencies when injecting EntityManager

半城伤御伤魂 提交于 2019-12-23 08:53:19
问题 I have @Stateless bean which implements two interfaces (remote and local). I have also added @LocalBean anotation for accessing bean with a no-interface view. @Stateless @LocalBean public class WeatherDataBean implements WeatherDataBeanRemote, WeatherDataBeanLocal { @Inject private EntityManager entityManager; public WeatherDataBean () { } // ....attributes, getter & setter methods .... } I use @Inject for this reason taken from this example of JBoss AS7 quickstart: We use the "resource

WELD-001408 Unsatisfied dependencies when injecting EntityManager

孤者浪人 提交于 2019-12-23 08:52:20
问题 I have @Stateless bean which implements two interfaces (remote and local). I have also added @LocalBean anotation for accessing bean with a no-interface view. @Stateless @LocalBean public class WeatherDataBean implements WeatherDataBeanRemote, WeatherDataBeanLocal { @Inject private EntityManager entityManager; public WeatherDataBean () { } // ....attributes, getter & setter methods .... } I use @Inject for this reason taken from this example of JBoss AS7 quickstart: We use the "resource

ui:repeat using the same client id. c:foreach works fine

随声附和 提交于 2019-12-23 03:11:58
问题 I know this may have something to do with the phase each one comes in at. If I do this. <ui:repeat id="repeatChart" varStatus="loop" value="#{viewLines.jflotChartList}" var="jflotChart"> <p:panel> <jflot:chart height="300" width="925" dataModel="#{jflotChart.dataSet}" dataModel2="#{jflotChart.dataSet2}" xmin="#{jflotChart.startDateString}" xmax="#{jflotChart.endDateString}" shadeAreaStart ="#{jflotChart.shadeAreaStart}" shadeAreaEnd ="#{jflotChart.shadeAreaEnd}" lineMark="#{jflotChart

Create EJB with two interfaces. @Local interface for web module and @Remote interface for local app client

可紊 提交于 2019-12-23 03:11:55
问题 I have a EAR package that contains a web module and EJB. The EJB is currently exposed its contains to local app client via Remote interface @Stateless public class CoreEJB implements CoreEJBRemote { @PersistenceContext(unitName = "CoreWeb-ejbPU") private EntityManager em; @Override public void packageProcess(String configFileName) throws Exception { //Process logics } @Override public <T> T create(T t) { em.persist(t); return t; } @Override public <T> T find(Class<T> type, Object id) { return

ejb - Details requried on javax.annotation.ManagedBean

╄→гoц情女王★ 提交于 2019-12-22 11:35:23
问题 There is lot of information about Stateless, Stateful and Sigleton beans everywhere but almost nothing about javax.annotation.ManagedBean . At a first look I assumed that It's be similar to Spring's @Component but I can't use it without complete information. If I annotate a class with @javax.annotation.ManagedBean will it be singleton or it will have instance pool like stateless? Will the methods inside such class be concurrent? I should make sure as in a singleton they are synchronized by