You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Schönfisch, Jörg <jo...@softplant.de> on 2012/03/14 14:38:21 UTC

Schema generation with Ant

Hi everybody,

I'm trying to generate my database schema through Ant, but I get an error and I have no idea why. This is the error message in the console:

Invalid class org.apache.cayenne.dba.JdbcAdapter of type org.apache.cayenne.dba.DbAdapter

The same message appears if I use org.apache.cayenne.dba.postgres.PostgresAdapter.
The relevant parts of the Ant script:

       <path id="classpath">
             <fileset dir="lib">
                    <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
                    <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
                    <include name="cayenne/third-party/vpp-2.2.1.jar" />
                    <include name="cayenne/third-party/commons-collections-3.1.jar" />
                    <include name="cayenne/third-party/commons-logging-1.1.jar" />
                    <include name="cayenne/third-party/velocity-1.6.3.jar" />
             </fileset>
       </path>
       <typedef resource="org/apache/cayenne/tools/antlib.xml">
             <classpath refid="classpath" />
       </typedef>

       <target name="createTables_postgres">
             <cdbgen map="../Config/lspMap.map.xml" adapter="org.apache.cayenne.dba.postgres.PostgresAdapter"
                    driver="${sql.driver}" url="${sql.url}" username="${sql.user}"
                    password="${sql.pass}" />
       </target>


Any hints on why this happens? Do I have to include additional libraries or use other settings?


Regards,

Joerg


AW: Schema generation with Ant

Posted by Schönfisch, Jörg <jo...@softplant.de>.
Hi Michael,

the class is also present in my version of the snapshot.
The jar is located in a subfolder of the lib directory and ant also prints the correct absolute path to it so the classpath should be fine this way.
I'll try to find more time for debugging this next week. Thanks so far for your time!

Cheers,
Joerg


-----Ursprüngliche Nachricht-----
Von: Michael Gentry [mailto:mgentry@masslight.net] 
Gesendet: Donnerstag, 15. März 2012 13:59
An: user@cayenne.apache.org
Betreff: Re: Schema generation with Ant

Hi Joerg,

The PostgresAdapter is definitely part of the snapshot:

$ jar tvf ~/.m2/repository/org/apache/cayenne/cayenne-server/3.1M4-SNAPSHOT/cayenne-server-3.1M4-SNAPSHOT.jar
| grep PostgresAdapter
  8090 Fri Feb 24 09:01:24 EST 2012
org/apache/cayenne/dba/postgres/PostgresAdapter.class

The only thing I'm noticing offhand is the documentation lists the
Cayenne jars as:

   <fileset dir="lib" >
      <include name="cayenne-tools-X.X.jar" />
      <include name="cayenne-server-X.X.jar" />
      <include name="third-party/vpp-2.2.1.jar" />
   </fileset>

And you have a leading "cayenne/" in front of yours:

            <fileset dir="lib">
                   <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
                   <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
                   <include name="cayenne/third-party/vpp-2.2.1.jar" />
                   <include
name="cayenne/third-party/commons-collections-3.1.jar" />
                   <include
name="cayenne/third-party/commons-logging-1.1.jar" />
                   <include name="cayenne/third-party/velocity-1.6.3.jar" />
            </fileset>


mrg


On Thu, Mar 15, 2012 at 7:37 AM, Schönfisch, Jörg
<jo...@softplant.de> wrote:
> Hi Michael,
>
> I found the Ant debug settings :) This seems to be the relevant part of the exception:
>
> Caused by: java.lang.ClassNotFoundException: org.apache.cayenne.dba.postgres.PostgresAdapter
>        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 java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forName(Class.java:247)
>        at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.getJavaClass(DefaultAdhocObjectFactory.java:102)
>        at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(DefaultAdhocObjectFactory.java:51)
>        ... 22 more
>
> I've added the classpathref attribute to the cdbgen task and verified that it actually contains the cayenne-server.jar, but the classloader in DefaultAdhocObjectFactory does not load it, as far as i could debug it.
> I tried debugging the DbGeneratorClass in the tools.jar, but had no luck so far.
>
> Regards,
> Joerg
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Michael Gentry [mailto:mgentry@masslight.net]
> Gesendet: Mittwoch, 14. März 2012 21:22
> An: user@cayenne.apache.org
> Betreff: Re: Schema generation with Ant
>
> Hi Joerg,
>
> Can you include more of the error message?  I didn't see anything
> obvious, but I don't really use the Ant plugin, either.
>
> Thanks,
>
> mrg
>
>
> On Wed, Mar 14, 2012 at 9:38 AM, Schönfisch, Jörg
> <jo...@softplant.de> wrote:
>> Hi everybody,
>>
>> I'm trying to generate my database schema through Ant, but I get an error and I have no idea why. This is the error message in the console:
>>
>> Invalid class org.apache.cayenne.dba.JdbcAdapter of type org.apache.cayenne.dba.DbAdapter
>>
>> The same message appears if I use org.apache.cayenne.dba.postgres.PostgresAdapter.
>> The relevant parts of the Ant script:
>>
>>       <path id="classpath">
>>             <fileset dir="lib">
>>                    <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
>>                    <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
>>                    <include name="cayenne/third-party/vpp-2.2.1.jar" />
>>                    <include name="cayenne/third-party/commons-collections-3.1.jar" />
>>                    <include name="cayenne/third-party/commons-logging-1.1.jar" />
>>                    <include name="cayenne/third-party/velocity-1.6.3.jar" />
>>             </fileset>
>>       </path>
>>       <typedef resource="org/apache/cayenne/tools/antlib.xml">
>>             <classpath refid="classpath" />
>>       </typedef>
>>
>>       <target name="createTables_postgres">
>>             <cdbgen map="../Config/lspMap.map.xml" adapter="org.apache.cayenne.dba.postgres.PostgresAdapter"
>>                    driver="${sql.driver}" url="${sql.url}" username="${sql.user}"
>>                    password="${sql.pass}" />
>>       </target>
>>
>>
>> Any hints on why this happens? Do I have to include additional libraries or use other settings?
>>
>>
>> Regards,
>>
>> Joerg
>>

