users@glassfish.java.net

Re: Same webapp works in Tomcat and doesn't work in GlassFish

From: Dominik Dorn <dominik.dorn_at_gmail.com>
Date: Wed, 6 Jan 2010 21:49:48 +0100

have you tried working with the new annotations of jpa2 and ejb 3.1. ?

my dao's look like this:

@Stateless
public class EmployeeFacade implements EmployeeDao {
    @PersistenceContext(unitName = "WebApplication4PU")
    private EntityManager em;

    @Override
    public void create(Employee employee) {
        em.persist(employee);
    }

    @Override
    public void edit(Employee employee) {
        em.merge(employee);
    }
...
}



On Wed, Jan 6, 2010 at 9:33 PM, <glassfish_at_javadesktop.org> wrote:

> Hi,
>
> I have a Windows 2003 Server running:
> - Tomcat 6.0.20 (port 8080)
> - GlassFish 2.1.1 Final (ports 10080, 10443, 14848)
> Both installations are fine, I use Tomcat Manager and GlassFish Admin
> Console with no problems.
>
> Then, I installed my webapp (subdir c:\sistemas\sitesat2, not a WAR file,
> because its better when updating only some files) into both servers. The
> installation was fine.
>
> When running the webapp using Tomcat all works fine.
> When running the webapp using GlassFish it arises an error at the line that
> creates EntityManagerFactory:
>
> [code]
> public final class JpaUtil {
> private static final String PERSISTENCE_UNIT = "sitesat2PU";
> private static EntityManagerFactory entityManagerFactory;
> private static final ThreadLocal<EntityManager> threadLocal;
> private JpaUtil() {}
> static {
> entityManagerFactory =
> Persistence.createEntityManagerFactory(PERSISTENCE_UNIT);
> threadLocal = new ThreadLocal<EntityManager>();
> }
> [/code]
>
> I dont think this is a problem with my webapp because it works 100% at
> Tomcat.
> This is the first time I try to use GlassFish. I would like to migrate all
> webapps for it.
>
> My development environment is NetBeans 6.8 + GlassFish 2.1 + my webapp, and
> in development GlassFish runs my webapp 100% too!
> [Message sent by forum member 'edilmar' (edilista_at_intersite.com.br)]
>
> http://forums.java.net/jive/thread.jspa?messageID=379102
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>


-- 
Dominik Dorn
http://dominikdorn.com