glassfish
  1. glassfish
  2. GLASSFISH-17280

Hibernate as JPA providers causes ClassNotFoundException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 3.1.1_b12
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

      GlassFish Server Open Source Edition 3.1.1 (build 12)

      Description

      When using Hibernate as JPA provider, I get ClassNotFoundExceptions.

      Steps to reproduce:

      1. unpack glassfish-3.1.1.zip
      2. install JDBC driver into glassfish/domains/domain1/lib/
      3. start Glassfish, configure datasource and ping it successfully
      4. start Update Tool und install "hibernate"
      5. restart Glassfish
      6. deploy an EJB with

      <provider>org.hibernate.ejb.HibernatePersistence</provider>

      in persistence.xml and a SessionBean that uses @PersistenceContext on an EntityManager

      Result:

      SEVERE: Exception while preparing the app : javax/persistence/spi/PersistenceProvider
      java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceProvider
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
      at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:196)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:173)
      at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:119)
      at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:214)
      at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:483)
      at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:221)
      at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:167)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:872)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
      at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:382)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1064)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1244)
      at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1232)
      at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:459)
      at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
      at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
      at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:238)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
      at java.lang.Thread.run(Thread.java:662)

      Everything works fine when using the default JPA provider. I attached the source of a NetBeans project as well as the deployed EJB jar.

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        Must be something to do with Hibernate package. Assigning this to JPA team.

        Show
        Sanjeeb Sahoo added a comment - Must be something to do with Hibernate package. Assigning this to JPA team.
        Hide
        kurti added a comment -

        Please close this issue as invalid. While tracking down a completely separate deserialization error, I copied hibernate3.jar to the "ext" directory of my JVM installation. After I removed this file, everything works fine again.

        Sorry for the noise.

        Show
        kurti added a comment - Please close this issue as invalid. While tracking down a completely separate deserialization error, I copied hibernate3.jar to the "ext" directory of my JVM installation. After I removed this file, everything works fine again. Sorry for the noise.
        Hide
        Mitesh Meswani added a comment -

        Closing as per users comment above

        Show
        Mitesh Meswani added a comment - Closing as per users comment above

          People

          • Assignee:
            Mitesh Meswani
            Reporter:
            kurti
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: