java-ee-6

Classes from .war cannot find EJB beans.

Hello, I have .ear file, in it there is .war and ejb .jar. When I deploy the .ear to the server (glassfish v3), I'm getting javax.naming.NameNotFoundException: com.deportio.ejb.TransportsFinder#com.deportio.ejb.TransportsFinder not found This class is in ejb .jar. Everything is built by maven. What should I configure for it to work?...

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....

From Java to Python/Django

Possible Duplicates: Book and tutorial recommedations for Django 1.0 How to Learn Python Hi, I am a Java/JEE programmer and want to learn Python (finally the Django framework) to build web applications. I don't have any experience with scripting languages so this is going to be the first step into the scripting languages wo...

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...

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-...

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...

Getting Entitymanager/EJB inside a @FacesConverter/Validator of a WAR-packaged app

I have a JavaEE6-application running on Glassfish v3.0.1 with EJB 3.1 (app is packaged as WAR), and all my EJBs are @LocalBeans. Currently, i'm writing a FacesConverter for use in JSF2, in which i need the EntityManager to get an Entity back from an id. Now i wonder, which is the best and cleanest way to get the Entitymanager inside th...

Single persistence unit for a modular application (JPA)

I want to create a modular(plugin-like) application that uses JPA as its persistence abstraction, and this application should be extensible by third parties. The catch is that I want this application and its plugins to be easily portable to other databases/JPA providers, so the third party vendors can't know anything about the used JPA p...

EJB 3.1 application deployed as WAR-only: What about ejb-jar.xml?

I have a JavaEE6 application, consisting of Web stuff and EJBs and which is deployed as WAR-only (using EJB3.1). The build is based on Maven. I just read about a new possibility to order the module initialization in Java EE 6 here which i also need for my application. Also, i would like to have an option to define some EJB properties in...

JavaEE Security,Access restricted pages: Logged out user is redirected correctly. Logged in user is not.

My app is a Java EE 6 application, running on Glassfish 3.0.1. I'm using Java EE Security, with a JDBC Realm. So i added restrictions to some of my web pages. I added the following login-config and security-constraint to my web.xml: <!-- Redirect access of restricted pages to index.jsp --> <login-config> <auth-method>FORM</auth-meth...

Expose current progress of an @Asynchronous function to use in View

In my JEE6-App (running on Glassfish 3.0.1) I have an EmailEJB which has to send lots of mails. The mails are sent asynchronously, so its annotated with the new EJB3.1 @Asynchronous, letting it be run in a separate Thread. Now i want the user to be informed about the current status of the method: How many mails have already been sent? S...

how to use new scala 2.8.0 nested annotations

Hi folks, looks like when scala 2.8.0 is out, we can use nested @annotations in our persistence layers. But how? Can anyone please transform this from java to scala? Thanks. @NamedQueries({ @NamedQuery(name = "findAll", query="select p from Person p"), @NamedQuery(name = "findTheOne", query="select p from Person p where...

How to avoid ConcurrentModificationExceptions when using EJB3.1 @Asynchronous.

[My Setup: Java EE 6 application, with EJB3.1, CDI/Weld, JSF2 running on Glassfish 3.0.1] I read some articles about the new @Asynchronous methods in EJB3.1, but none of them mentioned the dangers of asynchronous methods and what you really have to care about. In my app i'm having an @Asynchronous E-Mail service, sending lots of mails...

Looking up an EJB dynamically

I'm developing an application on Glassfish 3. I have an EJB that looks like this: @LocalBean @Stateless public class MyBean { public void doSomething() {} } My client code (running inside the same application) looks like this: MyBean mb = (MyBean) InitialContext.doLookup(MyBean.class.getName()); According to a few sources, this s...

JEE6: Switching to CDI - Best resources

I have a small yet complete JEE 6 application at hand. The traditional annotations are being used: @Resource, @EJB, @Singleton, @PostConstruct, @PreDestroy, @PersistenceContext, @ManagedBean, @ManagedProperty, @RequestScope, @ApplicationScope,... I would like to evaluate whether it makes sense to introduce CDI, and to standardize ...

How can i config module and application name for JNDI Lookups

In EJB 3.1 JNDI Lookups can be made with different Lookup-Names: java:global[/<app-name>]/<module-name>/<bean-name>!<fully-qualifiedbean interface-name> java:global[/<app-name>]/<module-name>/<bean-name> java:app/<module-name>/<bean-name>!<fully-qualified-bean-interface-name> java:app/<module-name>/<bean-name> java:module...

Getting current Java EE documentation - broken links / offer expired

Hi Everyone. I'm having trouble getting the current Java EE documentation from the Oracle website [NOT the API documentation - supporting documentation as described below]. I've even tried creating a new account with Oracle to see if my original sun account had some problem. I get to this page:http://www.oracle.com/technetwork/java/ja...

How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9)

The project has an EJB module & a web module. Changing the server is easy, but I'd like to switch to EJB 3.1 also but I believe I need to change all kind of configuration files since I can't do it from the project properties window(s). Any tips or links do useful documentation will be greatly appreciated. Thank you! ...

How do i use JPA 2 to connect to multiple data sources?

I have two databases in MSSQL ,and i want to connect to them using JPA2 I have managed to get it working with one . Can some one help me how do i do that? Thanks a Lot. ...