NoClassDefFoundError: org / apache / derby / ferramentas / ij

1

O Derby diz para instalar a opção , então eu fiz:

thufir@dur:~$ 
thufir@dur:~$ ll /opt/db-derby-10.9.1.0-bin/lib/derbytools.jar 
-rw-r--r-- 1 root root 174932 May 31 12:19 /opt/db-derby-10.9.1.0-bin/lib/derbytools.jar
thufir@dur:~$ 
thufir@dur:~$ ll /opt/db-derby-10.9.1.0-bin/bin/ij
-rwxr-xr-x 1 root root 5876 May 31 12:18 /opt/db-derby-10.9.1.0-bin/bin/ij*
thufir@dur:~$ 

Agora, que valor eu defino para / etc / environment?

thufir@dur:~$ 
thufir@dur:~$ cat /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/usr/lib/jvm/java-6-openjdk-i386/jre/"

eu chamo a variável env DERBY_INSTALL? Que valor deveria ter?

Estou apenas tentando usar a ferramenta ij.

Aqui está o que eu tenho até agora:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# source /etc/environment 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# echo $DERBY_INSTALL
/opt/db-derby-10.9.1.0-bin/lib/
root@dur:/opt/db-derby-10.9.1.0-bin/bin# echo $DERBY_HOME
/opt/db-derby-10.9.1.0-bin/
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# . setEmbeddedCP
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# java org.apache.derby.tools.sysinfo
------------------ Java Information ------------------
Java Version:    1.6.0_24
Java Vendor:     Sun Microsystems Inc.
Java home:       /usr/lib/jvm/java-6-openjdk-i386/jre
Java classpath:  /opt/db-derby-10.9.1.0-bin//lib/derby.jar:/opt/db-derby-10.9.1.0-bin//lib/derbytools.jar:
OS name:         Linux
OS architecture: i386
OS version:      3.2.0-23-generic
Java user name:  root
Java user home:  /root
Java user dir:   /opt/db-derby-10.9.1.0-bin/bin
java.specification.name: Java Platform API Specification
java.specification.version: 1.6
java.runtime.version: 1.6.0_24-b24
--------- Derby Information --------
[/opt/db-derby-10.9.1.0-bin/lib/derby.jar] 10.9.1.0 - (1344872)
[/opt/db-derby-10.9.1.0-bin/lib/derbytools.jar] 10.9.1.0 - (1344872)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale :  [English/United States [en_US]]
Found support for locale: [cs]
     version: 10.9.1.0 - (1344872)
Found support for locale: [de_DE]
     version: 10.9.1.0 - (1344872)
Found support for locale: [es]
     version: 10.9.1.0 - (1344872)
Found support for locale: [fr]
     version: 10.9.1.0 - (1344872)
Found support for locale: [hu]
     version: 10.9.1.0 - (1344872)
Found support for locale: [it]
     version: 10.9.1.0 - (1344872)
Found support for locale: [ja_JP]
     version: 10.9.1.0 - (1344872)
Found support for locale: [ko_KR]
     version: 10.9.1.0 - (1344872)
Found support for locale: [pl]
     version: 10.9.1.0 - (1344872)
Found support for locale: [pt_BR]
     version: 10.9.1.0 - (1344872)
Found support for locale: [ru]
     version: 10.9.1.0 - (1344872)
Found support for locale: [zh_CN]
     version: 10.9.1.0 - (1344872)
Found support for locale: [zh_TW]
     version: 10.9.1.0 - (1344872)
------------------------------------------------------
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 

ok, bem, talvez funcione:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# echo $CLASSPATH
/opt/db-derby-10.9.1.0-bin//lib/derby.jar:/opt/db-derby-10.9.1.0-bin//lib/derbytools.jar:
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# java org.apache.derby.tools.ij
ij version 10.9
ij> quit
> ;
root@dur:/opt/db-derby-10.9.1.0-bin/bin# 

Embora funcione no mesmo console:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# 
root@dur:/opt/db-derby-10.9.1.0-bin/bin# cd /root/apache-james-3.0-beta4/var/store/derby/
root@dur:~/apache-james-3.0-beta4/var/store/derby# 
root@dur:~/apache-james-3.0-beta4/var/store/derby# java org.apache.derby.tools.ijij version 10.9
ij> quit
> ;
root@dur:~/apache-james-3.0-beta4/var/store/derby# 

Eu recebo erros em outro console:

root@dur:~/apache-james-3.0-beta4/var/store/derby# 
root@dur:~/apache-james-3.0-beta4/var/store/derby# java org.apache.derby.tools.ij
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/derby/tools/ij
Caused by: java.lang.ClassNotFoundException: org.apache.derby.tools.ij
    at java.net.URLClassLoader.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.apache.derby.tools.ij. Program will exit.
root@dur:~/apache-james-3.0-beta4/var/store/derby# 

Por que o outro console não funciona?

    
por Thufir 24.08.2012 / 00:59

1 resposta

1

A única explicação razoável é que você não inicializou o classpath no segundo console! Acho que isso é feito aqui:

root@dur:/opt/db-derby-10.9.1.0-bin/bin# . setEmbeddedCP


Manualmente:

CLASSPATH=/opt/db-derby-10.9.1.0-bin/lib/derby.jar:/opt/db-derby-10.9.1.0-bin/lib/derbytools.jar
java org.apache.derby.tools.ij
    
por Rudy Vissers 24.08.2012 / 09:21