Problems using java service wrapper with jboss 7

2019-05-03 22:52发布

问题:

I'm trying to install Jboss 7.1.0-Final as a service using the Java service wrapper using this configuration (it is a draft conf so ignore the absolute paths):

# Java Application
#wrapper.java.command=java
wrapper.java.command=%JAVA_HOME%/bin/java.exe


# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.  Helper
#  classes are provided to do this for you.  See the Integration section
#  of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
wrapper.java.classpath.1=%OG_HOME%/bin/wrapper-3.2.3.jar 
wrapper.java.classpath.2=C:/jboss-as-7.1.0.Final/modules/org/jboss/as/server/main/jboss-as-server-7.1.0.Final.jar
wrapper.java.classpath.3=C:/jboss-as-7.1.0.Final/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.2.GA.jar
wrapper.java.classpath.4=C:/jboss-as-7.1.0.Final/modules/org/jboss/stdio/main/jboss-stdio-1.0.1.GA.jar
wrapper.java.classpath.5=C:/jboss-as-7.1.0.Final/modules/org/jboss/as/controller/main/jboss-as-controller-7.1.0.Final.jar
wrapper.java.classpath.6=C:/jboss-as-7.1.0.Final/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar
wrapper.java.classpath.7=C:/jboss-as-7.1.0.Final/modules/org/apache/log4j/main/log4j-1.2.16.jar
wrapper.java.classpath.8=C:/jboss-as-7.1.0.Final/jboss-modules.jar


#wrapper.java.classpath.2=%JAVA_HOME%/lib/tools.jar
#wrapper.java.classpath.3=%JBOSS_HOME%/bin/run.jar

# used to avoid problems with quotes inside the PATH environment variable
wrapper.java.library.path.append_system_path=TRUE

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=%OG_HOME%/bin

# these are the JAVA_OPTS
wrapper.java.additional.1=-Dprogram.name=standalone.bat
wrapper.java.additional.2=-server

# environment variables - define the ones that match your desired environment
wrapper.java.additional.3=-Xms500m
wrapper.java.additional.4=-Xmx1500m
wrapper.java.additional.5=-Dsun.rmi.dgc.client.gcInterval=3600000
wrapper.java.additional.6=-Dsun.rmi.dgc.server.gcInterval=3600000
wrapper.java.additional.7=-Dsession.serialization.jboss=true
#wrapper.java.additional.8=-Djava.endorsed.dirs="%JBOSS_HOME%"/lib/endorsed
wrapper.java.additional.8=-Djava.util.logging.manager=org.jboss.logmanager.LogManager


# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3

# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64

# Parameters to be passed to the application (Jboss) 
wrapper.app.parameter.1=org.jboss.as.server.Main

# Define server name (configuration)
wrapper.app.parameter.2=-c ace2

# Define listening IP - If you have more than one IP or want to indicate to listen on a specific IP
wrapper.app.parameter.3=-b 0.0.0.0

# Location of ACE2 log definitions file
wrapper.app.parameter.4=-Dlog4j.ace.path="%OG_HOME%/bin/log4j.xml"

# Location of OG log folder
wrapper.app.parameter.5=-Dog.server.log.dir="%OG_HOME%/log"

# Data source definitions are needed for the wait for DB Service

# Location of datasource definition file
wrapper.app.parameter.6=-Dwait.for.db.ds.path="%JBOSS_HOME%/server/ace2/deploy/ace2-ds.xml"

# Name of DS 
wrapper.app.parameter.7=-Dwait.for.db.ds.name="DefaultDS"


#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
wrapper.console.loglevel=INFO

# wrapper log location
wrapper.logfile=%OG_HOME%/log/ace2_wrapper.log

# Format of output for the log file.  (See docs for formats)
wrapper.logfile.format=LPTM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=10mb

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=10

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=NONE

#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=ACE2 on JBOSS Service Wrapper console

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.ntservice.name=JbossServiceForACE2

# Display name of the service
wrapper.ntservice.displayname=Oblicore - ACE2 on JBOSS Application Server

# Description of the service
wrapper.ntservice.description=JEE Application Server Running ACE2 Manager

# Mode in which the service is installed.  AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START

# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false

But I'm getting an error when the service starts:

wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    |
jvm 1    | org.jboss.modules.ModuleNotFoundException: Module org.jboss.vfs:main is not found in local module loader @105d88a (roots: )
jvm 1    |      at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:126)
jvm 1    |      at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:275)
jvm 1    |      at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:222)
jvm 1    |      at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:94)
jvm 1    |      at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:204)
jvm 1    |      at org.jboss.as.server.Main.main(Main.java:82)
jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jvm 1    |      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
jvm 1    |      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
jvm 1    |      at java.lang.reflect.Method.invoke(Method.java:597)
jvm 1    |      at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
jvm 1    |      at java.lang.Thread.run(Thread.java:619)
wrapper  | <-- Wrapper Stopped

I couldn't find anything on the web so any help would be highly appreciated...

回答1:

you basically want to use the following configuration:

set.JBOSS_HOME={your jboss home dir}
set.JAVA_HOME={path to the jvm}

wrapper.java.command=%JAVA_HOME%\bin\java

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

wrapper.java.classpath.1=%JBOSS_HOME%/jboss-modules.jar
wrapper.java.classpath.2=%JBOSS_HOME%/lib/wrapper.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=%JBOSS_HOME%/lib

# Java Bits.  On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE

# Java Additional Parameters
wrapper.java.additional.1=-XX:+TieredCompilation
wrapper.java.additional.2=-Dprogram.name=standalone.bat
wrapper.java.additional.3=-XX:MaxPermSize=256M
wrapper.java.additional.4=-Dsun.rmi.dgc.client.gcInterval=3600000
wrapper.java.additional.5=-Dsun.rmi.dgc.server.gcInterval=3600000
wrapper.java.additional.6=-Djava.net.preferIPv4Stack=true
wrapper.java.additional.7=-Djboss.server.default.config=standalone.xml
wrapper.java.additional.8=-Dorg.jboss.resolver.warning=true
wrapper.java.additional.9=-Djboss.modules.system.pkgs=org.jboss.byteman
wrapper.java.additional.10=-Dorg.jboss.boot.log.file=%JBOSS_HOME%\standalone\log\boot.log
wrapper.java.additional.11=-Dlogging.configuration=file:%JBOSS_HOME%/standalone/configuration/logging.properties
wrapper.java.additional.12=-Dorg.tanukisoftware.wrapper.WrapperManager.mbean=false

# Initial Java Heap Size (in MB)
wrapper.java.initmemory=64

# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=512

# Application parameters.  Add parameters as needed starting from 1
wrapper.app.parameter.1=org.jboss.modules.Main
wrapper.app.parameter.2=-mp
wrapper.app.parameter.3=%JBOSS_HOME%\modules
wrapper.app.parameter.4=-jaxpmodule 
wrapper.app.parameter.5=javax.xml.jaxp-provider
wrapper.app.parameter.6=org.jboss.as.standalone
wrapper.app.parameter.7=-Djboss.home.dir=%JBOSS_HOME%

and following your server specific settings.

I noticed that you had the following property set:

wrapper.app.parameter.6=-Dwait.for.db.ds.path="%JBOSS_HOME%/server/ace2/deploy/ace2-ds.xml"

JBoss 7 uses a new directory structure and configuration mechanism. So you probably also want to take a look into the migration steps of your previous JBoss configuration over to JBoss AS 7. https://docs.jboss.org/author/display/AS7/How+do+I+migrate+my+application+from+AS5+or+AS6+to+AS7

Hope this helps you out.

Cheers