java-ee

Concurrent access to a @Lock(LockType.WRITE) method

ぐ巨炮叔叔 提交于 2019-12-13 17:38:19
问题 What am i trying to accomplish: I have a JMS queue and I want to asynchronously get elements from that queue and send to a Printer. This printer is very specific and dumb so it can't queue on it's on or buffer anything at all. I must perform 5 steps in sequence on this printer and the steps of a queued elemet must not overlap the steps of another element. For each step the printer will return 1 on success and another number on failure. The current implementation is an MDB with an onMessage

@Query not working with more than one object in jpa, error - Validation failed for query for method public abstract java.util.List

依然范特西╮ 提交于 2019-12-13 17:24:49
问题 @Query is returning error when I pass more than one object in the select query. Error - Validation failed for query for method public abstract java.util.List Pojo @Entity @Table(name = "SUBJECT") public class Subject { private long id; private Long fkCode; private Long fkData; private Date assignedDate; private Data data; private Code code; //setters getters @OneToOne @JoinColumn(name="fkCode",insertable=false, updatable=false) public Code getCode() { return code; } @OneToOne @JoinColumn(name

Using SIGAR API inside a WAR file

不打扰是莪最后的温柔 提交于 2019-12-13 17:18:54
问题 I came across Sigar API from Hyperic (http://www.hyperic.com/products/sigar) which is a system information and reporting API for Java. It heavily uses JNI to gather data, and standalone version contains .SO and .DLL files in a /lib folder. It works fine in Standalone mode, but I want to use this library inside a WAR. Is there anyway to do that without specifying the lib path in "-Djava.library.path" when starting the server? I want to be able to bundle it inside the WAR file and deploy it

Glassfish4 + EJB + Spring, deploy fails

无人久伴 提交于 2019-12-13 16:58:42
问题 I am upgrading an application from Java7 on Glassfish 3.1.2.2, to Java8 on Glassfish 4.1. The application is packaged as an ear file, containing a jar-file with remote EJBs and Spring beans, as well as a war-file with a couple of servlets and some webservices. There are only some minor changes done to the actual application, compared to how it was with Glassfish 3.x, the total changes made are: Built with Java8 instead of Java7. Deployed on Glassfish 4.1 instead of 3.1.2.2 Newer version of

Looking up an EJB dynamically

百般思念 提交于 2019-12-13 16:23:02
问题 I'm developing an application on Glassfish 3. I have an EJB that looks like this: @LocalBean @Stateless public class MyBean { public void doSomething() {} } My client code (running inside the same application) looks like this: MyBean mb = (MyBean) InitialContext.doLookup(MyBean.class.getName()); According to a few sources, this should be a valid lookup method, but it throws a NameNotFoundException. What am I doing wrong? 回答1: According to what sources? I would personally use portable JNDI

EJB remove entity not working

二次信任 提交于 2019-12-13 16:15:22
问题 I'm using netbeans and generate entity class from database. All of my merge calls to insert and update entities are working perfectly, but when I try to remove an entity, it doesn't delete it from the database, and no exception is thrown. Can someone help me solved. My code below: AbstractFacade.java public abstract class AbstractFacade<T> { private Class<T> entityClass; public AbstractFacade(Class<T> entityClass) { this.entityClass = entityClass; } protected abstract EntityManager

Cannot set timeout on Resteasy Client on JBoss

瘦欲@ 提交于 2019-12-13 16:11:39
问题 I am trying to create a rest client on a JBoss EAP server, and I need to make sure that a timeout will end the connection if it gets stuck. My code looks like this: int timeout = 5000; RequestConfig defaultRequestConfig = RequestConfig.custom().setConnectionRequestTimeout(timeout).setSocketTimeout(timeout).setConnectTimeout(timeout).build(); HttpClientBuilder builder = HttpClientBuilder.create(); HttpClient httpClient = builder.setDefaultRequestConfig(defaultRequestConfig).build(); //

Exception : java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest when running Servlet [duplicate]

荒凉一梦 提交于 2019-12-13 15:23:25
问题 This question already has answers here : java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest (4 answers) Closed 3 years ago . I am working on a simple Upload JSP and Servlet tutorial outlined here : Upload Tutorial I have the system coded and my webpage finished but I am getting errors when running the application. When I click on the upload button, such as : SEVERE: Servlet.service() for servlet [UploadServlet] in context with path [/Test] threw exception [Servlet execution

Java EE declarative security, acquiring reference to a secured bean from application client

我是研究僧i 提交于 2019-12-13 15:19:01
问题 On 2 questions I would like to consult you. Background : I have written a test, Java EE application and added declarative security. The application is deployed on Glassfish 3.1. For unit testing I used JUnit with the embedded container for all beans with local interface. For the entry point of the appliaction, the SessionFacde bean, which has the only remote interface, I wrote a simple client which acquires reference to the SessionFace bean. Security annotations I applied for the

java.lang.IllegalStateException: getOutputStream() has already been called for this response [duplicate]

被刻印的时光 ゝ 提交于 2019-12-13 15:05:07
问题 This question already has answers here : getOutputStream() has already been called for this response (12 answers) Closed 5 years ago . When user clicks a certain link ,Using web services transfer document from A Remote ECM system to user machine. So I have created servlet and from Query string and get parameters from URL . Depending on parameters attributes several web services related methods were invoked to get file details and file content. now invoke file transfer between servlet and user