java-ee

Simulating JMS - jUnit

一曲冷凌霜 提交于 2019-12-12 09:43:43
问题 I need to simulate JMS behavior while performing automated tests via maven/hudson. I was thinking about using some mock framework i.e. Mockito to achieve that goal but maybe there is some easier tool which can accomplish this task? I have read a little bit about ActiveMQ but from what I have found out it requires to install broker prior using it. In my case it is important to have everything run by maven only because I don't have any privileges to install anything on the build server. 回答1:

Java Application Server Performance

喜夏-厌秋 提交于 2019-12-12 09:42:55
问题 I've got a somewhat dated Java EE application running on Sun Application Server 8.1 (aka SJSAS, precursor to Glassfish). With 500+ simultaneous users the application becomes unacceptably slow and I'm trying to assist in identifying where most of the execution time is spent and what can be done to speed it up. So far, we've been experimenting and measuring with LoadRunner, the app server logs, Oracle statpack, snoop, adjusting the app server acceptor and session (worker) threads, adjusting

Generated sequence starts with 1 instead of 1000 which is set in annotation

谁说我不能喝 提交于 2019-12-12 09:38:41
问题 I would like to ask some help regarding database sequence created by Hibernate. I have this annotation - the code below - in my entity class in order to have individual sequence for partners table. I expect that the sequence starts with 1000, because I insert test data into my database using import.sql during deploy and I would like to avoid the constraint violation. But when I want to persist data than I got the constraint violation exception and it informs me about the fact the partner_id =

Redeploying Java EE applications immediately

给你一囗甜甜゛ 提交于 2019-12-12 09:35:16
问题 I am quite new to Java EE and have been struggling with the slowness of the deployment process, and wonder if I'm doing something wrong. I am experienced with Django where the changes to code immediately occur, and it seems that hot deploying Java EE applications are a bit confusing -- there are multiple things which claim to hot deploy (Glassfish, Eclipse manic hotdeploy, Jetty hotdeploy, JRebel etc.). My project is a Maven project and I'm using Netbeans to deploy. The site uses Spring, JSF

Available Servlet 3.0 implementations?

邮差的信 提交于 2019-12-12 09:32:41
问题 Which implementations of the Servlet 3.0 specification are available (or at least in beta) besides GlassFish? 回答1: Tomcat 7.0 is on its way. It is still in development. Jetty 8 is supposed to implement Servlet 3.0, it is also still in development (check the Versions section at bottom). As far now there's only the GlassFish v3 as being a stable release. 回答2: There is Jetty 回答3: I'd also mention Resin 4.0, in development. 来源: https://stackoverflow.com/questions/1979473/available-servlet-3-0

Eclipse + Turn an Existing Project into a JPA Project

无人久伴 提交于 2019-12-12 09:29:52
问题 Is there a way to turn a normal Eclipse Project into a JPA Project? I have a normal project with Entities in it and a Persistence.xml file, but it is not an eclipse recognized JPA project. What can I do? 回答1: project properties --> project facets. There you can click on the JPA check-box and you have an JPA project. 回答2: You could also Right Click the eclipse project and click on configure which allows you to convert to a JPA project. 回答3: You'll want to modify: your .project your .classpath

Spring Security: At which point do I get to know that a user logged in?

主宰稳场 提交于 2019-12-12 09:27:27
问题 I am using spring security with URL based interceptors to secure my application. In which classes/at which points can I do some custom processing after a user logged in? I specifically want to save the date the user logged in last, but I cannot figure out how to achieve this. Thanks a lot for your help. 回答1: You could consider implementing the org.springframework.context.ApplicationListener interface. You would then listen specifically for the org.springframework.security.authentication.event

@ManagedBean annotation doesnt work, but @Named works

匆匆过客 提交于 2019-12-12 09:19:45
问题 I had some troubles. Class with @Named works: @Named @SessionScoped public class UserBean { @Autowired UserBo userBo; public void setUserBo(UserBo userBo) { this.userBo = userBo; } public String printMsgFromSpring() { return userBo.getMessage(); } } but this is doesnt work and generates error: javax.servlet.ServletException javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) root cause java.lang.NullPointerException com.mkyong.UserBean.printMsgFromSpring(UserBean.java:24)

How to Intercept REST endpoint to receive all headers?

拥有回忆 提交于 2019-12-12 09:08:21
问题 My current code is @Path("login") @RequestScoped public class LoginResource { @GET @SecurityChecked public Response getUser(@HeaderParam("AUTH") @Nonnull final String authToken) { return Response.ok("authenticated successfully.").build(); } } and @SecurityChecked is custom annotation as import java.lang.annotation.ElementType; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import

Glassfish: modify deployment descriptors for EAR during deployment

旧城冷巷雨未停 提交于 2019-12-12 09:01:22
问题 After several days of searching, trying and head-banging, I post this question to SO although it seems to be answered already. Here is the scenario: I have an EAR application containing (for the moment) one WAR and one EJB module. The EJB module uses JPA (persistence.xml) and some Stateless Session Beans are exposed via Web Services. The web services use Basic authentication with a jdbc realm. The web module uses form authentication with the same realm. The requirement : I need to be able to