JPA 2 with Hibernate 4 causing ClassCastException: HibernatePersistence -> PersistenceProivider: Q2

2,841 views
Skip to first unread message

Pieter Botha

unread,
Sep 27, 2013, 5:09:05 AM9/27/13
to jpos-...@googlegroups.com
Good day everyone,

After resetting my code, my config, compiling and running on different pc's and platforms more than once and working through different tutorials more than once and working through previous Stack topics on the error, I believe I might be chasing my tail.

Can anyone perhaps assist with the following (apparently very common) exception that I'm getting during runtime:
java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider

On Windows I'm using both Intellij IDEA as well as command line(bash) where the command line has had a custom classpath added recently. I have also tried running the application without the extra classpath parameter.

My goal: Use JPA 2 with Hibernate : annotation method to connect to Mysql and use Maven for compiling.

I'm using the jPOS Q2 container.

My project structure is somewhat different (where / is the root of the project):
/
 pom.xml
    submodules:
         projects/jPOS
         modules
/modules
  pom.xml
    submodules:
         database
             pom.xml (package: jar)
         status
             pom.xml (package: jar)
         _other_modules
             pom.xml (package: jar)
/projects/jPOS <<git submodule of root project
  pom.xml (standard jPOS)

The setup above means each of my Maven modules is a jar on its own, so I have to install it into the deploy/lib directory under Q2 with the relevant XML config to start up my services in deploy.

My Maven dependency setup for the Database module:
 
    <dependencies>
        <dependency>
            <groupId>org.mysql.jdbc</groupId>
            <artifactId>mysql-jdbc</artifactId>
            <version>5.2.10</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>
    </dependencies>

