after JPA migration you cannot call "create configuration directory"

Description

When calling "create configuration directory" command on a clean system, the command fails:

[java] 2016-04-03T20:02:20,920 INFO MCRConfigurationInputStream: Current configuration directory: C:\Users\mcradmin\AppData\Local\MyCoRe\rosdok
[java] Using Log4J2 configuration at: jar:file:/C:/workspaces/rosdok/projects/rosdok/rosdok-cli/target/appassembler/lib/rosdok-module-2016.03-SNAPSHOT.jar!/log4j2.xml
[java] 2016-04-03T20:02:21,263 INFO MCRStartupHandler: I have these components for you: [mcr:mycore-base, mcr:mycore-indexing, mcr:mycore-migration-2015, mcr:mycore-swf, mcr:mycore-mets, mcr:mycore-solr, mcr:mycore-iview2, mcr:mycore-mods, mcr:mycore-user2, mcr:mycore-oai, mcr:mycore-restapi, mcr:mycore-urn, mcr:mycore-wcms2, mcr:mycore-xeditor, mcr:mycore-ifs, mcr:mycore-media, mcr:mycore-pi, app:jspdocportal-module, app:rosdok-module]
[java] 2016-04-03T20:02:21,263 INFO MCRStartupHandler: I have these mycore components for you: [mcr:mycore-base, mcr:mycore-indexing, mcr:mycore-migration-2015, mcr:mycore-swf, mcr:mycore-mets, mcr:mycore-solr, mcr:mycore-iview2, mcr:mycore-mods, mcr:mycore-user2, mcr:mycore-oai, mcr:mycore-restapi, mcr:mycore-urn, mcr:mycore-wcms2, mcr:mycore-xeditor, mcr:mycore-ifs, mcr:mycore-media, mcr:mycore-pi]
[java] 2016-04-03T20:02:21,263 INFO MCRStartupHandler: I have these app modules for you: [app:jspdocportal-module, app:rosdok-module]
[java] 2016-04-03T20:02:21,278 INFO MCRStartupHandler: 2147483647: Starting MCRFileSystemPromoter
[java] 2016-04-03T20:02:21,278 INFO MCRStartupHandler: 1000: Starting JPA Bootstrapper
[java] Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named MyCoRe
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
[java] at org.mycore.backend.jpa.MCRJPABootstrapper.initializeJPA(MCRJPABootstrapper.java:61)
[java] at org.mycore.backend.jpa.MCRJPABootstrapper.initializeJPA(MCRJPABootstrapper.java:57)
[java] at org.mycore.backend.jpa.MCRJPABootstrapper.startUp(MCRJPABootstrapper.java:44)
[java] at org.mycore.common.events.MCRStartupHandler.startExecutable(MCRStartupHandler.java:91)
[java] at org.mycore.common.events.MCRStartupHandler.lambda$startUp$1(MCRStartupHandler.java:85)
[java] at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
[java] at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352)
[java] at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
[java] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
[java] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
[java] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
[java] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
[java] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[java] at java.util.stream.ReferencePipeline.forEachOrdered(ReferencePipeline.java:423)
[java] at org.mycore.common.events.MCRStartupHandler.startUp(MCRStartupHandler.java:85)
[java] at org.mycore.frontend.cli.MCRCommandLineInterface.main(MCRCommandLineInterface.java:88)
[java] Java Result: 1

This happens because the JPA configuration (persistence.xml) is not present in the configuration directory (how could it, if it is going be created by the command )

We need a mechanism, that somehow loads the mycore.properties (which contains settings for the config directory) without initializing the JPA.
To simplify the implementation, think of treating "create configuration directory" different from other MCRCommands. Maybe an argument to the main method and a call like "mycore.sh setup" or mycore.sh initialize could be used.

Environment

None

Assignee

Thomas Scheffler

Reporter

Robert Stephan

Labels

None

URL

None

External issue ID

None

Components

Fix versions

Affects versions

Priority

Highest
Configure