简体   繁体   中英

Derby Error: Could not find or load main class org.apache.derby.drda.NetworkServerControl

I just installed the latest official release from Apache Derby on windows 10.12.1.1 (October 11, 2015 / SVN 1704137)

and try to install it in as Derby.network server and everything goes fine with localhost but when I execute this command (java org.apache.derby.drda.NetworkServerControl start -h myhost -p 1368) to make it accept IP other than localhost I get this error ( as you can see below every thing is fine until this command)

C:\>set DERBY_INSTALL=C:\Apache\db-derby-10.12.1.1-bin


C:\>set CLASSPATH=%DERBY_INSTALL%\lib\derbyclient.jar;%DERBY_INSTALL%\lib\derbytools.jar;.


C:\>cd %derby_install%\bin


C:\Apache\db-derby-10.12.1.1-bin\bin>setNetworkClientCP.bat


C:\Apache\db-derby-10.12.1.1-bin\bin>SET DERBY_HOME=C:\Apache\DB-DER~1.1-B


C:\Apache\db-derby-10.12.1.1-bin\bin>set CLASSPATH=C:\Apache\DB-DER~1.1-B\lib\derbyclient.jar;C:\Apache\DB-DER~1.1-B\lib\derbytools.jar;C:\Apache\DB-DER~1.1-B/lib/derbyoptionaltools.jar;C:\Apache\db-derby-10.12.1.1-bin\lib\derbyclient.jar;C:\Apache\db-derby-10.12.1.1-bin\lib\derbytools.jar;.


C:\Apache\db-derby-10.12.1.1-bin\bin>java org.apache.derby.tools.ij

ij version 10.12

ij> connect 'jdbc:derby://localhost:1527/MyDbTest';

ij> disconnect;

ij> exit;


C:\Apache\db-derby-10.12.1.1-bin\bin>java 
org.apache.derby.drda.NetworkServerControl start -p 1368

Error: Could not find or load main class 
org.apache.derby.drda.NetworkServerControl


C:\Apache\db-derby-10.12.1.1-bin\bin>cd..


C:\Apache\db-derby-10.12.1.1-bin>cd lib


C:\Apache\db-derby-10.12.1.1-bin\lib>java org.apache.derby.drda.NetworkServerControl start -p 1368

Error: Could not find or load main class org.apache.derby.drda.NetworkServerControl

and I double check and make sure that the jar file derb.net.jar is found in lib folder and also contain the class NetworkServerControl

I found the answer and I just want to post it in case someone face the same problem, so instead of using

 C:\Apache\db-derby-10.12.1.1-bin\lib>java org.apache.derby.drda.NetworkServerControl start -h hostname -p 1368

just use it this way and it's work for me

C:\Apache\db-derby-10.12.1.1-bin\lib>java -jar derbynet.jar start -p hostname -p 1368

This also worked for me:

navigate to bin folder as below and run this control command on whatever port you want to

D:\apache_derby\db-derby-10.15.2.0-bin\bin>**.\NetworkServerControl start -p 1398

and open another cmd and give

ij> connect 'jdbc:derby://localhost:1398/mydatabase;create=true';

this will create a new database with name mydatabase

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM