java-ee

GlassFish problem with filter chain (has worked in Tomcat for years): java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response

We need to upgrade an elderly web application to run under GlassFish 3 instead of Tomcat in order to get EAR deployments (Glassfish was chosen as it is the reference JEE 6 implementation) Unfortunately it very quickly turned out that the mechanism that ensures that a user is logged in does not work properly and complains that getWriter(...

Using Spring Security with EJB or Spring?

I wanted to build an application based on Java EE 6, but the security mechanisms of Java EE are not sufficient and a pain to with for my needs. Spring Security seems the best way to secure my application. Now I wonder if Spring Security + EJB is a good combination or if I should be better use Spring only. I need method interception, ACL...

Spring Security with EJBs

Since EJB authorization is too limited for my needs I want to use Spring Security together with EJBs. For authentication I want to use Spring Security too. The question is, if I can use the Spring Security context within an EJB. The scenario: user communicates with a servlet authentication through Spring Security servlet communicates ...

Google App Engine - Deadlocking?

Every few times I run my app on the development server it seems to deadlock. I'm not sure if it also deadlocks on the production server. I pause the threads and see that one of them is stuck at Permissions.implies:162 which is the start of a synchronized block. What my code does is: on the home page, it sends 5 jquery requests at the ...

In Java, How do I make sure my web application is thread safe?

How do I make sure my java servlets web application is thread safe? What do I need to do in regards to session variables, static variables of a class, or anything else that could be a thread-safety problem? ...

jar file for JPA 2.0

import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; I've created a JPA project where I try to user the above classes but I'm unable to find what jar I'm missing for them. Please guide me. ...

Spring SecurityContext with EJB

I want to use Spring Security with EJB 3.1. It was told me that storing the SecurityContext with ThreadLocal doesn't work in clustered environments. What is the best way to hold a Spring SecurityContext in a clustered EJB environment? My ideas: A) replace the SecurityContextHolder with a singleton EJB and hold the SecurityContext fo...

Framework like Spring Security for Java EE?

Spring Security offers many powerful security mechanisms but it doesn't fit properly into a Java EE (EJB) environment. One problem is that Spring Security stores the SecurityContext in a ThreadLocal object which is not suitable for clusters. Spring Security relies on services (AOP for example) from Spring core which are not available if ...

Java EE sample App

I have been using Java SE for 2 yrs now and I am pretty ok with the fundamentals of Java. I would like to move to the Java EE API and develop something based on this. I have 2 questions: Does the EE API contain all the classes of the SE? i.e. can anything developed in the SE also be developed using the EE API? Can anybody point me in t...

Differences between Java EE 6 CDI Implementations

I've looked at JBoss' Weld Reference Implementation of JSR-299 Contexts and Dependency Injection, and I wanted to know how others CDI implementations compare to each other. Specifically, I know about Weld, Resin CanDI (by Caucho), and Apache OpenWebBeans. ...

JPQL query SELECT optional + generic DAO select

I have followed a working JPA example to retrieve Category objects as such: return (ArrayList<Category>) getEntityManager().createQuery("from Category").getResultList(); The query is very shorthand - and I can't find the rules for what is optional and what isn't in any of the guides. Is this brevity acceptable? Secondly, I want to no...

JPA validation strategy

NetBeans let me choose between three values for the JPA validation strategy: Auto, Callback and None. What does "Auto" mean? Does "Callback" mean the use of @PrePersist, @PreUpdate, and @PreRemove? Is there a performance hit if I use Auto or Callback if there is no validation to perform? ...

java utf-8 encding problem

i am using an HTML parser called HTMLCLEANER to parse HTML page the problem is that each page has a different encoding than the other. my question Can i change from any character encoding to UTF-8? ...

File Upload with RequestBuilder

Hi I need to upload a file in GWT in the background, ie. not from a visual widget. For this I've found the RequestBuilder class, but little documentation on how to use it for upload purposes. The file content I need to upload is 100% plaintext. My code so far looks like this: final String filename = UUID.randomUUID().toString() + "....

Weblogic 10.3.0 : Loosing a stateless session bean in the bean pool

Hi, We have a strange situation where we loose a Stateless SessionBean in a Bean Pool in Weblogic 10.3.0 Since we only have one bean in the pool, this effectively hangs all incoming calls. We do not want more than one instance in the pool because of application restrictions. In the Weblogic admin console, we can see that there are 1 i...

Should I start my Seam project from scratch or from a seam-gen generated project?

I have been using Seam-gen with a small sample database to help me learn the Seam framework. Now I am going to build a more complex application. Are there disadvantages or things that I should watch out for if I decide to start from a seam-gen project? ...

Glassfish initialising Singleton bean twice

Hi, I have a singleton ejb which is getting initialised twice. I have no idea why and it is completly defenting the point in having a singleton bean as far as I can tell. Any help will be appreciated. As you can see I tried to put a static boolean in to prevent the multiple initialisation (not that it should be required) but it made no ...

Making sense of JPA and EJB3 and WebServices

I'm just getting started with JPA, creating stateless session beans from the JPA entities, then accessing the beans through a web service. While I have a lot of experience developing database backed web services "the old way", I have some questions about what's going on behind the scenes with this new "annotation driven approach". What...

Glassfish limited to two simultaneous threads with JPA/EJB/web service

I'm exposing the following EJB3 stateless session bean through a web service. @Stateless public class UserRoleFacade implements UserRoleFacadeLocal { @PersistenceContext(unitName = "SimpleEA-ejbPU") private EntityManager em; public int count() { System.out.println("thisClass=" + this.getClass().getSimpleName() + "@"...

JSF2 and Maven - hot deploy?

Hi all, I'm on a project involving a JSF 2.0 frontend. The project is using Maven as the build tool, with a few modules for the different layers of the system. One of which is a WAR module, which is the deployment artifact. What I would like is to have a nice development process, which is similar to that of using Netbean's Web Project ...