cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From D Tim Cummings <...@triptera.com.au>
Subject Re: How to use cayenne-migrations
Date Mon, 24 Mar 2014 01:12:47 GMT
So I added a couple of extra jars to classpath 

java -cp cayenne-migrations-0.1.jar:cayenne-server-3.2M1.jar:commons-logging-1.1.3.jar:commons-collections-3.2.1.jar
org.apache.cayenne.migration.MigrationGenerator cayenne-project.xml .

and then got the following error.

Exception in thread "main" org.apache.cayenne.configuration.server.DataDomainLoadException:
[v.3.2M1 Jul 07 2013 16:23:58] Configuration resource "cayenne-project.xml" is not found.
	at org.apache.cayenne.configuration.server.DataDomainProvider.createAndInitDataDomain(DataDomainProvider.java:143)
	at org.apache.cayenne.configuration.server.DataDomainProvider.get(DataDomainProvider.java:106)
	at org.apache.cayenne.configuration.server.DataDomainProvider.get(DataDomainProvider.java:60)
	at org.apache.cayenne.di.spi.CustomProvidersProvider.get(CustomProvidersProvider.java:38)
	at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:42)
	at org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:49)
	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
	at org.apache.cayenne.configuration.server.ServerRuntime.getDataDomain(ServerRuntime.java:92)
	at org.apache.cayenne.migration.MigrationGenerator.generateInitialMigration(MigrationGenerator.java:75)
	at org.apache.cayenne.migration.MigrationGenerator.main(MigrationGenerator.java:58)

I had cayenne-project.xml and datamap.map.xml in the same folder I was running MigrationGenerator
from.

Another thing I find unusual is that when I add a maven dependency of cayenne-migrations to
my tapestry app using the following 

        <dependency>
        	<groupId>org.apache.cayenne</groupId>
        	<artifactId>cayenne-server</artifactId>
        	<version>3.2M1</version>
        </dependency>
        <dependency>
        	<groupId>org.apache.cayenne</groupId>
        	<artifactId>cayenne-migrations</artifactId>
        	<version>0.1</version>
        </dependency>


then cayenne-migrations shows up as a folder not a jar in the dependency view of the pom,
and it does not appear to be on the classpath.



I don't know what this means?

Thanks

Tim



On 24 Mar 2014, at 9:52, D Tim Cummings <tim@triptera.com.au> wrote:

