java-ee

Glassfish: How to change the security realm for a WAR-app

I'm building a JEE6-application that runs on Glassfish v3.0.1. It's a web-application with EJBs, deployed as a WAR (EJB 3.1). Currently i'm trying to configure a login by using a JDBC-based security realm. Now i don't know how to configure my WAR-application to not use the default Glassfish Security Realm (file) and instead use my newl...

EntityManager.find can't find entity, but using the Criteria API does

I've encountered a rather odd case in Java EE 6 where using the JPA EntityManager's find method along with an entity's primary id returns null, but using the Criteria API to select all entities with that id works fine. Here is the code I'm using for find: // Always returns null, even for records I know for sure are in there. user = em....

Deploy war file with modifiable properties files

I am building a web service and am packaging it into a war file for deployment. Right now all of my config files (.properties and .xml) are being packaged into my .war file. This isn't going to work as some of these files will need to be modified for each individual installation. I know that some servlet containers will leave the .war...

JAX-RS custom mapping from entities to xml

Here's my problem: Say I have two entities annotated with JAX-RS annotations: @XmlRootElement @Entity public Person { private String firstname; private String lastname; private Address address; } @XmlType @Entity public Address { private String street; private String city; } This will get rendered into: <person> <first...

Decryption of different keys give the same result

Hi, I saw this behavior today while working with a Java EE Framework. Every time I'm getting an int ID from the server, that ID is encrypted + encoded in base 64, and the encrypted string is sent back. Each request gives a different encrypted key. The behavior that is strange is that if I make 5 requests, the encrypted text I received a...

Safe to store reference to Entity Bean after session ends?

This is a pretty newbie question- please know I'm aware of that. I have a stateless session bean that needs to load up some data once and cache it locally in a static variable for use by all instances of that bean. The data can be accessed through an entity bean. I'm wondering if its safe to cache the entity instance, or if I should c...

Difference between a "jta-datasource" and a " resource-local " datasource ?

Hi, The terms "jta-datasource" and "resouce-local datasource" are a little vague to me. I'm putting down what I am understanding ( or assuming ) and I'd like you to say where I'm right / wrong. The same database can be referred to as a jta-datasource or as a resource local datasource If mentioned as jta-datasource, then the beans / o...

Jboss-Maven-Plugin can't start?

I use Jboss-Maven-Plugin by 1.4 version. I look JBoss Maven Plugin Usage Example,And I pom.xml is <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jboss-maven-plugin</artifactId> <version>1.4</version> <configuration> <jbossHome>E:\JavaWorkingTools\JBoss\jboss-5.1...

JavaEE6 DAO: Should it be @Stateless or @ApplicationScoped?

I'm currently creating an EJB3 Data Access Class to handle all database operations in my JavaEE6-application. Now, since JavaEE6 provides the new ApplicationScoped-Annotation, i wonder what state my EJB should have, or if it should be stateless. Whould it be better to let the DAO be a @Stateless Session Bean, or an @ApplicationScoped B...

JPA merge readonly fields

We have the simplest CRUD task with JPA 1.0 and JAX-WS. Let's say we have an entity Person. @Entity public class Person { @Id private String email; @OneToOne(fetch = FetchType.LAZY) @JoinColumn(insertable = false, updatable = false) private ReadOnly readOnly; @Column private String name; @XmlElement p...

Icefaces Liferay portal navigation JSF problem

I have a final Submit button in my Application looks like : public String finalSubmitNavigate(){ // LOGIC HERE! FacesContext.getCurrentInstance().getApplication().getNavigationHandler().handleNavigation(FacesContext.getCurrentInstance(), null, "success"); return "success"; } I have also set navigation case in my faces-conf...

How use cargo-maven2-plugin deploy to jboss as5?

I trying cargo-maven2-plugin, but I don't deploy in jboss5x I pom.xml is <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.0.2</version> <configuration> <container> <containerId>jboss51x</containerId> ...

Java Web Start application gives MARSHAL exception when data loaded from database via remote EJB.

I have a Java Web Start application calling remote Java EE 5 EJBs to load in data from a database. When the data is returned from the EJB to the client, I get the following exception. Looking it up online, it seems that everyone gets this exception and everyone has a different solution for it. All of my entities (abstract or not) imple...

java.sql.SQLException: Only LOB or thin Storage is supported in Thin XMLType

The custom class HibernateXMLType works fine for CLOB as XMLType. But, when I use OBJECT-RELATIONAL as XMLType, then the class throws the below exception. java.sql.SQLException: Only LOB or thin Storage is supported in Thin XMLType ...

Embedded Glassfish v3: deploying sun-resources.xml programmatically fails

I would like to be able to package my jpa-ejb-web project as a standalone application, by using Glassfish embedded API. To use the JPA layer, I need to deploy the sun-resource.xml configuration, which should be possible with the asadmin command add-resources path\to\sun-resources.xml. I've this code to do it: String command = "add-...

Parameterizing EAR

I would like to set some read-only parameters (eg. an RMI registry host and port) to a Java EE application deployed on a Glassfish server. The usual place to do this would be the deployment descriptor, but my problem is that it is packaged in the EAR, so I cannot edit it without changing the EAR. I need something similar to setting JDBC...

it's possible configure a persistence.xml for multiple data sources??

hi i just want to know how configure in a persistence.xml two datasources one of the data sources have a jar outside from the other. I'm tried but i really don't if it's possible ...

Best book to learn java web programming (for an experienced perl developer)

I'm an experienced perl developer who commonly uses Catalyst/Moose etc for web development, and have some python/django knowledge. I'm interested in learning java with an eye on wicket/spring/hibernate and later on possibly moving towards groovy, scala or closure.. I'd rather not plough through all the basics.. What do you recommend book...

Combining JAXB and JPA in one model

I have to design a data model (in a Java EE 6 application) that will be persisted via JPA, and that also needs to be serialized via JAXB. The last time I did that, I had one group of entity classes with JAXB annotations, and another with JPA annotations. This meant that I had to have a lot of boilerplate code for translating between the ...

Use Enum type as value parameter for @RolesAllowed-Annotation

I'm developing a Java Enterprise application, currently doing JEE-Security stuff to restrict access for particular functions to specific users. I configured the application server and everything, now i'm using the RolesAllowed-annotation to secure the methods: @Documented @Retention (RUNTIME) @Target({TYPE, METHOD}) public @interface R...