java-ee-7

Can I start a ManagedThread in a Singleton Enterprise Java Bean?

≡放荡痞女 提交于 2019-12-11 19:53:56
问题 I'm trying to start a thread in a Singleton EJB but java.lang.IllegalStateException is being thrown. This is my (cut-down) class: Singleton @LocalBean @Startup public class WatcherEJB { @Resource(name = "concurrent/masterActionsThreadFactor") ManagedThreadFactory threadFactory; Thread watcherThread; @PostConstruct public void startUp() { //Setup the listener using the ThreadFactory watcherThread = threadFactory.newThread(new Runnable() { @Override public void run() { //System.out.println(

“Unsatisfied Dependencies” - Different Stateless Beans with same Interface

蹲街弑〆低调 提交于 2019-12-11 15:25:26
问题 I have three @Stateless Beans with the same interface. public interface ReportService { List<String> determineRelevantData(); Report generate(ReportRequest request, Locale locale) throws ServiceFailedException; } I inject the beans in one facade bean: @Stateless public class ReportServiceFacadeBean implements ReportServiceFacadeLocal { @Inject private FirstReportBean firstReport; @Inject private SecondReportBean secondReport; @Inject private ThirdReportBean thirdReport; [...] } When I deploy

How can I use method-parameter level validation with JSF 2.2?

好久不见. 提交于 2019-12-11 11:50:35
问题 I have created a bean validator that I apply to my bean setter method. Instead of getting a JSF validation error, I get an exception raised. Is there a way to make this work, or I should go with a traditional JSF validator? //Bean Method public void setGuestPrimaryEmail(@ValidEmail String email){ guest.getEmails().get(0).setValue(email); } //Validator interface @Target({ElementType.FIELD,ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = EmailValidator.class

JMS request/response pattern in transactional environment

自古美人都是妖i 提交于 2019-12-11 09:04:20
问题 I have an EJB module that has to synchronously exchange messages with a MDB in another module via TemporaryQueue. The EJB container (in my case it's Glassfish 4.0) assumes transactional environment, do I have to use BEAN-managed transaction and denote start and end of transactions using UserTransaction object. The outline of my code is like this: @Stateless @TransactionManagement(TransactionManagementType.BEAN) public class CommunicationJMSUtils { @Resource private UserTransaction ut; @Inject

Is it possible to deploy an application with WildFly as a bundle?

浪子不回头ぞ 提交于 2019-12-11 08:07:25
问题 Is it possible to deploy an application with WildFly as a bundle? I am able to do this with embedded Glassfish. 回答1: If you want to embed JBoss/Wildfly with your app, you should review Wildfly Swarm. That's a way to generate an application that contains the server embedded. It's very similar to Spring Boot, but you can use Java EE APIs. 回答2: As you can see in JBoss documentation there has been something for OSGi, rather than there is... To me it looks like this has died before wildfly was

Enabling Jersey trace logging causes MaxHeaderCountExceededException

心已入冬 提交于 2019-12-11 06:58:40
问题 I am trying to debug my jersey 2 app on Payara 162, but on every request, after the trace information is printed I get this exception and the client gets no response: org.glassfish.grizzly.http.util.MimeHeaders$MaxHeaderCountExceededException: Illegal attempt to exceed the configured maximum number of headers: 100 at org.glassfish.grizzly.http.util.MimeHeaders.createHeader(MimeHeaders.java:396) at org.glassfish.grizzly.http.util.MimeHeaders.addValue(MimeHeaders.java:422) at org.glassfish

JPA CascadeType.REMOVE not working

天大地大妈咪最大 提交于 2019-12-11 03:18:09
问题 I have two entities Business which is composed of a list of Departments @Entity @Table(name = "Business") public class Business implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "Id") private Long id; @OneToMany(mappedBy = "business", cascade = {CascadeType.PERSIST, CascadeType.REMOVE}) private List<Department> departments; @OneToMany(mappedBy = "business", orphanRemoval = true, cascade =

WildFly: EJB invocations from a remote client

余生颓废 提交于 2019-12-11 03:17:38
问题 I was trying to lookup and call an EJB deployed as EAR in WildFly. I have tried different ways. Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); properties.put(Context.PROVIDER_URL, "remote://localhost:4447"); properties.put(Context.SECURITY_PRINCIPAL, myUser); properties.put(Context.SECURITY_CREDENTIALS, myPassword); properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,1] (jboss-deployment-structure.xml)

半世苍凉 提交于 2019-12-11 02:28:30
问题 I want my application to use the Validation-api-1.1.0.Final jar instead of the container provided jar Validation-api-1.0.0.GA which comes with JBoss-AS-7.1.1. I created the JBoss jboss-deployment-structure.xml as follows <?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"> <deployment> <exclusions> <module name="javax.validation.api" /> </exclusions> </deployment> </jboss-deployment-structure> But I keep getting this exception below:

JBOSS - Previos execution of timer is still progress,timer state is IN_TIMEOUT

守給你的承諾、 提交于 2019-12-10 18:25:19
问题 I am using JBOSS EAP 6.4 . I have schedule some schedulers in my ScedulerBean using EJB @Shedule annotation as follows. Here the ShedulerBean is dependson StartupBean. @Singleton @DependsOn("StartupBean") public class SchedulerBean { private Logger logger = LoggerFactory.getLogger(SchedulerBean.class); private SchedulerInterface schedulerInterface; @PostConstruct public void initialize() { // some initialization } @Schedule(second = "1/1", minute = "*", hour = "*",persistent = false) public