0

In my previous working project in eclipse (before starting to use Maven) I had:

src/META-INF/jdoconfig.xml

In Maven I have:

src/main/resources/META-INF/jdoconfig.xml

I cannot work out how to tell eclipse to use this jdoconfig.xml file and as such when I launch the run configuration, it runs fine, but when I try to do anything that accesses my local datastore:

war/WEB-INF/appengine-generated/local_db.bin

then I try to run it I get the following error, I have no idea what to do to fix it!:

Caused by: javax.jdo.JDOFatalUserException: A property named javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar file with a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the classpath, or a property named javax.jdo.option.PersistenceUnitName must be specified. NestedThrowables: javax.jdo.JDOUserException: You have either specified for this PMF to use a "persistence-unit" of "transactions-optional" (yet this doesnt exist!) or you called JDOHelper.getPersistenceManagerFactory with "transactions-optional" as the name of a properties file (and this doesnt exist in the CLASSPATH) at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:856)

The issue is that the Appengine Eclipse plugin does a bit of work in the background that we want to migrate to Maven, in preparation for migrating some other stuff (to Firebase, because the Channel API is reaching end-of-life).

Currently I'm trying to use the org.datanucleus maven-datanucleus-plugin, and it is failing with an error saying that the filename (in the command that starts datanucleus in the plugin):

On

mvn -X install
this is where it stops: ...
 [DEBUG] Executing command line:
 [DEBUG] cmd.exe /X /C "java -cp "C:\Users\john\.m2\repository\org\datanucleus\maven-datanucl‌​eus-plugin\3.2.0...

and then pages upon pages of all the .m2 contents plus all the .class files in the project, and so on.

Error while executing the DataNucleus tool 'org.datanucleus.enhancer.DataNucleusEnhancer'.: Error while executing process. Cannot run program "cmd.exe": CreateProcess error=206, The filename or extension is too long -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.datanucleus:maven-datanucleus-plugin:3.2.0-m1:enhance (default) on project DiaryBooker: Error while executing the DataNucleus tool 'org.datanucleus.enhancer.DataNucleusEnhancer'.

Not sure if this is expected behaviour of the datanucleus plugin (to use such a long classpath); I'm not even sure if I'm using the right plugin.

johnvdenley
  • 739
  • 1
  • 7
  • 16
  • If it needs to be located in the `META-INF` directory you should locate it in Maven project into `src/main/resources/META-INF/jdoconfig.xml`..otherwise it's located in the resulting jar file into root of the jar file... – khmarbaise Aug 05 '17 at 22:36
  • Apologies, that was a typo, that IS where it is, I will update accordingly... – johnvdenley Aug 05 '17 at 22:39
  • So decide where the problem is ... Eclipse or Maven ? Your title says the problem is with Maven,but the question then goes on about Eclipse ... – Neil Stockton Aug 06 '17 at 05:48
  • Well, I am trying to implement Maven inside eclipse, and because of the Maven file structure, my jdoconfig.xml file has had to move and now I cannot run my google appengine application inside eclipse. I need to know how to make eclipse work, so that I can tell maven what needs to happen. I can't even begin to fix maven if I cant work out how eclipse works now that I am using the Maven file structure rather than the regular app engine structure... So its Maven that is causing the problem in eclipse. So my question is aimed at anyone who has implemented Maven with google app engine! – johnvdenley Aug 06 '17 at 21:25
  • When you type in "mvn clean install" (or whatever to run your application) what happens? Because that is the limit of mavens involvement, and you can debug that using "--debug" on the command line. JDOHelper simply looks in the CLASSPATH, and Maven puts `src/main/resources` in the CLASSPATH – Neil Stockton Aug 07 '17 at 07:53
  • I provided a bit more detail on where we are currently in the question. Currently,
    mvn install
    fails at the datanucleus compile step (with
    clean
    and without). The error in Eclipse is just a symptom of what happens when Maven doesn't build everything (that the Appengine plugin normally builds), and we are currently stuck at the datanucleus-compile step with what seems to be a CLASSPATH (within Maven) issue.
    – johnvdenley Aug 07 '17 at 08:54
  • you mean windows has a (poor) limit on its command line length. Follow the documentation for that Maven plugin and set `fork` to false. – Neil Stockton Aug 07 '17 at 09:05
  • Yes, thank you very much, that solved that issue/step. We're hitting the next error, we'll try to fix it on our own first. How do we handle this on SO (splitting up the question, properly tagging, linking to another question where this particular issue has already been resolved, and so on)? So it was a "use datanucleus on Windows according to the docs" issue, but we are still working on the overall migration. FYI the next error is `java.lang.ClassNotFoundException: org.datanucleus.enhancer.DataNucleusEnhancer` – johnvdenley Aug 07 '17 at 09:43
  • You raise a new question; This one is really a DUP of a previously answered one. – Neil Stockton Aug 07 '17 at 10:01
  • yup, looks like it. how do we proceed? Do I just accept the DUP and start a new question? – johnvdenley Aug 07 '17 at 11:24

0 Answers0