java-ee-6

Servlet receives empty object from Remote EJB3 Session Bean

I'm sure this is a beginner error... So I have a JEE6 application with entities, facades (implementing the persistence layer) and Stateless Session Beans (EJB3) with Remote interfaces (providing access to the entities via facades). This is working fine. Via the SLSB I can retrieve and manipulate entities. Now, I'm trying to do this fr...

How can I pass a dynamic backing bean into a JSF 2.0 page using facelets?

Hi, I am using a JSF 2.0 to create a web app (purely jee6, without spring/seam etc.). I would like to have a single xhtml page but pass the proper backing bean / entity into it. For example, I would like to be able to edit a user other than the logged in user, I have a user edit page which displays the information of the logged in user ...

Am I using EJBs properly?

I am using a JEE6 stack including JPA 2.0, JSF 2.0, EJB 3.1 etc. The way my architecture is setup is the following: I have JPA annotated DAOs using hibernate as my JPA provider. I have JSF Managed beans which correspond to my facelet/xhtml pages. I have EJBs that handle all of my database requests. My XHTML pages have JSF EL which ma...

How do I limit JPQ output?

I need to limit number of entities returned by a query to some certain value inside a JPA query (through JPQL). Particularly: select m from Manual m //constraint e.g. in sql (mysql syntax) I would do it like: select * from Manual limit 1 The only solution that comes up is simply to get all entities and then choose first one, which ...

Richfaces a4j:include loading two pages!?

I have this seemingly-innocent code on my main JSF page: <a4j:outputPanel id="sidebarContainer"> <a4j:include viewId="#{UserSession.currentSidebar}"/> </a4j:outputPanel> Here is how the sidebar changes: A jsFunction calls a backing-bean method which sets the page (like "sidebar2.jsp") in UserSession The jsFunction has "rerender...

EJB3.1 Remote invocation - is it distributed automatically? is it expensive?

I'm building a JEE6 application with performance and scalability in the forefront of my mind. Business logic and JPA2-facade is held in stateless session beans (EJB3.1). As of right now, the SLSBs implement only @Remote-interfaces. When a bean needs to access another bean, it does so via RMI. My reasoning behind this is the assumption...

How to limit an upload speed in java servlet?

Hi. I'm working on an app (based on Spring as DI and MVC framework) that has a file upload function which is currently implemented using Spring Multipart Upload (which in it's turn utilizes commons fileupload libs). So what I'm looking for is a way to lower the upload bandwidth consumption. How can I accomplish that? ...

Injecting jms resource in servlet & best practice for MDB

using ejb 3.1, servlet 3.0 (glassfish server v3) Scenario: I have MDB that listen to jms messages and give processing to some other session bean (Stateless). Servelet injecting jms resource. Question 1: Why servlet can`t inject jms resources when they use static declaration ? @Resource(mappedName = "jms/Tarturus") private static Conne...

How to handle "null primary key encountered" exception in eclipselink?

Hi. I'm catching ... Null primary key encountered in unit of work clone ... exception in eclipselink(2.0.2 with 2.0 jpa) literally meaning that id in my entity is <=0 (for primitive types). Though debug here states that everything's fine and I have nothing to worry about. My AS is glassfish v3. Can any one point out what may cause suc...

Deployment secription of Basic Authentication with JAX-WS for EJB 3.1

Hi! There is good tutorial Basic Authentication with JAX-WS But it describe deployment description for web based application (war). Is it passable describe in ejb jar deployment description ? For web.xml <security-constraint> <display-name>SecurityConstraint</display-name> <web-resource-collection> <web...

new Stateful session bean instance without calling lookup

Scenario: I have @Singleton UserFactory (@Stateless could be) , its method createSession() generating @Stateful UserSession bean by manual lookup. If I am injecting by DI @EJB - i will get same instance during calling fromFactory() method(as it should be) What I want - is to get new instance of UserSession without preforming lookup. ...

Is it possible to get collection of some ejb`s instances from container?

Scenario: I have some @Statefull bean for user session (not an HTTP session, it is web services session). And I need to manage user's session per user. Goal: I need to have possibility to get collection of @Statefull UserSession instances and control maximum number of session`s per user, and session`s life time. Question: Is it possibl...

@WebServices as @Stateless session bean in ejb jar

Hi! Scenario: Creating some web service as @Stateless bean, package it as ejb jar. Result - can`t access to wsdl file. Goal: I want to use @WebServices as @Stateless session using ejb jar packaging with accessible wsdl file form web. Web service: @Stateless @WebService(serviceName = "ws.isp.SecurityService", wsdlLocation = "META-INF/...

Programmatic authentication in JEE 6

Hello, is it possible to authenticate programmatically a user in J2ee 6? Let me explain with some more details: I've got an existing Java SE project with Servlets and hibernate; where I manage manually all the authentication and access control: class Authenticator { int Id string username } Authenticator login(string username...

Eclipse IDE vs Netbeans IDE, which one is better for Java EE 6 development?

Hi, I would like to know which IDE is better for Java EE 6 development. Can anyone give me the comparison of these 2 IDE in terms of features? Thanks. ...

Servlet 3.0 logout doesn't work

I've got a problem with the authentication features of Servlet 3.0: With this code in a Servlet v3: log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); log.info("===^==="); request.logout() ; log.info(""+request.getUserPrincipal()); log.info(""+request.getAuthType()); request.authenticate(response) ; log.in...

Get Ajax4JSF (a4j component) running on Glassfish

I'm trying to build an JEE6-application on Glassfish V3, using JSF 2.0, Weld, JPA2 and Maven. Now i'm having trouble getting a simple <a4j:support> running. This is the fragment of my little example. When typing something into the inputtext, the outputtext should automatically be updated. But nothing happens (not in Firefox, not in IE8)...

How can I return a Future object with Spring without writing concurrency logic?

How can I return a java.util.concurrent.Future object with a Receipt object and only use the @javax.ejb.Asynchronous annotation? And do I need any extra configuration to let Spring handle ejb annotations? I don't want to write any concurrency logic myself. Here's my attempt that doesn't work: @Asynchronous public Future<Receipt> exec...

Is JavaEE6 (embedded)container implementations available for experiments?

Is javaee6/ejb3.1 implementation available from openejb? Is javaee6/jpa2.0 implementation available from openjpa? I am trying to evaluate javaee6 and ejb3.1 and jpa2.0 with maven as a build tool; so trying to find the maven artifacts for it. Please suggest Any opensource javaee6 embedded container full implementation . ...

How to implement authentication mechanism in Java EE 6

I'm trying to learn Java EE 6 and i'm just wondering how to implement authentication mechanism in Java EE 6. Here is the Java EE 6 authentiction example: public void login() { if (account.authenticate(name, password) == null) { message = "Invalid user name or password!"; } else { message = " Login successfu...