You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by GitBox <gi...@apache.org> on 2019/05/10 21:59:43 UTC

[GitHub] [cayenne] johnthuss commented on issue #383: Cgen - Avoid class loader issues causing missing classes

johnthuss commented on issue #383: Cgen - Avoid class loader issues causing missing classes
URL: https://github.com/apache/cayenne/pull/383#issuecomment-491442296
 
 
   I added some debugging output to my build of cayenne-di here:
   https://github.com/johnthuss/cayenne/tree/cayenne42testing2
   
   Then I incorporated this into a library and sample project here:
   https://github.com/johnthuss/joda-cayenne
   
   In that project when I run cgen I see this below. The class loader being
   using the AdhocObjectFactory doesn't include any of the classes from the
   "lib" folder, which is where joda-time is located. However, the default
   class loader DOES have these classes.
   
   )> ant -v generate_java
   
   *Apache Ant(TM) version 1.10.5* compiled on July 10 2018
   
   Trying the default build file: build.xml
   
   Buildfile: /Users/john/repos/joda-cayenne/build.xml
   
   Detected Java version: 11 in: /Library/Java/JavaVirtualMachines/
   *amazon-corretto-11.jdk*/Contents/Home
   
   Detected OS: *Mac OS X*
   
   parsing buildfile /Users/john/repos/joda-cayenne/build.xml with URI =
   file:/Users/john/repos/joda-cayenne/build.xml
   
   Project base dir set to: /Users/john/repos/joda-cayenne
   
   parsing buildfile
   jar:file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml
   with URI =
   jar:file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant.jar!/org/apache/tools/ant/antlib.xml
   from a zip file
   
   parsing buildfile
   jar:file:/Users/john/repos/joda-cayenne/lib/cayenne-ant-4.2.M1-SNAPSHOT.jar!/org/apache/cayenne/tools/antlib.xml
   with URI =
   jar:file:/Users/john/repos/joda-cayenne/lib/cayenne-ant-4.2.M1-SNAPSHOT.jar!/org/apache/cayenne/tools/antlib.xml
   from a zip file
   
   Build sequence for target(s) `generate_java' is [generate_java]
   
   Complete build sequence is [generate_java, compile, jar, ]
   
   
   generate_java:
   
        [cgen] *Registering JodaPropertyDescriptorCreator* -
   2019-05-10T16:55:32.215
   
        [cgen] Using cgen config from pom.xml
   
        [cgen] Generating superclass file:
   /Users/john/repos/joda-cayenne/test/com/icsusa/cayenne/auto/_JodaEntity.java
   
        [cgen] log4j:WARN No appenders could be found for logger
   (org.apache.velocity).
   
        [cgen] log4j:WARN Please initialize the log4j system properly.
   
        [cgen] log4j:WARN See
   http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
   
        [cgen] *Classloader for org.joda.time.LocalDateTime*:
   java.net.URLClassLoader@5a01ccaa[[file:/usr/local/share/ant,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-net.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-xz.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit4.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jai.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-resolver.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/bcel-6.3.1.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jdepend.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-regexp.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-log4j.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-javamail.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bcel.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-netrexx.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-swing.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jsch.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junitlauncher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-launcher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-antlr.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-testutil.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-oro.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jmf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ivy-2.4.0.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-xalan2.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bsf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-logging.jar]]
   
        [cgen] *WARN: Class not found by adhoc factory:
   org.joda.time.LocalDateTime*
   
        [cgen] *Default classloader*:
   AntClassLoader[/Users/john/repos/joda-cayenne/bin:/Users/john/repos/joda-cayenne/dist/joda-cayenne.jar:/Users/john/repos/joda-cayenne/lib/cayenne-ant-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-cgen-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-dbsync-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-di-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-project-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-server-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-velocity-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/commons-lang3-3.5.jar:/Users/john/repos/joda-cayenne/
   *lib/joda-time-2.1.jar*
   :/Users/john/repos/joda-cayenne/lib/log4j-1.2.16.jar:/Users/john/repos/joda-cayenne/lib/slf4j-api-1.7.25.jar:/Users/john/repos/joda-cayenne/lib/slf4j-log4j12-1.7.25.jar:/Users/john/repos/joda-cayenne/lib/velocity-engine-core-2.0.jar]
   
        [cgen] Classloader for java.lang.String:
   java.net.URLClassLoader@5a01ccaa[[file:/usr/local/share/ant,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-net.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-xz.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit4.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jai.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-resolver.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/bcel-6.3.1.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jdepend.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-regexp.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-log4j.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-javamail.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bcel.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-netrexx.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-swing.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jsch.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junitlauncher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-launcher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-antlr.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-testutil.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-oro.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jmf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ivy-2.4.0.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-xalan2.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bsf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-logging.jar]]
   
        [cgen] Classloader for org.joda.time.LocalDateTime:
   java.net.URLClassLoader@5a01ccaa[[file:/usr/local/share/ant,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-net.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-xz.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit4.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jai.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-resolver.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/bcel-6.3.1.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jdepend.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-regexp.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-log4j.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-javamail.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bcel.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-netrexx.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-swing.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jsch.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junitlauncher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-launcher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-antlr.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-testutil.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-oro.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jmf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ivy-2.4.0.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-xalan2.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bsf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-logging.jar]]
   
        [cgen] WARN: Class not found by adhoc factory:
   org.joda.time.LocalDateTime
   
        [cgen] Default classloader:
   AntClassLoader[/Users/john/repos/joda-cayenne/bin:/Users/john/repos/joda-cayenne/dist/joda-cayenne.jar:/Users/john/repos/joda-cayenne/lib/cayenne-ant-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-cgen-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-dbsync-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-di-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-project-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-server-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/cayenne-velocity-4.2.M1-SNAPSHOT.jar:/Users/john/repos/joda-cayenne/lib/commons-lang3-3.5.jar:/Users/john/repos/joda-cayenne/lib/joda-time-2.1.jar:/Users/john/repos/joda-cayenne/lib/log4j-1.2.16.jar:/Users/john/repos/joda-cayenne/lib/slf4j-api-1.7.25.jar:/Users/john/repos/joda-cayenne/lib/slf4j-log4j12-1.7.25.jar:/Users/john/repos/joda-cayenne/lib/velocity-engine-core-2.0.jar]
   
        [cgen] Classloader for java.lang.String:
   java.net.URLClassLoader@5a01ccaa[[file:/usr/local/share/ant,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-net.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-xz.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit4.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jai.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-resolver.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/bcel-6.3.1.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jdepend.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-regexp.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-log4j.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-javamail.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bcel.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-netrexx.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-swing.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jsch.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junitlauncher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-junit.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-launcher.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-antlr.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-testutil.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-oro.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-jmf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ivy-2.4.0.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-xalan2.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-apache-bsf.jar,
   file:/usr/local/Cellar/ant/1.10.5/libexec/lib/ant-commons-logging.jar]]
   
   
   BUILD SUCCESSFUL
   
   Total time: 0 seconds
   
   On Fri, May 10, 2019 at 6:46 AM Arseni Bulatski <no...@github.com>
   wrote:
   
   > Hi,
   > I tried to reproduce this issue.
   > I have small ant project, add cayenne-joda and joda-time jars to libs and
   > it seems to work fine.
   > AdhocObjectFactory picked up joda classes.
   > Can you give more information about your case?
   >
   > —
   > You are receiving this because you authored the thread.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/cayenne/pull/383#issuecomment-491260598>, or mute
   > the thread
   > <https://github.com/notifications/unsubscribe-auth/AAC22RXLJEN4ZPXPXYVUPELPUVOCVANCNFSM4HLCZENA>
   > .
   >
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services