My command for starting up (when I'm using the custom classpath): 
java -cp **"C:\dev\netswitch\netswitch\projects\jPOS\jpos\target\jpos-1.8.7-SNAPSHOT\lib"** -jar jpos-1.8.7-SNAPSHOT.jar  > bah

Checking the jars that should now be in my classpath(bash in Windows):

    a@b-PC /c/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/lib (JPA)
    $ ls -lha
    total 4.1M
    drwxr-xr-x    1 a Administ      12k Sep 27 10:34 .
    drwxr-xr-x    1 a Administ     4.0k Sep 26 16:34 ..
    -rw-r--r--    1 a Administ     150k Sep 26 16:35 com.springsource.org.jdom-1.1.0.jar
    -rw-r--r--    1 a Administ      40k Sep 26 16:35 commons-cli-1.2.jar
    -rw-r--r--    1 a Administ     306k Sep 26 16:35 dom4j-1.6.1.jar
    -rw-r--r--    1 a Administ     2.1M Sep 26 16:35 guava-15.0.jar

Checking the jars that is in the deploy/lib for Q2 to load (bash on Windows):
a@a-PC /c/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib (JPA)
$ ls -lha
total 2.9M
drwxr-xr-x    1 a Administ     4.0k Sep 27 11:00 .
drwxr-xr-x    1 a Administ     8.0k Sep 27 10:39 ..
-rw-r--r--    1 a Administ      26k Sep 26 16:13 common-1.0-SNAPSHOT.jar
-rw-r--r--    1 a Administ      15k Sep 26 16:25 database-1.0-SNAPSHOT.jar
-rw-r--r--    1 a Administ      79k Sep 26 16:35 hibernate-commons-annotations-4.0.1.Final.jar
-rw-r--r--    1 a Administ     4.1M Sep 26 16:35 hibernate-core-4.0.1.Final.jar
-rw-r--r--    1 a Administ     464k Sep 26 16:35 hibernate-entitymanager-4.0.1.Final.jar
-rw-r--r--    1 a Administ     100k Sep 26 16:35 hibernate-jpa-2.0-api-1.0.1.Final.jar
-rw-r--r--    1 a Administ     100k Sep 26 16:35 jmxtools-1.2.1.jar
-rw-r--r--    1 a Administ      19k Sep 26 16:13 mastercardcr-1.0-SNAPSHOT.jar
-rw-r--r--    1 a Administ     784k Sep 26 16:13 mysql-jdbc-5.2.10.jar
-rw-r--r--    1 a Administ      53k Sep 26 15:09 persistence-api-1.0.2.jar
-rw-r--r--    1 a Administ      32k Sep 26 16:13 transaction-1.0-SNAPSHOT.jar

Creating the EntityManager(code extract);exception is caught while creating the factory, I've attached a class-load log up to the point of factory going to be loaded.
   
    import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  public class DatabaseAPI implements Configurable{

  private static DatabaseAPI instance = null;
  private EntityManager manager;
  private EntityManagerFactory factory;

    private DatabaseAPI()
    {
        try
        {
            factory =  Persistence.createEntityManagerFactory("persistenceUnit");
            manager = this.factory.createEntityManager();
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage() + ":" + e.getCause().getMessage());
        }
    }

The persistenceUnit being referred to looks like this:

    <?xml version="1.0" encoding="UTF-8" ?>
    <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
        <persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePeristence</provider>
        <class>com._masked_.database.Transaction</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://oopseerver.org/netswitch" />
            <property name="javax.persistence.jdbc.user" value="netswitch" />
            <property name="javax.persistence.jdbc.password" value="ballas_bak" />
            <property name="hbm2ddl.auto" value="create" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        </properties>
        </persistence-unit>
    </persistence>

Thanks for any assistance and help.

Pieter
class-load-dump.txt

Victor Salaman

unread,
Sep 27, 2013, 8:13:25 AM9/27/13
to jpos-...@googlegroups.com
Hi Pieter:

Check the contents of these two jars, and you might see the problem.



-rw-r--r--    1 a Administ      53k Sep 26 15:09 persistence-api-1.0.2.jar

Pieter Botha

unread,
Sep 30, 2013, 3:46:09 AM9/30/13
to jpos-...@googlegroups.com
Hi Victor,

Thanks for taking the time to read through that mail!

I checked the 2 jars and saw that both have javax.persistence.spi in them providing thus the same set of classes twice. That would explain the problem though I'm not seeing the persistence-api.jar being loaded in the class dump.
I removed the persistence-api.jar from the directory and still; the same problem. The reason why I chose to remove the persistence-api.jar is because it does not have ProviderUtil.class which is required (exception is thrown if ProviderUtil is not present).

Pieter



Op vrijdag 27 september 2013 14:13:25 UTC+2 schreef Victor Salaman:

Victor Salaman

unread,
Sep 30, 2013, 4:30:04 AM9/30/13
to jpos-...@googlegroups.com
Hi:

Use a method like this to diagnose your CCE:

    public static void showLoc(Class cls)
    {
        System.out.println("CLASS = " + cls.getName());
        ProtectionDomain domain = cls.getProtectionDomain();
        ClassLoader loader=domain.getClassLoader();
        URL source = domain.getCodeSource().getLocation();
        System.out.println("\tloader = " + loader);
        System.out.println("\tsource = " + source);
    }


invoke it from your code like:

        showLoc(HibernatePersistence.class);
        showLoc(PersistenceProvider.class);

You should get a result such as:

CLASS = org.hibernate.ejb.HibernatePersistence
    loader = sun.misc.Launcher$AppClassLoader@5306989e
    source = file:/Users/salaman/.gradle/caches/artifacts-26/filestore/org.hibernate/hibernate-entitymanager/4.2.5.Final/jar/2f4e93876023b3c346c2db21a1d73cd4e9dbf243/hibernate-entitymanager-4.2.5.Final.jar

CLASS = javax.persistence.spi.PersistenceProvider
    loader = sun.misc.Launcher$AppClassLoader@5306989e
    source = file:/Users/salaman/.gradle/caches/artifacts-26/filestore/org.hibernate.javax.persistence/hibernate-jpa-2.0-api/1.0.1.Final/jar/3306a165afa81938fc3d8a0948e891de9f6b192b/hibernate-jpa-2.0-api-1.0.1.Final.jar

You should compare the classloader between these two classes...

/V



September 27, 2013 5:09 AM
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
 
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Pieter Botha

unread,
Sep 30, 2013, 4:48:41 AM9/30/13
to jpos-...@googlegroups.com
Hi Victor,

No luck yet, the class loaders are the same and the jars look correct(Q2 is my class loader):

CLASS = org.hibernate.ejb.HibernatePersistence
loader = org.jpos.q2.QClassLoader@bfd472
source = file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar
CLASS = javax.persistence.spi.PersistenceProvider
loader = org.jpos.q2.QClassLoader@bfd472
source = file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar

Pieter

Op maandag 30 september 2013 10:30:04 UTC+2 schreef Victor Salaman:

Victor Salaman

unread,
Sep 30, 2013, 4:51:13 AM9/30/13
to jpos-...@googlegroups.com
Now trap the classclassexception with try/catch and move the code to check the loader/source AFTER the catch so you can see if there's any change.

/V

September 30, 2013 4:48 AM
Hi Victor,

No luck yet, the class loaders are the same and the jars look correct(Q2 is my class loader):

CLASS = org.hibernate.ejb.HibernatePersistence
loader = org.jpos.q2.QClassLoader@bfd472
CLASS = javax.persistence.spi.PersistenceProvider
loader = org.jpos.q2.QClassLoader@bfd472

Pieter

Op maandag 30 september 2013 10:30:04 UTC+2 schreef Victor Salaman:
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
 
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
September 30, 2013 4:30 AM

Pieter Botha

unread,
Sep 30, 2013, 5:08:22 AM9/30/13
to jpos-...@googlegroups.com
Hi Victor,

No change before/after. What I did pick up are the references to the Glassfish directory jdk; not sure if those are causing this mess.

Code:
        try
        {
            showLoc(HibernatePersistence.class);
            showLoc(PersistenceProvider.class);
            factory =  Persistence.createEntityManagerFactory("persistenceUnit");
            manager = this.factory.createEntityManager();
        }
        catch (Exception e)
        {
            showLoc(HibernatePersistence.class);
            showLoc(PersistenceProvider.class);
            System.out.println(e.getMessage() + "!!!" + e.getCause().getMessage());
        }

Output:

CLASS = org.hibernate.ejb.HibernatePersistence
loader = org.jpos.q2.QClassLoader@78d8ac
source = file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar
CLASS = javax.persistence.spi.PersistenceProvider
loader = org.jpos.q2.QClassLoader@78d8ac
source = file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
[Loaded javax.persistence.Persistence from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.PersistenceException from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.PersistenceUtil from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.Persistence$1 from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.spi.PersistenceProviderResolverHolder from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.spi.PersistenceProviderResolver from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded java.lang.InstantiationException from C:\glassfish3\jdk7\jre\lib\rt.jar]
[Loaded java.util.regex.Pattern$CharProperty$1 from C:\glassfish3\jdk7\jre\lib\rt.jar]
[Loaded javax.persistence.spi.PersistenceProvider from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded org.hibernate.ejb.AvailableSettings from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar]
[Loaded org.hibernate.ejb.HibernatePersistence from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar]
[Loaded javax.persistence.spi.ProviderUtil from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded org.hibernate.ejb.util.PersistenceUtilHelper$MetadataCache from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar]
[Loaded java.lang.NoSuchFieldException from C:\glassfish3\jdk7\jre\lib\rt.jar]
[Loaded javax.persistence.PersistenceException from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar]
[Loaded org.hibernate.ejb.HibernatePersistence$1 from file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar]
CLASS = org.hibernate.ejb.HibernatePersistence
loader = org.jpos.q2.QClassLoader@78d8ac
source = file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-entitymanager-4.0.1.Final.jar
CLASS = javax.persistence.spi.PersistenceProvider
loader = org.jpos.q2.QClassLoader@78d8ac
source = file:/C:/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT/deploy/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar

Op maandag 30 september 2013 10:51:13 UTC+2 schreef Victor Salaman:

Pieter Botha

unread,
Sep 30, 2013, 6:48:11 AM9/30/13
to jpos-...@googlegroups.com
Hi Victor,

One thing I noticed is that during unit testing, it all works perfectly, but then it is a sun.misc.Launcher class loader. Thus, there must obviously be a difference between the unit-test and run/q2 environments. If so, how do I determine the difference?

CLASS = org.hibernate.ejb.HibernatePersistence
loader = sun.misc.Launcher$AppClassLoader@13dc4d5
source = file:/C:/Users/pieterb/.m2/repository/org/hibernate/hibernate-entitymanager/4.0.1.Final/hibernate-entitymanager-4.0.1.Final.jar
CLASS = javax.persistence.spi.PersistenceProvider
loader = sun.misc.Launcher$AppClassLoader@13dc4d5
source = file:/C:/Users/pieterb/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar

Pieter

Op maandag 30 september 2013 11:08:22 UTC+2 schreef Pieter Botha:

Victor Salaman

unread,
Sep 30, 2013, 8:58:10 AM9/30/13
to jpos-...@googlegroups.com
Hi:

I want to solve your problem, but there must be a compromise :)

