[Solved] Linux: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory


  • Discourse touched me in a no-no place

    My google-fu isn't helping here, and I'm inexperienced in the intricacies of java.

    I'm trying to run SvnFeeder (link only for those interested - I don't think it's relevant to my ignorance) - a Java application (the fact that it's a required hack is a WTF that can wait for another day.)

    That apparently requires slf4j. Which I've tried to point it at but without luck.

    Platform is Linux - specifically Centos 5.11 if that matters. I've upgraded java from 1.6 to 1.7 (another requirement by SvnFeeder :rolleyes: ) and that part appears to have been successful.

    All the search results I've seen so far have indicated that the jar files for slf4j need to be in the CLASSPATH/-classpath/-cp. So I downloaded the file from here, and read the documentation here and I'm none the wiser.

    What am I doing wrong here?

    Context:

    [svnfeeder@NCL-DEVELOPER ~]$ ls -l
    total 136
    -rw-r--r-- 1 svnfeeder svnfeeder 32119 Mar  3 11:12 slf4j-api-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder 10705 Mar  3 11:12 slf4j-simple-1.7.10.jar
    -rw-rw-r-- 1 svnfeeder svnfeeder   269 Mar  3 10:46 svnfeeder_config.xml
    -rw-rw-r-- 1 svnfeeder svnfeeder 85640 Jan  5 13:38 SvnFeeder.jar
    

    Attempts:

    [svnfeeder@NCL-DEVELOPER ~]$ java -cp ".:./slf4j-api-1.7.10.jar:./slf4j-simple-1.7.10.jar" -jar SvnFeeder.jar -c svnfeeder_config.xml
    Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
            at com.matrixreq.svnfeeder.SvnFeeder.<clinit>(SvnFeeder.java:33)
    Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            ... 1 more
    
    [svnfeeder@NCL-DEVELOPER ~]$ export CLASSPATH=.
    [svnfeeder@NCL-DEVELOPER ~]$ java  -jar SvnFeeder.jar -c svnfeeder_config.xml
    Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
            at com.matrixreq.svnfeeder.SvnFeeder.<clinit>(SvnFeeder.java:33)
    Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            ... 1 more
    
    [svnfeeder@NCL-DEVELOPER ~]$ export CLASSPATH=.:./slf4j-api-1.7.10.jar:./slf4j-simple-1.7.10.jar
    [svnfeeder@NCL-DEVELOPER ~]$ java  -jar SvnFeeder.jar -c svnfeeder_config.xml
    Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
            at com.matrixreq.svnfeeder.SvnFeeder.<clinit>(SvnFeeder.java:33)
    Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            ... 1 more
    

    I've tried with the rest of the stuff that was in the downloaded zip file in the current directory but has similar results:

    [svnfeeder@NCL-DEVELOPER ~]$ ls /tmp/slf4j-1.7.10/*.10.jar -l
    -rw-r--r-- 1 svnfeeder svnfeeder 16617 Jan  6 20:15 /tmp/slf4j-1.7.10/jcl-over-slf4j-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  4725 Jan  6 20:15 /tmp/slf4j-1.7.10/jul-to-slf4j-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder 24409 Jan  6 20:15 /tmp/slf4j-1.7.10/log4j-over-slf4j-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  8404 Jan  6 20:15 /tmp/slf4j-1.7.10/osgi-over-slf4j-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  7492 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-android-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder 32119 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-api-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder 42519 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-ext-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  7068 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-jcl-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  7895 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-jdk14-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  8866 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-log4j12-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder 28727 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-migrator-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder  4087 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-nop-1.7.10.jar
    -rw-r--r-- 1 svnfeeder svnfeeder 10705 Jan  6 20:15 /tmp/slf4j-1.7.10/slf4j-simple-1.7.10.jar
    


  • Extract the slf4j jar somewhere and check that class is actually in it?

    jar xvf slf4j-api-1.7.10.jar


  • Discourse touched me in a no-no place

    [svnfeeder@NCL-DEVELOPER ~]$ mkdir /tmp/j
    [svnfeeder@NCL-DEVELOPER ~]$ cd /tmp/j
    [svnfeeder@NCL-DEVELOPER j]$ jar xvf ../slf4j-1.7.10/slf4j-api-1.7.10.jar
       created: META-INF/
      inflated: META-INF/MANIFEST.MF
       created: org/
       created: org/slf4j/
       created: org/slf4j/helpers/
       created: org/slf4j/spi/
      inflated: org/slf4j/helpers/BasicMarker.class
      inflated: org/slf4j/helpers/BasicMarkerFactory.class
      inflated: org/slf4j/helpers/BasicMDCAdapter.class
      inflated: org/slf4j/helpers/FormattingTuple.class
      inflated: org/slf4j/helpers/MarkerIgnoringBase.class
      inflated: org/slf4j/helpers/MessageFormatter.class
      inflated: org/slf4j/helpers/NamedLoggerBase.class
      inflated: org/slf4j/helpers/NOPLogger.class
      inflated: org/slf4j/helpers/NOPLoggerFactory.class
      inflated: org/slf4j/helpers/NOPMDCAdapter.class
      inflated: org/slf4j/helpers/SubstituteLogger.class
      inflated: org/slf4j/helpers/SubstituteLoggerFactory.class
      inflated: org/slf4j/helpers/Util$1.class
      inflated: org/slf4j/helpers/Util$ClassContextSecurityManager.class
      inflated: org/slf4j/helpers/Util.class
      inflated: org/slf4j/ILoggerFactory.class
      inflated: org/slf4j/IMarkerFactory.class
      inflated: org/slf4j/Logger.class
      inflated: org/slf4j/LoggerFactory.class
      inflated: org/slf4j/Marker.class
      inflated: org/slf4j/MarkerFactory.class
      inflated: org/slf4j/MDC$1.class
      inflated: org/slf4j/MDC$MDCCloseable.class
      inflated: org/slf4j/MDC.class
      inflated: org/slf4j/spi/LocationAwareLogger.class
      inflated: org/slf4j/spi/LoggerFactoryBinder.class
      inflated: org/slf4j/spi/MarkerFactoryBinder.class
      inflated: org/slf4j/spi/MDCAdapter.class
       created: META-INF/maven/
       created: META-INF/maven/org.slf4j/
       created: META-INF/maven/org.slf4j/slf4j-api/
      inflated: META-INF/maven/org.slf4j/slf4j-api/pom.xml
      inflated: META-INF/maven/org.slf4j/slf4j-api/pom.properties
    [svnfeeder@NCL-DEVELOPER j]$ grep LoggerFactory . -r
    Binary file ./org/slf4j/spi/LoggerFactoryBinder.class matches
    Binary file ./org/slf4j/helpers/SubstituteLoggerFactory.class matches
    Binary file ./org/slf4j/helpers/NOPLoggerFactory.class matches
    Binary file ./org/slf4j/helpers/NamedLoggerBase.class matches
    Binary file ./org/slf4j/ILoggerFactory.class matches
    Binary file ./org/slf4j/LoggerFactory.class matches
    [svnfeeder@NCL-DEVELOPER j]$
    

  • Discourse touched me in a no-no place

    [svnfeeder@NCL-DEVELOPER slf4j-api]$ cd /tmp//slf4j-1.7.10/slf4j-api
    [svnfeeder@NCL-DEVELOPER slf4j-api]$ grep LoggerFactory . -r
    ./src/test/java/org/slf4j/NoBindingTest.java:    Logger logger = LoggerFactory.getLogger(NoBindingTest.class);
    ./src/test/java/org/slf4j/helpers/SubstituteLoggerFactoryTest.java:public class SubstituteLoggerFactoryTest extends TestCase{
    ./src/test/java/org/slf4j/helpers/SubstituteLoggerFactoryTest.java:  private SubstituteLoggerFactory factory = new SubstituteLoggerFactory();
    ./src/main/java/org/slf4j/Logger.java: * import org.slf4j.LoggerFactory;
    ./src/main/java/org/slf4j/Logger.java: *   <span style="color:green">final static Logger logger = LoggerFactory.getLogger(Wombat.class);</span>
    ./src/main/java/org/slf4j/ILoggerFactory.java: * <code>ILoggerFactory</code> instances manufacture {@link Logger}
    ./src/main/java/org/slf4j/ILoggerFactory.java: * {@link LoggerFactory#getLogger(String)} method. An instance of of this
    ./src/main/java/org/slf4j/ILoggerFactory.java: * interface is bound internally with {@link LoggerFactory} class at 
    ./src/main/java/org/slf4j/ILoggerFactory.java:public interface ILoggerFactory {
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:import org.slf4j.ILoggerFactory;
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java: * An internal interface which helps the static {@link org.slf4j.LoggerFactory} 
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java: * class bind with the appropriate {@link ILoggerFactory} instance. 
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:public interface LoggerFactoryBinder {
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * Return the instance of {@link ILoggerFactory} that
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * {@link org.slf4j.LoggerFactory} class should bind to.
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * @return the instance of {@link ILoggerFactory} that
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * {@link org.slf4j.LoggerFactory} class should bind to.
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:  public ILoggerFactory getLoggerFactory();
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * The String form of the {@link ILoggerFactory} object that this
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * <code>LoggerFactoryBinder</code> instance is <em>intended</em> to return.
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * which may be different from the {@link ILoggerFactory} instance it is able to
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:   * @return the class name of the intended {@link ILoggerFactory} instance
    ./src/main/java/org/slf4j/spi/LoggerFactoryBinder.java:  public String getLoggerFactoryClassStr();
    ./src/main/java/org/slf4j/helpers/NOPLoggerFactory.java:import org.slf4j.ILoggerFactory;
    ./src/main/java/org/slf4j/helpers/NOPLoggerFactory.java: * NOPLoggerFactory is an trivial implementation of {@link
    ./src/main/java/org/slf4j/helpers/NOPLoggerFactory.java: * ILoggerFactory} which always returns the unique instance of
    ./src/main/java/org/slf4j/helpers/NOPLoggerFactory.java:public class NOPLoggerFactory implements ILoggerFactory {
    ./src/main/java/org/slf4j/helpers/NOPLoggerFactory.java:  public NOPLoggerFactory() {
    ./src/main/java/org/slf4j/helpers/SubstituteLoggerFactory.java:import org.slf4j.ILoggerFactory;
    ./src/main/java/org/slf4j/helpers/SubstituteLoggerFactory.java: * SubstituteLoggerFactory manages instances of {@link SubstituteLogger}.
    ./src/main/java/org/slf4j/helpers/SubstituteLoggerFactory.java:public class SubstituteLoggerFactory implements ILoggerFactory {
    ./src/main/java/org/slf4j/helpers/NamedLoggerBase.java:import org.slf4j.LoggerFactory;
    ./src/main/java/org/slf4j/helpers/NamedLoggerBase.java:   * by LoggerFactory. Note that this method is only called during
    ./src/main/java/org/slf4j/helpers/NamedLoggerBase.java:   * This approach will work well if the desired ILoggerFactory is the one
    ./src/main/java/org/slf4j/helpers/NamedLoggerBase.java:   * references by LoggerFactory. However, if the user manages its logger hierarchy
    ./src/main/java/org/slf4j/helpers/NamedLoggerBase.java:   * @return logger with same name as returned by LoggerFactory
    ./src/main/java/org/slf4j/helpers/NamedLoggerBase.java:    return LoggerFactory.getLogger(getName());
    ./src/main/java/org/slf4j/helpers/SubstituteLogger.java:     * Typically called after the {@link org.slf4j.LoggerFactory} initialization phase is completed.
    ./src/main/java/org/slf4j/LoggerFactory.java:import org.slf4j.helpers.NOPLoggerFactory;
    ./src/main/java/org/slf4j/LoggerFactory.java:import org.slf4j.helpers.SubstituteLoggerFactory;
    ./src/main/java/org/slf4j/LoggerFactory.java: * The <code>LoggerFactory</code> is a utility class producing Loggers for
    ./src/main/java/org/slf4j/LoggerFactory.java: * <code>LoggerFactory</code> is essentially a wrapper around an
    ./src/main/java/org/slf4j/LoggerFactory.java: * {@link ILoggerFactory} instance bound with <code>LoggerFactory</code> at
    ./src/main/java/org/slf4j/LoggerFactory.java: * Please note that all methods in <code>LoggerFactory</code> are static.
    ./src/main/java/org/slf4j/LoggerFactory.java:public final class LoggerFactory {
    ./src/main/java/org/slf4j/LoggerFactory.java:  static final String UNSUCCESSFUL_INIT_MSG = "org.slf4j.LoggerFactory could not be successfully initialized. See also "
    ./src/main/java/org/slf4j/LoggerFactory.java:  static SubstituteLoggerFactory TEMP_FACTORY = new SubstituteLoggerFactory();
    ./src/main/java/org/slf4j/LoggerFactory.java:  static NOPLoggerFactory NOP_FALLBACK_FACTORY = new NOPLoggerFactory();
    ./src/main/java/org/slf4j/LoggerFactory.java:   * It is LoggerFactory's responsibility to track version changes and manage
    ./src/main/java/org/slf4j/LoggerFactory.java:  private LoggerFactory() {
    ./src/main/java/org/slf4j/LoggerFactory.java:   * Force LoggerFactory to consider itself uninitialized.
    ./src/main/java/org/slf4j/LoggerFactory.java:    TEMP_FACTORY = new SubstituteLoggerFactory();
    ./src/main/java/org/slf4j/LoggerFactory.java:    Util.report("Failed to instantiate SLF4J LoggerFactory", t);
    ./src/main/java/org/slf4j/LoggerFactory.java:      ClassLoader loggerFactoryClassLoader = LoggerFactory.class.getClassLoader();
    ./src/main/java/org/slf4j/LoggerFactory.java:      Util.report("Actual binding is of type [" + StaticLoggerBinder.getSingleton().getLoggerFactoryClassStr() + "]");
    ./src/main/java/org/slf4j/LoggerFactory.java:   * bound {@link ILoggerFactory} instance.
    ./src/main/java/org/slf4j/LoggerFactory.java:    ILoggerFactory iLoggerFactory = getILoggerFactory();
    ./src/main/java/org/slf4j/LoggerFactory.java:    return iLoggerFactory.getLogger(name);
    ./src/main/java/org/slf4j/LoggerFactory.java:   * the statically bound {@link ILoggerFactory} instance.
    ./src/main/java/org/slf4j/LoggerFactory.java:   * Return the {@link ILoggerFactory} instance in use.
    ./src/main/java/org/slf4j/LoggerFactory.java:   * ILoggerFactory instance is bound with this class at compile time.
    ./src/main/java/org/slf4j/LoggerFactory.java:   * @return the ILoggerFactory instance in use
    ./src/main/java/org/slf4j/LoggerFactory.java:  public static ILoggerFactory getILoggerFactory() {
    ./src/main/java/org/slf4j/LoggerFactory.java:      return StaticLoggerBinder.getSingleton().getLoggerFactory();
    ./src/main/java/org/slf4j/impl/StaticLoggerBinder.java:import org.slf4j.ILoggerFactory;
    ./src/main/java/org/slf4j/impl/StaticLoggerBinder.java: * The binding of {@link LoggerFactory} class with an actual instance of
    ./src/main/java/org/slf4j/impl/StaticLoggerBinder.java: * {@link ILoggerFactory} is performed using information returned by this class.
    ./src/main/java/org/slf4j/impl/StaticLoggerBinder.java:  public ILoggerFactory getLoggerFactory() {
    ./src/main/java/org/slf4j/impl/StaticLoggerBinder.java:  public String getLoggerFactoryClassStr() {
    [svnfeeder@NCL-DEVELOPER slf4j-api]$
    


  • I typically just use grep:

    $ grep LoggerFactory *jar | grep -v sources
    Binary file log4j-over-slf4j-1.7.10.jar matches
    Binary file slf4j-android-1.7.10.jar matches
    Binary file slf4j-api-1.7.10.jar matches
    Binary file slf4j-ext-1.7.10.jar matches
    Binary file slf4j-jcl-1.7.10.jar matches
    Binary file slf4j-jdk14-1.7.10.jar matches
    Binary file slf4j-log4j12-1.7.10.jar matches
    Binary file slf4j-simple-1.7.10.jar matches
    


  • From:

    When you specify -jar then the -cp parameter will be ignored.

    From the documentation:

    When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.
    You also cannot "include" needed jar files into another jar file (you would need to extract their contents and put the .class files into your jar file)

    You have two options:

    include all jar files from the lib directory into the manifest (you can use relative paths there)
    Specify everything (including your jar) on the commandline using -cp:
    java -cp MyJar.jar:lib/* com.somepackage.subpackage.Main


  • Discourse touched me in a no-no place

    Don't know the Main name to call, but - getting there by hack I think...

    [svnfeeder@NCL-DEVELOPER ~]$ mkdir /tmp/s
    [svnfeeder@NCL-DEVELOPER tmp]$ cd /tmp/s
    [svnfeeder@NCL-DEVELOPER s]$ unzip ~/SvnFeeder.jar 
    [svnfeeder@NCL-DEVELOPER s]$ grep slf META-INF/MANIFEST.MF -B1 -A1
     8.4.jar lib/svnkit-javahl16-1.8.4.jar lib/trilead-ssh2-1.0.0-build217
     .jar lib/logback-classic-1.1.1.jar lib/logback-core-1.1.1.jar lib/slf
     4j-api-1.7.6.jar lib/gson-2.2.4.jar
    [svnfeeder@NCL-DEVELOPER s]$ cd ~
    [svnfeeder@NCL-DEVELOPER ~]$ mv slf4j-* lib
    [svnfeeder@NCL-DEVELOPER lib]$ mv slf4j-api-1.7.10.jar slf4j-api-1.7.6.jar
    [svnfeeder@NCL-DEVELOPER ~]$ java -jar  SvnFeeder.jar -c svnfeeder_config.xml
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
    [snip]
    

    I think I simply need to track down the relevant versions of stuff and stick them in ~/lib, but there must be a better way of doing this.


  • Discourse touched me in a no-no place

    @PJH said:

    Don't know the Main name to call,

    Ah

    [svnfeeder@NCL-DEVELOPER s]$ grep Main . -r
    ./META-INF/MANIFEST.MF:Main-Class: com.matrixreq.svnfeeder.SvnFeeder
    

    Getting somewhere:

    [svnfeeder@NCL-DEVELOPER ~]$ java -cp ".:./slf4j-api-1.7.10.jar:./slf4j-simple-1.7.10.jar:./SvnFeeder.jar" com.matrixreq.svnfeeder.SvnFeeder -c svnfeeder_config.xml
    [main] INFO SvnFeeder - Starting main
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
    

    Ok - I think I can probably get it sorted from here. Just need to find StringUtils... :rolleyes:



  • If I were you, I would create a lib folder and put all the JARs there, then, with Java7 you can:

    $ java -cp lib/* com.matrixreq.svnfeeder.SvnFeeder -c svnfeeder_config.xml
    


  • @PJH said:

    Just need to find StringUtils...

    That's some good documentation those guys have.


  • Discourse touched me in a no-no place

    SvnFeeder? Yup. It even references a download link on the same page that, erm, doesn't exist.


  • Discourse touched me in a no-no place

    @Eldelshell said:

    $ java -cp lib/* com.matrixreq.svnfeeder.SvnFeeder -c svnfeeder_config.xml

    [svnfeeder@NCL-DEVELOPER ~]$ ls . ./lib
    .:
    lib  svnfeeder_config.xml
    
    ./lib:
    slf4j-api-1.7.10.jar  slf4j-simple-1.7.10.jar  SvnFeeder.jar
    [svnfeeder@NCL-DEVELOPER ~]$ java -cp ./lib/* com.matrixreq.svnfeeder.SvnFeeder -c svnfeeder_config.xml
    Error: Could not find or load main class ..lib.slf4j-simple-1.7.10.jar
    [svnfeeder@NCL-DEVELOPER ~]$
    

    Ok - I'm back to ignorant again :/


    Edit: Sticking it in quotes seems to have put me back where I was

    [svnfeeder@NCL-DEVELOPER ~]$ java -cp "./lib/*" com.matrixreq.svnfeeder.SvnFeeder -c svnfeeder_config.xml
    [main] INFO SvnFeeder - Starting main
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
            at com.matrixreq.svnfeeder.util.FileUtil.getMyVersion(FileUtil.java:37)
            at com.matrixreq.svnfeeder.SvnFeeder.<init>(SvnFeeder.java:92)
    <snip>
    


  • Yeah, sorry about that... anyway, did they package that crap without the dependencies? That's so stupid!

    NoClassDefFoundError: org/apache/commons/lang3/StringUtils

    At least Java "stupid" package naming conventions are helpful in this cases.



  • I'd contact them and ask them if they have a list of dependencies. Otherwise:



  • Good luck with finding all dependencies and specific versions



  • Another thought...this looks like a Jira plugin or something. SvnFeeder is an extra. Did the main thing (SVN Gateway) come with a bunch of jars? Maybe add its lib dir to your classpath?



  • That's a good point, maybe it's not meant to be used as a standalone thing but added to your JIRA install.



  • They might assume that you already have $CLASSPATH pointed somewhere as part of installation.


  • Discourse touched me in a no-no place

    @boomzilla said:

    Another thought...this looks like a Jira plugin or something.

    It is.

    @boomzilla said:

    SvnFeeder is an extra. Did the main thing (SVN Gateway) come with a bunch of jars? Maybe add its lib dir to your classpath?

    Fuck knows. I was just given the .jar and told to get it working.

    The situation is we have an internally accessible only (via VPN) SVN server, and an externally hosted JIRA instance.

    This .jar file is (IMO) a hack that sits within the VPN on the SVN server with read-only access to the repository and pumps out logs to the external JIRA host.

    Or it would if I can get it working..


    Of course, if this SVN stuff could handle svn+ssh I think none of this shit would be necessary.


  • Discourse touched me in a no-no place

    @Eldelshell said:

    Good luck with finding all dependencies and specific versions

    It didn't seem to mind with the version difference with slf4j.



  • @PJH said:

    It didn't seem to mind with the version difference with slf4j.

    Not as far as the classloader cares, but that doesn't mean it wouldn't have crashed later if it was the wrong version.



  • @PJH said:

    This .jar file is (IMO) a hack that sits within the VPN on the SVN server with read-only access to the repository and pumps out logs to the external JIRA host.

    I would talk to the guy who installed the JIRA plugin since it sounds like they're on different machines.


  • Discourse touched me in a no-no place

    @boomzilla said:

    since it sounds like they're on different machines.

    They are. That's what this .jar file is trying to mitigate - JIRA an/or this SVN module running on the JIRA instance doesn't (and will not) have direct access into the SVN server. So this little hack sits on the SVN server and talks out to JIRA.

    I would talk to the guy who installed the JIRA plugin

    That went well.

    Anyway - I'm onto my next dependancy...


  • Discourse touched me in a no-no place

    Fixed. Or my bit of it is...

    Solution:

    mkdir ~/lib
    # put SvnFeeder.jar in /lib
    cd /tmp
    wget http://www.slf4j.org/dist/slf4j-1.7.10.tar.gz
    tar -xf slf4j-1.7.10.tar.gz
    cp slf4j-1.7.10/slf4j-{api,simple}-1.7.10.jar ~/lib
    wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org//commons/lang/binaries/commons-lang3-3.3.2-bin.tar.gz
    tar -xf commons-lang3-3.3.2-bin.tar.gz
    cp commons-lang3-3.3.2/*.jar ~/lib
    wget http://mirror.catn.com/pub/apache//httpcomponents/httpclient/binary/httpcomponents-client-4.4-bin.tar.gz
    tar -xf httpcomponents-client-4.4-bin.tar.gz
    cp httpcomponents-client-4.4/lib/*.jar ~/lib
    wget http://www.svnkit.com/org.tmatesoft.svn_1.8.8.standalone.zip
    unzip org.tmatesoft.svn_1.8.8.standalone.zip
    cp svnkit-1.8.8/lib/*.jar ~/lib
    

    Output:

    [svnfeeder@NCL-DEVELOPER ~]$ java -cp "./lib/*" com.matrixreq.svnfeeder.SvnFeeder -c svnfeeder_config.xml
    [main] INFO SvnFeeder - Starting main
    SvnFeeder v 1.0.${build.number}.${build.vcs.number}
    [main] INFO SvnFeeder - SvnFeeder v 1.0.${build.number}.${build.vcs.number}
    Exception com.matrixreq.svnfeeder.SvnPluginProClient$SvnPluginProClientException - REST: Exception com.matrixreq.svnplugin.rest.Rest$RestException in PUT REST - Not authorized
    [svnfeeder@NCL-DEVELOPER ~]$
    

    Cheers guys.


  • SockDev

    That's a helluvalotof effort.

    If only there was a way to distribute software in a way that automatically handled dependencies… maybe built around the concept of a package… but nah, that's just crazy talk.

    <!-- Emoji'd by MobileEmoji 0.2.0-->

  • BINNED

    To be fair, that might not work in this specific case anyway. We're talking CentOS 5, who knows what state the repos are in. Can you even get Java 1.7 from it? Let alone other dependencies?



  • To be fair it seems like it's supposed to be used in an environment where the dependencies are likely already present.

    Dependency hunting is a pain, especially when it's proprietary stuff so you can't just quickly Google the class name to see where it lives.

    Also, our servers don't have internet access so something that automatically goes and fetches dependencies wouldn't really help anyway.



  • The SvnFeeder thing is a proprietary thing. I'll bet it came with the plugin, and they expect you to run it on the machine with the plugin, where classpaths and dependencies are taken care of.

    @Onyx said:

    To be fair, that might not work in this specific case anyway. We're talking CentOS 5, who knows what state the repos are in.

    With java, you'd use maven to get all the things.



  • @loopback0 said:

    Also, our servers don't have internet access so something that automatically goes and fetches dependencies wouldn't really help anyway.

    Well, you do it on a machine that does have access and then deploy to the server.



  • The servers are Solaris SPARC, the machines with internet access are Windows desktops. I'm not aware of a solution that'd suit that.

    Either way, for the like twice a year we need to do it, manually downloading things is fine.



  • @loopback0 said:

    The servers are Solaris SPARC, the machines with internet access are Windows desktops. I'm not aware of a solution that'd suit that.

    If it's java, like what we've been talking about here...



  • Fair point.

    Like I said, it comes up so rarely that I've never really thought about it.


  • Discourse touched me in a no-no place

    @Onyx said:

    Can you even get Java 1.7 from it? Let alone other dependencies?

    No. Though this was less painful..

    [root@NCL-DEVELOPER ~]# java -version
    java version "1.6.0_34"
    OpenJDK Runtime Environment (IcedTea6 1.13.6) (rhel-1.13.6.1.el5_11-i386)
    OpenJDK Server VM (build 23.25-b01, mixed mode)
    [root@NCL-DEVELOPER ~]# cd /opt/
    [root@NCL-DEVELOPER opt]# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-i586.tar.gz"
    [root@NCL-DEVELOPER opt]# cd /opt/jdk1.7.0_75/
    [root@NCL-DEVELOPER jdk1.7.0_75]# alternatives --install /usr/bin/java java /opt/jdk1.7.0_75/bin/java 2
    [root@NCL-DEVELOPER jdk1.7.0_75]# alternatives --config java
    
    There are 3 programs which provide 'java'.
    
      Selection    Command
    -----------------------------------------------
       1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
    *+ 2           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
       3           /opt/jdk1.7.0_75/bin/java
    
    Enter to keep the current selection[+], or type selection number: 3
    [root@NCL-DEVELOPER jdk1.7.0_75]#
    [root@NCL-DEVELOPER jdk1.7.0_75]# java -version
    java version "1.7.0_75"
    Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
    Java HotSpot(TM) Server VM (build 24.75-b04, mixed mode)
    [root@NCL-DEVELOPER jdk1.7.0_75]# cat <<EOBASH >>~svnfeeder/.bashrc
    > export JAVA_HOME=/opt/jdk1.7.0_75
    > export JRE_HOME=/opt/jdk1.7.0_75/jre
    > export PATH=$PATH:/opt/jdk1.7.0_75/bin:/opt/jdk1.7.0_75/jre/bin
    > EOBASH
    [root@NCL-DEVELOPER ~]# 
    


  • [code]>java -version
    java version "1.4.2_11"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
    Java HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)
    [/code]

    :frowning:


  • SockDev

    1.4.2? Didn't people move on from that about the time the wheel was invented?

    <!-- Emoji'd by MobileEmoji 0.2.0-->

  • Discourse touched me in a no-no place

    @RaceProUK said:

    Didn't people move on from that about the time the wheel was invented?

    11 years ago.

    In other news, someone has found a zip file with all the dependencies in... just as well I hadn't got that fa...

    Oh.



  • @RaceProUK said:

    1.4.2? Didn't people move on from that about the time the wheel was invented?

    Correct. Those people aren't still stuck with Weblogic Server 8.1 though, which simply will not boot on anything newer than 1.4.2.

    Unsurprisingly, that application is up for replacement "soon".


  • SockDev

    @loopback0 said:

    Unsurprisingly, that application is up for replacement "soon".

    Discosoon?

    <!-- Emoji'd by MobileEmoji 0.2.0-->


  • Company soon™.


  • SockDev

    @loopback0 said:

    Company soon™.

    so...... never?


  • Discourse touched me in a no-no place

    So, in more surprising, less WTFy, news - this program is actually doing what it says on the tin without too much (other) tinkering.

    Being told to set it to transfer 2½ years of individual svn log -vr$REV (17K entries) on the other hand....



  • @loopback0 said:

    that application is up for replacement "soon".

    If for replacement you mean totally replace, then good. If you mean, migrate it to a newer AS/JVM, then you're pretty fucked up. I did something similar 5 years ago, from WS8.1 to Jboss 5 (or 6?) and from 1.4.2 to 1.6 and it was a painful experience which I still use as an example during job interviews of my skills and temperance in a project destined to fail.



  • Don't tell me that. I'm going to have to go through this hurt soonish as our office has decided that Oracle App Server isn't good enough for our app any more.

    You know, at some point I should write up some of the WTFs from this project.



  • Hahaha!!! I've been in too many migration projects of J2EE/JEE applications and they never work as expected and some very weird bugs happen, specially if they are using different JVM's (WL used JRockit which managed memory differently than HotSpot). Add to the mix a JVM version change and you're pretty much into 6 months of debugging and ripping your eyes off.

    Ohoh! And if the applications are using specific libraries from the AS (say for JMS) then you're more fucked up. Also add some class loading issues and well, the pain...



  • Yeah - replace the whole stack. Migrate nothing application-wise.



  • @Eldelshell said:

    from WS8.1 to Jboss 5 (or 6?) and from 1.4.2 to 1.6 and it was a painful experience

    I've migrated from JBoss 4 to 5 to 7 (really, EAP6) and Java 6 to 7. The JVM wasn't a big deal, but JBoss (and Seam and Richfaces) was terrible.



  • @Eldelshell said:

    Hahaha!!! I've been in too many migration projects of J2EE/JEE applications and they never work as expected and some very weird bugs happen, specially if they are using different JVM's (WL used JRockit which managed memory differently than HotSpot). Add to the mix a JVM version change and you're pretty much into 6 months of debugging and ripping your eyes off.

    Ohoh! And if the applications are using specific libraries from the AS (say for JMS) then you're more fucked up. Also add some class loading issues and well, the pain...

    Did I mention the other reason we want to switch to a different appserver is that we're having issues with the one we have now?

    Anyway, some of the WTFs we're running into while preparing to move between ASes are our own fault.

    I mentioned in another topic that we're dealing with Oracle Types on the DB side. Java/JDBC has a way of mapping those to Java objects that implement the SQLData interface, so we have a large mapping of DB types to Java types that we register in the same method we use to grab connections from the connection pool. It may not be perfect (read: breaks horribly if the order of fields changes on Oracle's side), but at the moment it works.

    Some of the types on the Oracle side are just arrays of another type. This is good because it means we don't have to manually serialize/unserialize oracle.sql.ARRAY.ARRAY types.

    Unfortunately, one of our devs didn't get the memo. Instead, they manually created an Oracle ARRAY object in code from an OracleConnection object (and oracle.sql.ArrayDescriptor).

    Fun fact: While some appservers (such as Oracle App Server) return the database's connection object directly, other appservers wrap it in their own connection type. Which means as soon as you try to cast the wrapped connection to an OracleConnection, you get a ClassCastException.

    This is one of those cases where doing it in the documented way would have bypassed this entire issue.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.