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 ON LINUX: did not recongnize any BaseX jars in classpath. This may indicate missing jars or duplicate version mismatch. #151

Open
sanshuiii opened this issue May 18, 2021 · 8 comments

Comments

@sanshuiii
Copy link

sanshuiii commented May 18, 2021

I follow the GCAM Build Instructions and successfully compile the GCAM v5.3 on Ubuntu 16.04. However, I failed to run it with error: did not recongnize any BaseX jars in classpath. This may indicate missing jars or duplicate version mismatch. I will show my installation process below. I wonder if you can help me to solve this problem. Thanks in advance.

To be convient, we provide a short and a complete version of our problem.

Short version

We compile the system on Ubuntu16.04, with environment variables:

export USRLIB=/usr/lib/x86_64-linux-gnu

export BOOST_LIB=$USRLIB
export BOOST_INCLUDE=/usr/include/boost

# For Hector, which uses different definitions
export BOOSTLIB=$BOOST_LIB
export BOOSTROOT=$BOOST_INCLUDE

export XERCES_LIB=$USRLIB
export XERCES_INCLUDE=/usr/include/xercesc

export JAVA_INCLUDE=/usr/lib/jvm/default-java/include
export JAVA_LIB=/usr/lib/jvm/default-java/jre/lib/amd64/server

We copy the libs folder from a GCAM v5.2 release version to our working directory, and set classpath and jars_lib as follows:

