Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: error while loading CLASS, Missing dependency 'class javax.jdo.spi.PersistenceCapable$$ObjectIdFieldSupplier', required by model.jar(com/mycompany/model/error/Error.class) #3682

Closed
scabug opened this issue Jul 16, 2010 · 6 comments

Comments

@scabug
Copy link

scabug commented Jul 16, 2010

I get compile errors when compiling valid code against a Java model enhanced with JDO. I am confused at the errors because there is no direct usage of the package private static member interfaces in question from Scala. I understand Scala doesn't support using such interfaces from Scala code, but I am confused that the Scala compiler complains about them.

Here is the error I am getting:

[scalac] Compiling 3 scala and 196 java source files to C:\Users\AlainODea\Documents\Project\build\model\tests
   [scalac] error: error while loading Error, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/error/Error.class)
   [scalac] error: error while loading Binder, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/attachment/Binder.class)
   [scalac] error: error while loading Journal, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/note/Journal.class)
   [scalac] error: error while loading Exemption, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/exemption/Exemption.class)
   [scalac] error: error while loading Flag, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/flag/Flag.class)
   [scalac] error: error while loading ConfigurationGroup, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/configuration/ConfigurationGroup.class)
   [scalac] error: error while loading IssueConfiguration, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by C:\Users\AlainODea\Documents\Project\model\dist\model.jar(com/example/model/analysis/configuration/IssueConfiguration.class)
   [scalac] 7 errors found

Here is the Ant snippet I use to compile:

<target name="compile" depends="jar">
    <depend srcdir="src" destdir="${src.classes.dir}" cache="${build.dir}/src_dependencies" />
    <scalac srcdir="src" destdir="${src.classes.dir}" classpathref="src.build.classpath">
        <include name="**/*.scala"/>
        <include name="**/*.java"/>
    </scalac>
    <javac srcdir="src" destdir="${src.classes.dir}" source="1.6" target="1.6" nowarn="on"
           debug="on" encoding="UTF-8" classpathref="src.build.classpath" />
</target>

model.jar with the enhanced classes is on src.build.classpath.

I don't understand why scalac cares about dependencies of Java classes it can't resolve if they don't affect the knowledge to compile my Scala source.

Interestingly IntelliJ's Scala Plug-in is able to compile and run this code.

@scabug
Copy link
Author

scabug commented Jul 16, 2010

Imported From: https://issues.scala-lang.org/browse/SI-3682?orig=1
Reporter: Alain O'Dea (alainodea)

@scabug
Copy link
Author

scabug commented Jul 16, 2010

Alain O'Dea (alainodea) said:
An unfortunate, but passable workaround is to keep the unenhanced class files around to use during the build of dependent modules.

@scabug
Copy link
Author

scabug commented Jul 16, 2010

Alain O'Dea (alainodea) said:

An unfortunate, but passable workaround is to keep the unenhanced class files around to use during the build of dependent modules.

<property name="production.enhanced.dir" value="${production.classes.dir}/../enhanced" />
copy todir="${production.enhanced.dir}">
  <fileset dir="${production.classes.dir}" />
</copy>
<jdodoclet ...>
<jdoc ...>
<jar destfile="dist/verafin-model-runtime.jar">
    <fileset dir="${production.enhanced.dir}" />
    <fileset dir="src" excludes="**/*.java **/*.jj **/*.scala **/*.groovy" />
</jar>

@scabug
Copy link
Author

scabug commented Jul 19, 2010

Alain O'Dea (alainodea) said:
This seems to be a special case with the failing classes mentioned. I have not yet successfully produced a minimal test case, but I am working on it :)

@scabug
Copy link
Author

scabug commented Jul 19, 2010

Alain O'Dea (alainodea) said:
I tried to reproduce this at varying levels without success. I can only reproduce it with a large segment of our proprietary code and framework in place. It seems to be a very involved corner-case of binary dependency analysis of a complex JDO-based data model.

I am willing to do further testing to determine root cause, but I need advice on debugging the Scala compiler.

@scabug
Copy link
Author

scabug commented Jul 23, 2010

@harrah said:
It could be a duplicate of #1879 or you need to put the jar containing javax.jdo.spi.PersistenceCapable$$ObjectIdFieldSupplier on the classpath for compilation.

It is hard to tell without a reproducible example.

@scabug scabug closed this as completed May 18, 2011
@scabug scabug added the needinfo label Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant