[deepamehta-devel] some newbie dev migrations questions

carolina carolina at sindominio.net
So Feb 9 00:59:46 CET 2014


Hello :)

a month ago or so, I started the first try to do a DM plugin, a calendar
plugin. Now I want to continue with it, but of course I get stuck at
what probably are silly things, so I proceed to ask till I get a bit
familiar with DM.

The question is related to migrations, since I'm not sure I understand
how migrations work, is where I think I have the problem.

I had a first declarative migration, migration1.json, where I defined an
event with a start_date and end_date.

Today I edited that migration1.json and added a title and text to the
event, saved the file and run

mvn clean package

it said build success but showed a failed in the server terminal, so
after re-reading the documentation, I read that a migration

"is executed exactly once in the lifetime of a particular DeepaMehta
installation"

so I guess the migration1.json should have been renamed into
migration2.json and then the plugin.properties file changed so that
it looked like

requiredPluginMigrationNr=2
importModels=de.deepamehta.webclient


So I've tried to "cheat", I've left migration1.json as it originally was
(or I think so), then I've created a migration2.json with the new
changes ,  but no luck, I get an error that I attach as a a file since
its too long to paste.

At some point says

Caused by: java.lang.RuntimeException: Running migration 2 of plugin
"CGC Calendar" failed

which makes me think that has to do with this migration, maybe the error
is not in the naming but somewhere else, has to do with syntax or that
I've missed sth,

Here is the repo where I've got the code of the migration after adding
the title and text to the original one and before renaming the migration
to migration2.json I've not pushed the changes since i'm not sure it has
to do with it

https://github.com/carolinagc/dm-cgc-calendar/commit/8cb4d62ae4ea2499336b4570c7363d10437e3cb7


even if the problem is somewhere else I have not clear how migrations
versions work (I guess I've got bad RoR migrations habits)
btw is there a way to create again the database from scratch so to be
able to run the first migration?

thanks in advance :-)))

best
C















-- 
>> Donde la pinten, salto
-------------- nächster Teil --------------
INFO: ----- Activating plugin "CGC Calendar" -----
09-feb-2014 0:21:33 de.deepamehta.core.impl.PluginImpl createPluginTopicIfNotExists
INFO: Installing plugin "CGC Calendar" in the database ABORTED -- already installed
09-feb-2014 0:21:33 de.deepamehta.core.impl.MigrationManager runPluginMigrations
INFO: Running 2 migrations for plugin "CGC Calendar" (migrationNr=1, requiredMigrationNr=3)
09-feb-2014 0:21:33 de.deepamehta.core.impl.MigrationManager$MigrationInfo readMigrationConfigFile
INFO: Reading migration config file "/migrations/migration2.properties" ABORTED -- file does not exist
09-feb-2014 0:21:33 de.deepamehta.core.impl.MigrationManager runMigration
INFO: Running migration 2 of plugin "CGC Calendar" (runMode=ALWAYS, isCleanInstall=false)
09-feb-2014 0:21:33 de.deepamehta.core.util.DeepaMehtaUtils readMigrationFile
INFO: Reading migration file "/migrations/migration2.json"
09-feb-2014 0:21:33 de.deepamehta.core.impl.EmbeddedService createTopicType
ADVERTENCIA: ROLLBACK!
09-feb-2014 0:21:33 de.deepamehta.core.impl.PluginImpl installPluginInDB
ADVERTENCIA: ROLLBACK! (plugin "CGC Calendar")
09-feb-2014 0:21:33 de.deepamehta.core.impl.PluginImpl$1 addingService
GRAVE: Adding service org.apache.felix.eventadmin.impl.security.EventAdminSecurityDecorator at 1553743 to plugin "CGC Calendar" failed:
java.lang.RuntimeException: Activation of plugin "CGC Calendar" failed
	at de.deepamehta.core.impl.PluginManager._activatePlugin(PluginManager.java:136)
	at de.deepamehta.core.impl.PluginManager.activatePlugin(PluginManager.java:64)
	at de.deepamehta.core.impl.PluginImpl.checkRequirementsForActivation(PluginImpl.java:477)
	at de.deepamehta.core.impl.PluginImpl.addService(PluginImpl.java:422)
	at de.deepamehta.core.impl.PluginImpl.access$000(PluginImpl.java:49)
	at de.deepamehta.core.impl.PluginImpl$1.addingService(PluginImpl.java:349)
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
	at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184)
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:339)
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:273)
	at de.deepamehta.core.impl.PluginImpl.openServiceTrackers(PluginImpl.java:394)
	at de.deepamehta.core.impl.PluginImpl.openCoreServiceTrackers(PluginImpl.java:375)
	at de.deepamehta.core.impl.PluginImpl.start(PluginImpl.java:127)
	at de.deepamehta.core.osgi.PluginActivator.start(PluginActivator.java:51)
	at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629)
	at org.apache.felix.framework.Felix.activateBundle(Felix.java:1904)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:927)
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1175)
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1153)
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:458)
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)
Caused by: java.lang.RuntimeException: Installing plugin "CGC Calendar" in the database failed
	at de.deepamehta.core.impl.PluginImpl.installPluginInDB(PluginImpl.java:512)
	at de.deepamehta.core.impl.PluginManager._activatePlugin(PluginManager.java:125)
	... 22 more