export CLASSPATH=/home/root/gcam-core/libs/jars/*:/home/root/gcam-core/output/modelInterface/Modelinterface.jar
export JARS_LIB=/home/root/gcam-core/libs/jars/*:/home/root/gcam-core/output/modelInterface/Modelinterface.jar

Finally we compile and run and get the error message:

did not recongnize any BaseX jars in classpath.  This may indicate missing jars or duplicate version mismatch.

Complete install process

  • to make the environment clear, we prepare a empty Ubuntu 16.04 docker image first
  • install the required packages and tools
apt install libboost-dev libboost-system-dev libboost-filesystem-dev libxerces-c-dev default-jre default-jdk
apt-get install gcc
apt-get install g++

apt-get install git
apt-get install wget
apt-get install zip
  • set the environment variables next
export USRLIB=/usr/lib/x86_64-linux-gnu

export BOOST_LIB=$USRLIB
export BOOST_INCLUDE=/usr/include/boost

# For Hector, which uses different definitions
export BOOSTLIB=$BOOST_LIB
export BOOSTROOT=$BOOST_INCLUDE

export XERCES_LIB=$USRLIB
export XERCES_INCLUDE=/usr/include/xercesc

export JAVA_INCLUDE=/usr/lib/jvm/default-java/include
export JAVA_LIB=/usr/lib/jvm/default-java/jre/lib/amd64/server

  • download source code to \home\root
cd home
mkdir root
cd root
git clone https://github.com/JGCRI/gcam-core.git
  • install hector and gcam-core
cd gcam-core
make install_hector
cd cvs/objects/build/linux
make gcam -j 8
cd ../../../../exe
  • run
./gcam.exe -C configuration_ref.xml

and it turned out that there are some problems.

root@17aa112d1235:/home/root/gcam-core/exe# ./gcam.exe -C configuration_usa.xml
This computer software was prepared by Battelle Memorial Institute,
hereinafter the Contractor, under Contract No. DE-AC05-76RL0 1830 with
the Department of Energy (DOE). NEITHER THE GOVERNMENT NOR THE
CONTRACTOR MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY
LIABILITY FOR THE USE OF THIS SOFTWARE. This notice including this
sentence must appear on any copies of this computer software.

User agrees that the Software will not be shipped, transferred or
exported into any country or used in any manner prohibited by the United
States Export Administration Act or any other applicable export laws,
restrictions or regulations (collectively the 'Export Laws'). Export of
the Software may require some form of license or other authority from
the U.S. Government, and failure to obtain such export control license
may result in criminal liability under U.S. laws. In addition, if the
Software is identified as export controlled items under the Export Laws,
User represents and warrants that User is not a citizen, or otherwise
located within, an embargoed nation (including without limitation Iran,
Syria, Sudan, Cuba, and North Korea) and that User is not otherwise
prohibited under the Export Laws from receiving the Software.

Copyright 2011 Battelle Memorial Institute.  All Rights Reserved.
Distributed as open-source under the terms of the Educational Community
License version 2.0 (ECL 2.0). http:https://www.opensource.org/licenses/ecl2.php

For further details, see: http:https://www.globalchange.umd.edu/models/gcam/

Running GCAM model code base version 5.3 revision gcam-v5.3

Configuration file:  configuration_usa.xml
Parsing input files...
WARNING: did not recongnize any BaseX jars in classpath.  This may indicate missing jars or duplicate version mismatch.
SEVERE ERROR:Failed to find Java class XMLDBDriver to write to the XML database.
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fbbd0a810e0, pid=86, tid=0x00007fbbd1af4740
#
# JRE version: OpenJDK Runtime Environment (8.0_292-b10) (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
# Java VM: OpenJDK 64-Bit Server VM (25.292-b10 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x72e0e0]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/root/gcam-core/exe/hs_err_pid86.log
#
# If you would like to submit a bug report, please visit:
#   http:https://bugreport.java.com/bugreport/crash.jsp
#
Aborted
  • warning message:
WARNING: did not recongnize any BaseX jars in classpath.  This may indicate missing jars or duplicate version mismatch.
SEVERE ERROR:Failed to find Java class XMLDBDriver to write to the XML database.
  • We notice the tip below, so we download he required jar packages and set ${CLASSPATH} and ${JARS_LIB}. However, the up-to-date model insterface jars supports GCAM v5.2 at most. So we download a release version of GCAM v5.2 and copy the libs folder to our folder.
    image
    image
cd gcam-core
mkdir libs
cd libs 
apt-get install wget
apt-get install zip
wget https://github.com/JGCRI/modelinterface/releases/download/v5.1/jars.zip
unzip jars.jar
export CLASSPATH=/home/root/gcam-core/libs/jars/*:/home/root/gcam-core/output/modelinterface/ModelInterface.jar
export JARS_LIB=/home/root/gcam-core/libs/jars/*:/home/root/gcam-core/output/modelinterface/ModelInterface.jar

Note that <GCAMWorkspace>/output/modelinterface/ModelInterface.jar in section 5.2 does not exist, the true path should be<GCAMWorkspace>/output/modelinterface/ModelInterface.jar with the first interface starting by a lowercase i.

  • This did not help to solve the problem and we got the same error message.
@sanshuiii
Copy link
Author

update: after fixing the <GCAMWorkspace>/output/modelinterface/ModelInterface.jar problem, it seems work.

@rjplevin
Copy link
Collaborator

Where is BaseX-8.6.7.jar? Make sure it's in home/root/gcam-core/libs/jars.

Also add "." to the CLASSPATH so java can find XMLDBDriver.jar, which lives in the exe directory. This is where you need to be to run GCAM.

export CLASSPATH=.:/home/root/gcam-core/libs/jars/*:/home/root/gcam-core/output/modelInterface/Modelinterface.jar

@kvcalvin
Copy link
Contributor

@sanshuiii: Did @rjplevin's suggestion fix the issue?

@cgnolte
Copy link

cgnolte commented Jul 15, 2021

I am having a similar problem with GCAMv5.4. At runtime, I get SEVERE ERROR:Failed to find Java class XMLDBDriver to write to the XML database.
An error file hs_err_pid###.log is generated. Inside that file, it says:

java_class_path (initial): XMLDBDriver.jar:/work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/BaseX-9.5.2.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/commons-discovery-0.5.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/commons-logging-1.2.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/jcommon-1.0.0-rc1.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/jfreechart-1.0.0-pre2.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/joost-0.9.1.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/jopt-simple-4.9.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/poi-3.0-alpha1.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/poi-contrib-3.0-alpha1.jar /work/MAQSEA/cnolte/gcam/v5.4/gcam-core/libs/jars/poi-scratchpad-3.0-alpha1.jar:../output/modelinterface/ModelInterface.jar

(Sorry for the long path names.)
As @rjplevin suggested, I tried specifying a CLASSPATH environment variable at runtime prior to execution, prepending it with .. I also tried hard-coding the full path to XMLDBDriver.jar and the libs/jars/*. No luck. The java_class_path in the generated error file is unchanged.
jar tvf XMLDBDriver.jar shows the file contents, so I do not think the jar file is corrupted.

To verify that the problem is not attributable to some system change on my end, I verified that I can still run gcamv5.2.

@sanshuiii
Copy link
Author

After fixing the CLASSPATH problem, the issue has been fixed. It works on GCAM v5.3, however I am not sure if it works on GCAM v5.4 as well.

@cgnolte
Copy link

cgnolte commented Jul 15, 2021

Did you set the CLASSPATH at compile time or run time?

@sanshuiii
Copy link
Author

Did you set the CLASSPATH at compile time or run time?

Compile time, before makefile.

@cgnolte
Copy link

cgnolte commented Jul 15, 2021

That did not help me. However, I see now that my error is different, an inability to find XMLDBDriver.jar, where yours pertained to BaseX.

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

4 participants