Re: Schema generation with Ant

Posted by Michael Gentry <mg...@masslight.net>.
Hi Joerg,

The PostgresAdapter is definitely part of the snapshot:

$ jar tvf ~/.m2/repository/org/apache/cayenne/cayenne-server/3.1M4-SNAPSHOT/cayenne-server-3.1M4-SNAPSHOT.jar
| grep PostgresAdapter
  8090 Fri Feb 24 09:01:24 EST 2012
org/apache/cayenne/dba/postgres/PostgresAdapter.class

The only thing I'm noticing offhand is the documentation lists the
Cayenne jars as:

   <fileset dir="lib" >
      <include name="cayenne-tools-X.X.jar" />
      <include name="cayenne-server-X.X.jar" />
      <include name="third-party/vpp-2.2.1.jar" />
   </fileset>

And you have a leading "cayenne/" in front of yours:

            <fileset dir="lib">
                   <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
                   <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
                   <include name="cayenne/third-party/vpp-2.2.1.jar" />
                   <include
name="cayenne/third-party/commons-collections-3.1.jar" />
                   <include
name="cayenne/third-party/commons-logging-1.1.jar" />
                   <include name="cayenne/third-party/velocity-1.6.3.jar" />
            </fileset>


mrg


On Thu, Mar 15, 2012 at 7:37 AM, Schönfisch, Jörg
<jo...@softplant.de> wrote:
> Hi Michael,
>
> I found the Ant debug settings :) This seems to be the relevant part of the exception:
>
> Caused by: java.lang.ClassNotFoundException: org.apache.cayenne.dba.postgres.PostgresAdapter
>        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 java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forName(Class.java:247)
>        at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.getJavaClass(DefaultAdhocObjectFactory.java:102)
>        at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(DefaultAdhocObjectFactory.java:51)
>        ... 22 more
>
> I've added the classpathref attribute to the cdbgen task and verified that it actually contains the cayenne-server.jar, but the classloader in DefaultAdhocObjectFactory does not load it, as far as i could debug it.
> I tried debugging the DbGeneratorClass in the tools.jar, but had no luck so far.
>
> Regards,
> Joerg
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Michael Gentry [mailto:mgentry@masslight.net]
> Gesendet: Mittwoch, 14. März 2012 21:22
> An: user@cayenne.apache.org
> Betreff: Re: Schema generation with Ant
>
> Hi Joerg,
>
> Can you include more of the error message?  I didn't see anything
> obvious, but I don't really use the Ant plugin, either.
>
> Thanks,
>
> mrg
>
>
> On Wed, Mar 14, 2012 at 9:38 AM, Schönfisch, Jörg
> <jo...@softplant.de> wrote:
>> Hi everybody,
>>
>> I'm trying to generate my database schema through Ant, but I get an error and I have no idea why. This is the error message in the console:
>>
>> Invalid class org.apache.cayenne.dba.JdbcAdapter of type org.apache.cayenne.dba.DbAdapter
>>
>> The same message appears if I use org.apache.cayenne.dba.postgres.PostgresAdapter.
>> The relevant parts of the Ant script:
>>
>>       <path id="classpath">
>>             <fileset dir="lib">
>>                    <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
>>                    <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
>>                    <include name="cayenne/third-party/vpp-2.2.1.jar" />
>>                    <include name="cayenne/third-party/commons-collections-3.1.jar" />
>>                    <include name="cayenne/third-party/commons-logging-1.1.jar" />
>>                    <include name="cayenne/third-party/velocity-1.6.3.jar" />
>>             </fileset>
>>       </path>
>>       <typedef resource="org/apache/cayenne/tools/antlib.xml">
>>             <classpath refid="classpath" />
>>       </typedef>
>>
>>       <target name="createTables_postgres">
>>             <cdbgen map="../Config/lspMap.map.xml" adapter="org.apache.cayenne.dba.postgres.PostgresAdapter"
>>                    driver="${sql.driver}" url="${sql.url}" username="${sql.user}"
>>                    password="${sql.pass}" />
>>       </target>
>>
>>
>> Any hints on why this happens? Do I have to include additional libraries or use other settings?
>>
>>
>> Regards,
>>
>> Joerg
>>