Follow these steps:

1. Move every jar away from deploy/lib.
2. Add each jar to the classpath.
3. Run Q2 again.

I'll assume this worked...

Hope this helps.

/V

September 30, 2013 6:48 AM
Hi Victor,

One thing I noticed is that during unit testing, it all works perfectly, but then it is a sun.misc.Launcher class loader. Thus, there must obviously be a difference between the unit-test and run/q2 environments. If so, how do I determine the difference?

CLASS = org.hibernate.ejb.HibernatePersistence
loader = sun.misc.Launcher$AppClassLoader@13dc4d5
CLASS = javax.persistence.spi.PersistenceProvider
loader = sun.misc.Launcher$AppClassLoader@13dc4d5

Pieter

Op maandag 30 september 2013 11:08:22 UTC+2 schreef Pieter Botha:
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
 
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
September 30, 2013 5:08 AM
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.
Please support jPOS, contact: sa...@jpos.org
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
 
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
September 30, 2013 4:51 AM

Alejandro Revilla

unread,
Sep 30, 2013, 10:31:00 AM9/30/13
to jPOS Users

Pieter, Victor's suggestion will probably solve your problem. The hot-deployment provided by the URLClassLoader that monitors the deploy/lib directory was intended for quick hacks, usually involving adding a filter to a running class to fix an issue on the spot until we have a chance to restart the system, but it creates a new class loader every time you touch the deploy/lib directory last modified timestamp.

