java-ee

Maven: Generate different wars from different profiles

余生长醉 提交于 2020-01-06 13:41:27
问题 I have a web application project. This project has different maven profiles (for countries and environments) with filtered properties. I have to execute many times to obtain the different wars but I would like to get all the wars in a single maven execution. Is this possible? 回答1: Maybe you can write scipt with all those maven commands 回答2: It's not quite clear from your question, but if you simply want to "run" several profiles in one maven execution, it's as easy as mvn -Pprofile1,profile2,

Why is an injected value sometimes null inside my custom ConstraintValidator?

痞子三分冷 提交于 2020-01-06 13:27:17
问题 i created a custom ConstraintValidator Annotation which called APIAuth , and i tried to fetch the remote user IP Address Using @Context HttpServletRequest , but the problem is when calling the APIAuth inside my Stateless , the APIAuth custom validator work , and it fetch the remote user ip address , but when i try to refresh the request again quickly , it throw an exception , because of @Context HttpServletRequest be null at this case , it need from me to wait some seconds before trying to

Checking if the object is new in JSTL

余生颓废 提交于 2020-01-06 12:37:12
问题 I am working on a Spring project where there are two controllers AddOwnerForm.java & EditOwnerForm.java. Both the forwarding the flow to form.jsp AddOwnerForm passes a new Owner object to jsp whereas EditOwnerForm fetches the Owner object from the db then passes it to the jsp. Below is the JSP code. Form.jsp <%@ include file="/WEB-INF/view/include.jsp" %> <%@ include file="/WEB-INF/view/header.jsp" %> <c:choose> <c:when test="${owner['new']}"><c:set var="method" value="post"/></c:when> <c

How can I identify the client or caller of an EJB within the request?

萝らか妹 提交于 2020-01-06 08:48:07
问题 I have a system where several (20 or so) web app servers (hosting a website) talk to the same 2 - 4 EJB servers (through a VIP). I'd like to know if it is possible to identify which one of those app servers generated a specific request. For example: Website example.com works by sending HTTP requests to any of 20 app servers to handle the request. These servers are named (internally) app01 through app20 . It is ensured that all requests with the same session ID will be routed to the same app

Wildfly 15.0.1.Final - Web Application Error

梦想与她 提交于 2020-01-06 08:20:07
问题 Wildfly 15.0.1 When I run a simple javaee 6 web application in wildfly 15.0.1 which was build under java 1.8 with netbeans 8.2 give the following error. But when I browse the url application works fine. java.net.MalformedURLException: For input string: "8080undefined" at java.net.URL.<init>(URL.java:627) at java.net.URL.<init>(URL.java:490) at java.net.URL.<init>(URL.java:439) at org.netbeans.modules.ant.browsetask.NbBrowse.execute(NbBrowse.java:92) at org.apache.tools.ant.UnknownElement

Is it possible to have EJBs in domain1/lib using GlassFish?

…衆ロ難τιáo~ 提交于 2020-01-06 08:17:11
问题 I use GlassFish 4 web profile and I have the following interface and class. @Local public interface SomeService { ... } @Singleton public class SomeServiceBean implements SomeService { ... } When I put interface and class in .war archive (that is in domain1/autodeplay) everything works fine. However, when I put interface and class in separate .jar archive (that is in domain1/lib) then deploying war application I get: java.lang.RuntimeException: Cannot resolve reference Local ejb-ref name=com

My EJB throws a transaction required exception although another EJB setup in the same way with same persistence unit throws no excpetion

随声附和 提交于 2020-01-06 07:16:33
问题 First here is my entire EJB file: package enkia.pulse.indexing.beans; import enkia.pulse.core.Category; import enkia.pulse.core.Product; import enkia.pulse.core.Review; import enkia.pulse.core.Twitter; import enkia.utils.HarvestingConstants; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Resource; import javax.ejb.SessionContext; import javax.ejb

Shared servlet for fileIO?

…衆ロ難τιáo~ 提交于 2020-01-06 07:16:09
问题 Imagine having a webservice or servlet , which can perform some fileIO . How can I make sure that if more than one client executes the according WS method, that the fileIO is still handled only by one single "thread"? So that no data is lost because several clients trigger the fileIO? Which direction should I search for? 回答1: The best bet is likely to just make the underlying method(s) that read/write synchronize on a common object. (eg. the File object could be easiest). private static File

MVC Framework for existing application

孤街醉人 提交于 2020-01-06 06:55:12
问题 I am modifying existing java web application that was written long time ago, and it is written in the wrost possible way. It has business logic and sql statemens in JSP files. Because of the certain constraint, I can not re-design the entire application. but I can implement better design in any new feature that I add. can anybody suggest me any MVC framework that I could easily integrate in existing app. I need to have framework that is not depended on many external jar files and it does not

Set timeout on a TypedQuery with JPA2

时间秒杀一切 提交于 2020-01-06 06:47:14
问题 I would like to set a timeout on a javax.persistence.TypedQuery. I've found this easy method : TypedQuery<Foo> query = ... ; query.setHint("javax.persistence.query.timeout", 1000); query.getReturnList(); But it seems that does not work, it's just ignored. From the PRO JPA 2 book: "Unfortunately, setting a query timeout is not portable behavior. It may not be supported by all database platforms nor is it a requirement to be supported by all persistence providers. Therefore, applications that