AW: Schema generation with Ant

Posted by Schönfisch, Jörg <jo...@softplant.de>.
Hi Michael,

I found the Ant debug settings :) This seems to be the relevant part of the exception:

Caused by: java.lang.ClassNotFoundException: org.apache.cayenne.dba.postgres.PostgresAdapter
	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 java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:247)
	at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.getJavaClass(DefaultAdhocObjectFactory.java:102)
	at org.apache.cayenne.di.spi.DefaultAdhocObjectFactory.newInstance(DefaultAdhocObjectFactory.java:51)
	... 22 more

I've added the classpathref attribute to the cdbgen task and verified that it actually contains the cayenne-server.jar, but the classloader in DefaultAdhocObjectFactory does not load it, as far as i could debug it.
I tried debugging the DbGeneratorClass in the tools.jar, but had no luck so far.

Regards,
Joerg




-----Ursprüngliche Nachricht-----
Von: Michael Gentry [mailto:mgentry@masslight.net] 
Gesendet: Mittwoch, 14. März 2012 21:22
An: user@cayenne.apache.org
Betreff: Re: Schema generation with Ant

Hi Joerg,

Can you include more of the error message?  I didn't see anything
obvious, but I don't really use the Ant plugin, either.

Thanks,

mrg


On Wed, Mar 14, 2012 at 9:38 AM, Schönfisch, Jörg
<jo...@softplant.de> wrote:
> Hi everybody,
>
> I'm trying to generate my database schema through Ant, but I get an error and I have no idea why. This is the error message in the console:
>
> Invalid class org.apache.cayenne.dba.JdbcAdapter of type org.apache.cayenne.dba.DbAdapter
>
> The same message appears if I use org.apache.cayenne.dba.postgres.PostgresAdapter.
> The relevant parts of the Ant script:
>
>       <path id="classpath">
>             <fileset dir="lib">
>                    <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
>                    <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
>                    <include name="cayenne/third-party/vpp-2.2.1.jar" />
>                    <include name="cayenne/third-party/commons-collections-3.1.jar" />
>                    <include name="cayenne/third-party/commons-logging-1.1.jar" />
>                    <include name="cayenne/third-party/velocity-1.6.3.jar" />
>             </fileset>
>       </path>
>       <typedef resource="org/apache/cayenne/tools/antlib.xml">
>             <classpath refid="classpath" />
>       </typedef>
>
>       <target name="createTables_postgres">
>             <cdbgen map="../Config/lspMap.map.xml" adapter="org.apache.cayenne.dba.postgres.PostgresAdapter"
>                    driver="${sql.driver}" url="${sql.url}" username="${sql.user}"
>                    password="${sql.pass}" />
>       </target>
>
>
> Any hints on why this happens? Do I have to include additional libraries or use other settings?
>
>
> Regards,
>
> Joerg
>

Re: Schema generation with Ant

Posted by Michael Gentry <mg...@masslight.net>.
Hi Joerg,

Can you include more of the error message?  I didn't see anything
obvious, but I don't really use the Ant plugin, either.

Thanks,

mrg


On Wed, Mar 14, 2012 at 9:38 AM, Schönfisch, Jörg
<jo...@softplant.de> wrote:
> Hi everybody,
>
> I'm trying to generate my database schema through Ant, but I get an error and I have no idea why. This is the error message in the console:
>
> Invalid class org.apache.cayenne.dba.JdbcAdapter of type org.apache.cayenne.dba.DbAdapter
>
> The same message appears if I use org.apache.cayenne.dba.postgres.PostgresAdapter.
> The relevant parts of the Ant script:
>
>       <path id="classpath">
>             <fileset dir="lib">
>                    <include name="cayenne/cayenne-tools-3.1M4-SNAPSHOT.jar" />
>                    <include name="cayenne/cayenne-server-3.1M4-SNAPSHOT.jar" />
>                    <include name="cayenne/third-party/vpp-2.2.1.jar" />
>                    <include name="cayenne/third-party/commons-collections-3.1.jar" />
>                    <include name="cayenne/third-party/commons-logging-1.1.jar" />
>                    <include name="cayenne/third-party/velocity-1.6.3.jar" />
>             </fileset>
>       </path>
>       <typedef resource="org/apache/cayenne/tools/antlib.xml">
>             <classpath refid="classpath" />
>       </typedef>
>
>       <target name="createTables_postgres">
>             <cdbgen map="../Config/lspMap.map.xml" adapter="org.apache.cayenne.dba.postgres.PostgresAdapter"
>                    driver="${sql.driver}" url="${sql.url}" username="${sql.user}"
>                    password="${sql.pass}" />
>       </target>
>
>
> Any hints on why this happens? Do I have to include additional libraries or use other settings?
>
>
> Regards,
>
> Joerg
>