This has of course negative side-effects, specially if you use singletons or situations like the one you're experiencing.

The move to OSGi will probably solve all this issues, actually, you could attempt to run 1.9.3-SNAPSHOT in an OSGi container right away.

Good luck!



--
@apr

postbox-contact.jpg
compose-unknown-contact.jpg

Pieter Botha

unread,
Sep 30, 2013, 10:42:22 AM9/30/13
to jpos-...@googlegroups.com
Hi Victor, Alejandro

My code is not in the jPOS jar, so I have to place my code sort of in the deploy/lib where Q2 will find it.

I have removed all the jars from the deploy/lib directory and moved them into a directory that is in the classpath. I have tried this in bash/windows and dos/windows command line. To make sure that my classpath is correct, forced the class path in my second iteration (java -cp "C:\dev\netswitch\netswitch\lib\*" -jar jpos-1.8.7-SNAPSHOT.jar). If the jars are not in the deploy/lib directory, then they are not picked up by Q2.
If the 4 jars below are in the deploy/lib directory, then they are picked up by Q2 and loaded after which the casting error occurs.

I have also trimmed down the deploy/lib to a minimum of jars (the 4 jars listed below) where common.jar has a class that requests something from database.jar.

Currently I'm doing a fresh restart for each deployment until the move to OSGI is complete, though I'm readying my code for that move by having Maven submodules (separate jar files). This has the benefit keeping the jPOS checkout clean.

Pieter

a@a-PC /c/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT (JPA)
$ echo $CLASSPATH
C:\dev\netswitch\netswitch\lib

a@a-PC /c/dev/netswitch/netswitch/projects/jPOS/jpos/target/jpos-1.8.7-SNAPSHOT (JPA)
$ ls /c/dev/netswitch/netswitch/lib/*
/c/dev/netswitch/netswitch/lib/common-1.0-SNAPSHOT.jar    /c/dev/netswitch/netswitch/lib/hibernate-entitymanager-4.0.1.Final.jar
/c/dev/netswitch/netswitch/lib/database-1.0-SNAPSHOT.jar  /c/dev/netswitch/netswitch/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar

Op maandag 30 september 2013 16:31:00 UTC+2 schreef Alejandro Revilla:

Alejandro Revilla

unread,
Sep 30, 2013, 10:45:31 AM9/30/13
to jPOS Users

Pieter, -cp and -jar doesn't mix.

If you use -cp you just need to add org.jpos.q2.Q2 as the main class, and remove the -jar switch.



--
@apr

Pieter Botha

unread,
Oct 8, 2013, 4:03:37 AM10/8/13
to jpos-...@googlegroups.com
Hi Alejandro, Victor,

Thank you very much for the help. It turns out the -jar was the source of the problem. I suppose the correct way of starting Q2 is via the classpath and org.jpos.q2.Q2 .

I'll try the new OSGI build once my Maven is upgraded to Gradle.

Pieter

Op maandag 30 september 2013 16:45:31 UTC+2 schreef Alejandro Revilla:
Reply all
Reply to author
Forward
0 new messages