Pour les utilisateurs de Linux, vous serez probablement confronté à cette erreur lorsque vous lancerez le serveur rmi.
Il y a une erreur dans le script startServer.sh, il lance le serveur rmi avant l'export du CLASSPATH.
Pour corriger le problème, il faut remettre le lancement du serveur rmi après l'export du CLASSPATH.
Avec un fichier ressemblant à ceci, cela fonctionne :
Code : Tout sélectionner
#!/bin/sh
cygwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
esac
JAVA=$JAVA_HOME/bin/java
RMIREGISTRY=$JAVA_HOME/bin/rmiregistry
CLASSPATH=
DEPLOY_DIR="../build"
LIB_DIR="../../lib"
# copy RMI required jars to a web server (http://localhost:8080/petstore/rmi)
if [ ! -d $TOMCAT_HOME/webapps/petstore/rmi ]
then
mkdir $TOMCAT_HOME/webapps/petstore/rmi
fi
cp $DEPLOY_DIR/server.jar $TOMCAT_HOME/webapps/petstore/rmi
cp $DEPLOY_DIR/common.jar $TOMCAT_HOME/webapps/petstore/rmi
XML_JAR=$LIB_DIR/dom4j.jar:$LIB_DIR/jaxen.jar
export CLASSPATH=$DEPLOY_DIR/server.jar:$DEPLOY_DIR/common.jar:$MYSQL_HOME/lib/mysql-connector-java-5.1.21-bin.jar:$XML_JAR
if $cygwin; then
# CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
export CLASSPATH="$DEPLOY_DIR/server.jar;$DEPLOY_DIR/common.jar;$MYSQL_HOME/lib/mysql-connector-java-5.1.21-bin.jar;:$XML_JAR"
fi
$RMIREGISTRY &
$JAVA -Djava.rmi.server.useLocalHostname=true -Djava.rmi.server.codebase="http://localhost:8080/petstore/rmi/server.jar http://localhost:8080/petstore/rmi/common.jar" -classpath "$CLASSPATH" com.yaps.petstore.server.RegisterServices
Nico.
****************************************************************************************************************************************************
ENGLISH:
For linux users, you will probably be facing this kind of error when trying to launch the rmi server.
There is a bug inside the startServer.sh script, it launches the rmi server prior to export CLASSPATH.
To fix the problem, you need to modify the script in order to launch rmi server after the export of the CLASSPATH.
With a startServer.sh that looks like this, it works fine :
Code : Tout sélectionner
#!/bin/sh
cygwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
esac
JAVA=$JAVA_HOME/bin/java
RMIREGISTRY=$JAVA_HOME/bin/rmiregistry
CLASSPATH=
DEPLOY_DIR="../build"
LIB_DIR="../../lib"
# copy RMI required jars to a web server (http://localhost:8080/petstore/rmi)
if [ ! -d $TOMCAT_HOME/webapps/petstore/rmi ]
then
mkdir $TOMCAT_HOME/webapps/petstore/rmi
fi
cp $DEPLOY_DIR/server.jar $TOMCAT_HOME/webapps/petstore/rmi
cp $DEPLOY_DIR/common.jar $TOMCAT_HOME/webapps/petstore/rmi
XML_JAR=$LIB_DIR/dom4j.jar:$LIB_DIR/jaxen.jar
export CLASSPATH=$DEPLOY_DIR/server.jar:$DEPLOY_DIR/common.jar:$MYSQL_HOME/lib/mysql-connector-java-5.1.21-bin.jar:$XML_JAR
if $cygwin; then
# CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
export CLASSPATH="$DEPLOY_DIR/server.jar;$DEPLOY_DIR/common.jar;$MYSQL_HOME/lib/mysql-connector-java-5.1.21-bin.jar;:$XML_JAR"
fi
$RMIREGISTRY &
$JAVA -Djava.rmi.server.useLocalHostname=true -Djava.rmi.server.codebase="http://localhost:8080/petstore/rmi/server.jar http://localhost:8080/petstore/rmi/common.jar" -classpath "$CLASSPATH" com.yaps.petstore.server.RegisterServices
Nico.