> What is the easiest way to run MigrationGenerator.
> 
> I tried
> 
> java -cp cayenne-migrations-0.1.jar org.apache.cayenne.migration.MigrationGenerator
> 
> which gave me the usage instructions.
> 
> Usage:
> java org.apache.cayenne.migration.MigrationGenerator <cayenne-Project.xml> <output-folder>
> 
> I added the required arguments (with cayenne-migrations-0.1.jar and cayenne-project.xml
in the same directory)
> 
> java -cp cayenne-migrations-0.1.jar org.apache.cayenne.migration.MigrationGenerator cayenne-project.xml
.
> 
> but that gave me this error.
> 
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cayenne/configuration/server/ServerRuntime
> 	at org.apache.cayenne.migration.MigrationGenerator.generateInitialMigration(MigrationGenerator.java:74)
> 	at org.apache.cayenne.migration.MigrationGenerator.main(MigrationGenerator.java:58)
> Caused by: java.lang.ClassNotFoundException: org.apache.cayenne.configuration.server.ServerRuntime
> ...
> 
> So I added cayenne-server to the current directory and classpath and ran
> 
> java -cp cayenne-migrations-0.1.jar:cayenne-server-3.2M1.jar org.apache.cayenne.migration.MigrationGenerator
cayenne-project.xml .
> 
> but got this error.
> 
> Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
> 	at org.apache.cayenne.configuration.server.DataDomainProvider.<clinit>(DataDomainProvider.java:62)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> 	at org.apache.cayenne.di.spi.ConstructorInjectingProvider.get(ConstructorInjectingProvider.java:164)
> 	at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:42)
> 	at org.apache.cayenne.di.spi.CustomProvidersProvider.get(CustomProvidersProvider.java:38)
> 	at org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:42)
> 	at org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:49)
> 	at org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:103)
> 	at org.apache.cayenne.configuration.server.ServerRuntime.getDataDomain(ServerRuntime.java:92)
> 	at org.apache.cayenne.migration.MigrationGenerator.generateInitialMigration(MigrationGenerator.java:75)
> 	at org.apache.cayenne.migration.MigrationGenerator.main(MigrationGenerator.java:58)
> Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
> ...
> 
> I could keep finding jars for the classpath but figure there is an easier way. Thanks
in advance
> 
> Tim
> 
> 
> On 23 Mar 2014, at 0:42, John Huss <johnthuss@gmail.com> wrote:
> 
>> Also, you should know that you can generate your initial migration from
>> your DataMap using MigrationGenerator.  So take advantage of that.
>> 
>> 
>> On Sat, Mar 22, 2014 at 9:40 AM, John Huss <johnthuss@gmail.com> wrote:
>> 
>>> Ah, sorry, the pom wasn't really right due to my lack of maven knowledge.
>>> If you update it should work now.  Thanks!
>>> 
>>> 
>>> On Sat, Mar 22, 2014 at 1:42 AM, D Tim Cummings <tim@triptera.com.au>wrote:
>>> 
>>>> I would like to try using cayenne-migrations to do database schema
>>>> updates when my application starts but I am not sure how the cayenne
>>>> sandbox works.
>>>> 
>>>> I have checked out cayenne-migrations
>>>> 
>>>> svn co
>>>> http://svn.apache.org/repos/asf/cayenne/sandbox/cayenne-migrations/
>>>> 
>>>> and then I tried to install it in my local maven repository
>>>> 
>>>> cd cayenne-migrations/
>>>> mvn clean install
>>>> 
>>>> But I get an error message
>>>> 
>>>> [ERROR]   The project
>>>> org.apache.cayenne:cayenne-migrations:3.2M1-SNAPSHOT
>>>> (/Users/tim/temp/cayenne-migrations/pom.xml) has 1 error
>>>> [ERROR]     Non-resolvable parent POM: Could not find artifact
>>>> org.apache.cayenne:cayenne-parent:pom:3.2M1-SNAPSHOT and
>>>> 'parent.relativePath' points at wrong local POM @ line 4, column 10 ->
>>>> [Help 2]
>>>> 
>>>> In the pom.xml I notice
>>>> 
>>>> <parent>
>>>> <groupId>org.apache.cayenne</groupId>
>>>> <artifactId>cayenne-parent</artifactId>
>>>> <version>3.2M1-SNAPSHOT</version>
>>>> </parent>
>>>> 
>>>> I changed the version to 3.2M1 and the build seems to get further.
>>>> However, now I get the following error
>>>> 
>>>> [ERROR] Failed to execute goal on project cayenne-migrations: Could not
>>>> resolve dependencies for project
>>>> org.apache.cayenne:cayenne-migrations:jar:3.2M1: Failed to collect
>>>> dependencies at
>>>> org.apache.cayenne.unpublished:cayenne-jdk1.5-unpublished:jar:[3.1,): No
>>>> versions available for
>>>> org.apache.cayenne.unpublished:cayenne-jdk1.5-unpublished:jar:[3.1,) within
>>>> specified range -> [Help 1]
>>>> 
>>>> In the pom.xml I notice
>>>> 
>>>>                <dependency>
>>>>                        <groupId>org.apache.cayenne.unpublished</groupId>
>>>> 
>>>> <artifactId>cayenne-jdk1.5-unpublished</artifactId>
>>>>                        <version>[3.1,)</version>
>>>>                </dependency>
>>>> 
>>>> 
>>>> What should I do next?
>>>> 
>>>> Tim
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
> 


Mime
View raw message