File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Here's why bad command appears... (WIN98) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Here Watch "Here New topic
Author

Here's why bad command appears... (WIN98)

Noel Castillo
Greenhorn

Joined: Jan 03, 2001
Posts: 12
when you run J2EE.BAT in win98 even if you have set the correct pathnames (path=%PATH%;d:\j2sdkee1.3\bin) and variable names JAVA_HOME and J2EE_HOME.
J2EE.BAT calls SETENV.BAT w/c causes a syntax error at the set JAAS_OPTIONS=.. line because DOS does not accept 2 '=' signs for the SET command (try SET VAR=VAR1=VAR2 in DOS and you'll see what I mean). On the last statement, set JAVACMD=, nothing is assigned to JAVACMD, so after the call to SETENV.BAT - returning to J2EE.BAT, the %JAVACMD% command cannot be recognized because there's no value set for it. Now, we realize why Win95/98 is not a supported platform for J2EE.
So the best thing is to comment out all the lines with the double '=', eg. set %JAAS_OPTIONS%, and the set JAVACMD= line as well. But first, backup the files you are trying to change because you might make some mistakes and may need to go back to the original file to start all over again.
In the J2EE.BAT, comment out the %JAVACMD% line and substitute the commented out variables in SETENV.BAT, eg. %JAVACMD%, %SSL_OPTIONS%, etc. with the hardcoded values. This is how my %JAVACMD% %LISTEN_OPTIONS -Dorg.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter ... line finally looks like:
%JAVA_HOME%\bin\java -Xmx128m
-Djavax.net.ssl.trustStore=%J2EE_HOME%\lib\security\cacerts.jks
-Djava.security.auth.policy=%J2EE_HOME%\lib\security\jaas.policy
-Dcom.sun.CORBA.connection.ORBListenSocket=
SSL:0,SSL_MUTUALAUTH:0,PERSISTENT_SSL:1060
-Dorg.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter
-Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl
-Djms.home=%JMS_HOME%
-Dcom.sun.jms.service.jdbc.dbpath=%JMS_DB_PATH%
-Djms.properties=%J2EE_HOME%\config\jms_service.properties
-Djava.security.policy==%J2EE_HOME%\lib\security\server.policy
-Djava.security.auth.login.config=%J2EE_HOME%\lib\security\login.config
-Dcom.sun.enterprise.home=%J2EE_HOME%
-classpath "%CPATH%" com.sun.enterprise.server.J2EEServer %1 %2

Take note of the spacings because some of them could actually be line feeds. If this happens you will see a break in the command chain, and you will get bad command again. Also, hard tabs can wreak havoc to your syntax in .bat and .config files. I was using an editor that did not display the tab characters and I only discovered them when I opened the file in Notepad.
One last note, the variable %JAVACMD% might be referenced by other .BAT files in the \bin direcotry so you should check to make sure it is substituted properly.
Now, you are ready to face the next set of problems of running J2EE!
~Noel
[This message has been edited by Noel Castillo (edited June 05, 2001).]
Noel Castillo
Greenhorn

Joined: Jan 03, 2001
Posts: 12
In my AUTOEXEC.BAT:

SET CLASSPATH=D:\jdk1.3\jre\lib\rt.jar;D:\j2sdkee1.3\lib\j2ee.jar;
PATH=%PATH%;D:\jdk1.3\bin;D:\j2sdkee1.3\bin
SET J2EE_HOME=D:\j2sdkee1.3
SET JAVA_HOME=D:\jdk1.3

My SETENV.BAT (renamed to SETENV0.BAT):

@echo off
rem
rem Set JAVA_HOME and J2EE_HOME before running this script.
rem
rem first include user-specified definitions.
call %J2EE_HOME%\bin\userconfig.bat
if "%JMS_HOME%" == "" set JMS_HOME=%J2EE_HOME%
set LIBDIR=%J2EE_HOME%\lib
set LOCALEDIR=%J2EE_HOME%\lib\locale
set CLOUDSCAPE_INSTALL=%LIBDIR%\cloudscape
set CLASSESDIR=%LIBDIR%\classes
set JMS_CLASSESDIR=%JMS_HOME%\classes
set J2EEJARS=%LIBDIR%\j2ee.jar
set JAVART=%JAVA_HOME%\jre\lib\rt.jar
set JAVATOOLS=%JAVA_HOME%\lib\tools.jar
set SYSTEMJARS=%JAVART%;%JAVATOOLS%
set JAVAHELPJARS=%LIBDIR%\jhall.jar
rem JMS DB PATH must end in slash to specify a directory
set JMS_DB_PATH=%J2EE_HOME%\repository\%COMPUTERNAME%\db\
set SYSTEM_LIB_DIR=%LIBDIR%\system
set JMS_RI_JDBC=%SYSTEM_LIB_DIR%\cloudscape.jar;%SYSTEM_LIB_DIR%\tools.jar
set CLOUDJARS=%JMS_RI_JDBC%;%CLOUDSCAPE_INSTALL%\RmiJdbc.jar;%CLOUDSCAPE_INSTALL%\client.jar
set CPATH=%CLOUDJARS%;%CLASSESDIR%;%JMS_CLASSESDIR%;%J2EEJARS%;%LOCALEDIR%;%SYSTEMJARS%;.;%JAVAHELPJARS%

rem set JAAS_OPTIONS=-Djava.security.auth.policy=%J2EE_HOME%\lib\security\jaas.policy
rem set SSL_OPTIONS=-Djavax.net.ssl.trustStore=%J2EE_HOME%\lib\security\cacerts.jks
rem set SOCKET_FACTORY=-Dcom.sun.CORBA.connection.ORBSocketFactoryClass=com.sun.enterprise.iiop.IIOPSSLSocketFactory
rem set LISTEN_OPTIONS=-Dcom.sun.CORBA.connection.ORBListenSocket=SSL:0,SSL_MUTUALAUTH:0,PERSISTENT_SSL:1060
rem set JAVACMD=%JAVA_HOME%\bin\java -Xmx128m %SSL_OPTIONS% %JAAS_OPTIONS%

My J2EE.BAT (renamed to J2EE0.BAT):

@echo off
rem
rem Set JAVA_HOME and J2EE_HOME before running this script.
rem
rem set JAVA_HOME to the path where you have Java 2 (JDK1.2) installed.
rem
rem set J2EE_HOME to the path where you have installed this package (EJB server).
rem
if not "%J2EE_HOME%" == "" goto CONT0
echo ERROR: Set J2EE_HOME before running this script.
goto END
:CONT0
if EXIST "%J2EE_HOME%\bin\setenv0.bat" goto CONT1
echo ERROR: Set J2EE_HOME to the path of a valid j2sdkee.
goto END
:CONT1
call %J2EE_HOME%\bin\setenv0.bat
if not "%JAVA_HOME%" == "" goto CONT2
echo ERROR: Set JAVA_HOME before running this script.
goto END
:CONT2
if EXIST "%JAVA_HOME%\bin\java.exe" goto CONT3
echo ERROR: Set JAVA_HOME to the path of a valid jdk.
goto END
:CONT3

rem @echo on
rem %JAVACMD% %LISTEN_OPTIONS%
-Dorg.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter
-Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl
-Djms.home=%JMS_HOME%
-Dcom.sun.jms.service.jdbc.dbpath=%JMS_DB_PATH%
-Djms.properties=%J2EE_HOME%\config\jms_service.properties
-Djava.security.policy==%J2EE_HOME%\lib\security\server.policy
-Djava.security.auth.login.config=%J2EE_HOME%\lib\security\login.config
-Dcom.sun.enterprise.home=%J2EE_HOME%
-classpath "%CPATH%" com.sun.enterprise.server.J2EEServer %1 %2
@echo on
java -Xmx128m
-Dorg.xml.sax.parser=org.xml.sax.helpers.XMLReaderAdapter
-Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl
-Djms.home=%JMS_HOME%
-Dcom.sun.jms.service.jdbc.dbpath=%JMS_DB_PATH%
-Djms.properties=%J2EE_HOME%\config\jms_service.properties
-Djava.security.policy==%J2EE_HOME%\lib\security\server.policy
-Djava.security.auth.login.config=%J2EE_HOME%\lib\security\login.config
-Dcom.sun.enterprise.home=%J2EE_HOME%
-classpath "%CPATH%" com.sun.enterprise.server.J2EEServer %1 %2
:END

OUTPUT IN DOS WINDOW:

D:\j2sdkee1.3\bin>j2ee0 -verbose
D:\j2sdkee1.3\bin>java -Xmx128m -Dorg.xml.sax.parser=org.xml.sax.helpers.XMLRead
erAdapter -Dorg.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl -Djms.hom
e=D:\j2sdkee1.3 -Dcom.sun.jms.service.jdbc.dbpath=D:\j2sdkee1.3\repository\\db\
-Djms.properties=D:\j2sdkee1.3\config\jms_service.properties -Djava.security.pol
icy==D:\j2sdkee1.3\lib\security\server.policy -Djava.security.auth.login.config=
D:\j2sdkee1.3\lib\security\login.config -Dcom.sun.enterprise.home=D:\j2sdkee1.3
-classpath "D:\j2sdkee1.3\lib\system\cloudscape.jar;D:\j2sdkee1.3\lib\system\too
ls.jar;D:\j2sdkee1.3\lib\cloudscape\RmiJdbc.jar;D:\j2sdkee1.3\lib\cloudscape\cli
ent.jar;D:\j2sdkee1.3\lib\classes;D:\j2sdkee1.3\classes;D:\j2sdkee1.3\lib\j2ee.j
ar;D:\j2sdkee1.3\lib\locale;D:\jdk1.3\jre\lib\rt.jar;D:\jdk1.3\lib\tools.jar;.;D
:\j2sdkee1.3\lib\jhall.jar" com.sun.enterprise.server.J2EEServer -verbose
J2EE server listen port: 1050
Naming service started:1050
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
DB;create=true
Binding DataSource, name = jdbc/DB2, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
te=true
Binding DataSource, name = jdbc/DB1, url = jdbc:cloudscape:rmi:CloudscapeDB;crea
te=true
Binding DataSource, name = jdbc/EstoreDB, url = jdbc:cloudscape:rmi:CloudscapeDB
;create=true
Binding DataSource, name = jdbc/InventoryDB, url = jdbc:cloudscape:rmi:Cloudscap
eDB;create=true
Binding DataSource, name = jdbc/XACloudscape, url = jdbc/XACloudscape__xa
Binding DataSource, name = jdbc/XACloudscape__xa, dataSource = COM.cloudscape.co
re.RemoteXaDataSource@649dcd
Starting JMS service ... Initialization complete - waiting for client requests
Binding : < JMS Destination : jms/Topic , javax.jms.Topic >
Binding : < JMS Destination : jms/Queue , javax.jms.Queue >
Binding : < JMS Cnx Factory : QueueConnectionFactory , Queue , No properties >
Binding : < JMS Cnx Factory : TopicConnectionFactory , Topic , No properties >
Binding : < JMS Cnx Factory : jms/TopicConnectionFactory , Topic , No properties<br /> >
Binding : < JMS Cnx Factory : jms/QueueConnectionFactory , Queue , No properties<br /> >
Starting web service at port:8000
Starting secure web service at port:7000
Apache Tomcat/4.0-b1
Starting web service at port:9191
Apache Tomcat/4.0-b1
J2EE server startup complete.

NOTES:

  1. My RAM(64KB) or DOS cannot handle a very long command line so I had to take out the %LISTEN_OPTIONS% values. I don't know what the later effects of that would be.
  2. Pay attention to the variable assignments, I had problems with these while playing around with the SET= settings. Type SET in the DOS prompt to display the variables' values (but you already know that).
  3. Check the echoed JAVA command line to make sure all the expected values are displayed up to "-verbose". If the values are incomplete J2EE will not run.
  4. You may have realized by now the futility of starting J2EE in WIN98 so it might be wise to get ORION SERVER if you are like me who don't want to switch to WIN2000 yet.
  5. I have not deployed any application yet - I've tried the JAVA PET STORE on ORION but got stuck somewhere, posted for help on this site and got 0 reply. Oh now I remember why I switched to J2EE server. If you got something pls. reply to that post.

  6. ~Noel

    [This message has been edited by Noel Castillo (edited June 05, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Here's why bad command appears... (WIN98)