Caused by: java.lang.RuntimeException: Running migration 2 of plugin "CGC Calendar" failed
	at de.deepamehta.core.impl.MigrationManager.runMigration(MigrationManager.java:143)
	at de.deepamehta.core.impl.MigrationManager.runPluginMigration(MigrationManager.java:88)
	at de.deepamehta.core.impl.MigrationManager.runPluginMigrations(MigrationManager.java:56)
	at de.deepamehta.core.impl.PluginImpl.installPluginInDB(PluginImpl.java:499)
	... 23 more
Caused by: java.lang.RuntimeException: Reading migration file "/migrations/migration2.json" failed
	at de.deepamehta.core.util.DeepaMehtaUtils.readMigrationFile(DeepaMehtaUtils.java:186)
	at de.deepamehta.core.impl.MigrationManager.runMigration(MigrationManager.java:130)
	... 26 more
Caused by: java.lang.RuntimeException: Creating topic type "cgc.calendar.event" failed (topic type (id=-1, uri="cgc.calendar.event", value="Event", typeUri="dm4.core.topic_type", dataTypeUri="dm4.core.composite", indexModes=[], assocDefs=[
    association definition (association (id=-1, uri="null", typeUri="dm4.core.composition_def", value="null", composite={},
        topic role (roleTypeUri="dm4.core.parent_type", topicUri="cgc.calendar.event"),
        topic role (roleTypeUri="dm4.core.child_type", topicUri="cgc.calendar.title")),
        parent cardinality="dm4.core.one",
        child cardinality="dm4.core.one",
        view configuration {})
, 
    association definition (association (id=-1, uri="null", typeUri="dm4.core.composition_def", value="null", composite={},
        topic role (roleTypeUri="dm4.core.parent_type", topicUri="cgc.calendar.event"),
        topic role (roleTypeUri="dm4.core.child_type", topicUri="cgc.calendar.text")),
        parent cardinality="dm4.core.one",
        child cardinality="dm4.core.one",
        view configuration {})
, 
    association definition (association (id=-1, uri="null", typeUri="dm4.core.composition_def", value="null", composite={},
        topic role (roleTypeUri="dm4.core.parent_type", topicUri="cgc.calendar.event"),
        topic role (roleTypeUri="dm4.core.child_type", topicUri="cgc.calendar.start_date")),
        parent cardinality="dm4.core.one",
        child cardinality="dm4.core.one",
        view configuration {})
, 
    association definition (association (id=-1, uri="null", typeUri="dm4.core.composition_def", value="null", composite={},
        topic role (roleTypeUri="dm4.core.parent_type", topicUri="cgc.calendar.event"),
        topic role (roleTypeUri="dm4.core.child_type", topicUri="cgc.calendar.end_date")),
        parent cardinality="dm4.core.one",
        child cardinality="dm4.core.one",
        view configuration {})
], labelConfig=[cgc.calendar.title, cgc.calendar.text], view configuration {dm4.webclient.view_config=topic (id=-1, uri="null", typeUri="dm4.webclient.view_config", value="null", composite={dm4.webclient.show_in_create_menu=topic (id=-1, uri="null", typeUri="dm4.webclient.show_in_create_menu", value="true", composite={})})}))
	at de.deepamehta.core.impl.EmbeddedService.createTopicType(EmbeddedService.java:425)
	at de.deepamehta.core.util.DeepaMehtaUtils.createTopicTypes(DeepaMehtaUtils.java:193)
	at de.deepamehta.core.util.DeepaMehtaUtils.readMigrationFile(DeepaMehtaUtils.java:171)
	... 27 more
Caused by: java.lang.RuntimeException: URI "cgc.calendar.event" is not unique
	at de.deepamehta.storage.neo4j.Neo4jStorage.checkUriUniqueness(Neo4jStorage.java:1064)
	at de.deepamehta.storage.neo4j.Neo4jStorage.storeTopic(Neo4jStorage.java:156)
	at de.deepamehta.core.impl.StorageDecorator.storeTopic(StorageDecorator.java:99)
	at de.deepamehta.core.impl.EmbeddedService.topicFactory(EmbeddedService.java:796)
	at de.deepamehta.core.impl.EmbeddedService.createTypeTopic(EmbeddedService.java:855)
	at de.deepamehta.core.impl.EmbeddedService.topicTypeFactory(EmbeddedService.java:826)
	at de.deepamehta.core.impl.EmbeddedService.createTopicType(EmbeddedService.java:417)
	... 29 more
09-feb-2014 0:22:33 de.deepamehta.plugins.topicmaps.model.TopicmapViewmodel <init>
INFO: Loading topicmap 2584
09-feb-2014 0:22:34 de.deepamehta.plugins.caching.CachingPlugin serviceRequestFilter
INFO: ### Precondition of GET request failed (object 9199)

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 555 bytes
Beschreibung: OpenPGP digital signature
URL         : <http://lists.deepamehta.de/mailman/private/devel-lists.deepamehta.de/attachments/20140209/e5d4bd8d/attachment.pgp>


Mehr Informationen über die Mailingliste devel