无法在Windows 7 Professional上安装JBoss作为服务

时间:2014-04-10 11:56:57

标签: java windows batch-file service jboss

我试图将JBoss启动脚本安装为服务。我创建了一个包含以下内容的文件:

 Rem Start Here

    set JAVA_HOME=c:\Program Files\Java\jdk1.7.0_51
    set JBOSS_HOME=C:\Interwoven\ApplicationContainer
    set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%JBOSS_HOME%\bin\run.jar
    set JBOSS_CLASSPATH=%CLASSPATH%
    set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=y
    set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -Xss512k -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+PrintGCDetails
    set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed
    set javadll=%JAVA_HOME%\jre\bin\server\jvm.dll
    set javatool=%JAVA_HOME%\lib\tools.jar
    set javarun=%JBOSS_HOME%\bin\run.jar
    set outlog=%JBOSS_HOME%\bin\stdout.log
    set errlog=%JBOSS_HOME%\bin\stderr.log

    JBossService.exe -install JBossDebug "%javadll%" -Djboss.java.opts="%JAVA_OPTS%" -Djava.class.path=%CLASSPATH% -Djava.endorsed.dirs="%JBOSS_ENDORSED_DIRS%" -server %JAVA_OPTS% -start org.jboss.Main -stop org.jboss.Main -method systemExit -out "%outlog%" -err "%errlog%" -current "%JBOSS_HOME%\bin" -manual

    Rem End Here

但是当我使用显示的内容运行我的.bat文件时,没有安装服务,我得到了以下响应:

C:\Interwoven\ApplicationContainer\bin>Rem Start Here

C:\Interwoven\ApplicationContainer\bin>set JAVA_HOME=c:\Program Files\Java\jdk1.
7.0_51

C:\Interwoven\ApplicationContainer\bin>set JBOSS_HOME=c:\Interwoven\ApplicationC
ontainer

C:\Interwoven\ApplicationContainer\bin>set CLASSPATH=c:\Program Files\Java\jdk1.
7.0_51\lib\tools.jar;c:\Interwoven\ApplicationContainer\bin\run.jar

C:\Interwoven\ApplicationContainer\bin>set JBOSS_CLASSPATH=c:\Program Files\Java
\jdk1.7.0_51\lib\tools.jar;c:\Interwoven\ApplicationContainer\bin\run.jar

C:\Interwoven\ApplicationContainer\bin>set JAVA_OPTS= -Xdebug -Xrunjdwp:transpor
t=dt_socket,address=9797,server=y,suspend=y

C:\Interwoven\ApplicationContainer\bin>set JAVA_OPTS= -Xdebug -Xrunjdwp:transpor
t=dt_socket,address=9797,server=y,suspend=y -Xms512m -Xmx512m -Xss512k -XX:PermS
ize=256m -XX:MaxPermSize=256m -XX:+PrintGCDetails

C:\Interwoven\ApplicationContainer\bin>set JBOSS_ENDORSED_DIRS=c:\Interwoven\App
licationContainer\lib\endorsed

C:\Interwoven\ApplicationContainer\bin>set javadll=c:\Program Files\Java\jdk1.7.
0_51\jre\bin\server\jvm.dll

C:\Interwoven\ApplicationContainer\bin>set javatool=c:\Program Files\Java\jdk1.7
.0_51\lib\tools.jar

C:\Interwoven\ApplicationContainer\bin>set javarun=c:\Interwoven\ApplicationCont
ainer\bin\run.jar

C:\Interwoven\ApplicationContainer\bin>set outlog=c:\Interwoven\ApplicationConta
iner\bin\stdout.log

C:\Interwoven\ApplicationContainer\bin>set errlog=c:\Interwoven\ApplicationConta
iner\bin\stderr.log

C:\Interwoven\ApplicationContainer\bin>JBossService.exe -install JBossDebug "c:\
Program Files\Java\jdk1.7.0_51\jre\bin\server\jvm.dll" -Djboss.java.opts=" -Xdeb
ug -Xrunjdwp:transport=dt_socket,address=9797,server=y,suspend=y -Xms512m -Xmx51
2m -Xss512k -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+PrintGCDetails" -Djava.c
lass.path=c:\Program Files\Java\jdk1.7.0_51\lib\tools.jar;c:\Interwoven\Applicat
ionContainer\bin\run.jar -Djava.endorsed.dirs="c:\Interwoven\ApplicationContaine
r\lib\endorsed" -server  -Xdebug -Xrunjdwp:transport=dt_socket,address=9797,serv
er=y,suspend=y -Xms512m -Xmx512m -Xss512k -XX:PermSize=256m -XX:MaxPermSize=256m
 -XX:+PrintGCDetails -start org.jboss.Main -stop org.jboss.Main -method systemEx
it -out "c:\Interwoven\ApplicationContainer\bin\stdout.log" -err "c:\Interwoven\
ApplicationContainer\bin\stderr.log" -current "c:\Interwoven\ApplicationContaine
r\bin" -manual
To install a service:
        -install service_name jvm_library (jvm_option)*
        -start start_class [-method start_method] [-params (start_parameter)+]
        [-stop start_class [-method stop_method] [-params (stop_parameter)+]]
        [-out out_log_file] [-err err_log_file] [-append]
        [-current current_dir]
        [-tmp tmp_dir]
        [-path extra_path]
        [-dependency other_service]
        [-displayname name_in_services_interface]
        [-startupmode (automatic|manual|disabled)]
        [-timeout (1-300)]
        [-description description_in_services_interface]

To uninstall a service:
        -uninstall service_name

service_name:   The name of the service.
jvm_library:    The location of the JVM DLL under which to run the service.
jvm_option:     An option to use when starting the JVM, such as:
                "-Djava.class.path=c:\classes" or "-Xmx128m".
start_class:    The class to load when starting the service.
start_method:   The method to call in the start_class. default: main
start_parameter:A parameter to pass in to the start_method.
stop_class:     The class to load when stopping the service.
stop_method:    The method to call in the stop_class. default: main
stop_parameter: A parameter to pass in to the stop_method.
out_log_file:   A file to redirect System.out into.
err_log_file:   A file to redirect System.err into.
append:         Don't truncate out_log_file and err_log_file.
current_dir:    The current working directory for the service.
                Relative paths will be relative to this directory.
tmp_dir:        The tmp directory for the service.
extra_path:     Path additions, for native DLLs etc.
dependency:     A Name of service to start before starting this service.
displayname:    A Name that will be displayed in Services interface.
startupmode:    Defaults to automatic.
timeout:        Number of seconds (betweeen 1 and 300) to wait for the stop com
and to complete.
description:    A String that will be displayed in Services interface.

1 个答案:

答案 0 :(得分:0)

在安装服务热线的末尾,您有:

JBossService.exe -install ... -manual

这应该是:

JBossService.exe -install ... -startupmode manual