I have got error when running tanukisoftware wrapper.
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 | WrapperSimpleApp: Unable to locate the class com.aplova.productimagesautouploader.ProductImagesAutoUploaderApplication.class: java.lang.ClassNotFoundException: com.aplova.productimagesautouploader.ProductImagesAutoUploaderApplication.class
jvm 1 |
jvm 1 | WrapperSimpleApp Usage:
jvm 1 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class} [app_arguments]
jvm 1 |
jvm 1 | Where:
jvm 1 | app_class: The fully qualified class name of the application to run.
jvm 1 | app_arguments: The arguments that would normally be passed to the
jvm 1 | application.
wrapper | <-- Wrapper Stopped
I'm new to creating wrappers and no idea about this error.
My wrapper.conf looks like this,
#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
wrapper.java.command=java
wrapper.working.dir=..
# 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
set.default.REPO_DIR=lib
set.APP_BASE=.
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=lib/wrapper.jar
wrapper.java.classpath.2=conf
wrapper.java.classpath.3=%REPO_DIR%/product-images-auto-uploader-0.0.1-SNAPSHOT.jar
wrapper.java.classpath.4=%REPO_DIR%/spring-boot-configuration-processor-2.3.2.RELEASE.jar
wrapper.java.classpath.5=%REPO_DIR%/thumbnailator-0.4.11.jar
And lib directory also have needed jar files. So, How to solve this error.
I found the solution. This error from pom.xml . In pom there was
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
and
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
...
both plugins. But only need plugin is appassembler-maven-plugin. So, after remove spring-boot-maven-plugin it's working.
As a conclusion, this error occur because of spring-boot-maven-plugin replace jar file which is generated by appassembler-maven-plugin.
Related
Trying out the Apache James mail server at the moment. After I downloaded the current binary distribution 3.4.0 ("for Spring wiring"), I got the following behaviour when I ran:
bin\james.bat
Log (formatted for readability):
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 | ERROR 21:30:39,649 |
org.apache.james.mailetcontainer.lib.AbstractStateMailetProcessor
Unable to init mailet WithPriority
jvm 1 | org.apache.mailet.MailetException:
Could not load mailet (WithPriority) (java.lang.IllegalArgumentException:
'priority' init parameter is compulsory)
(...)
What's up?
Nevermind, I found the answer - try this:
I will raise the issue up to the project meanwhile a quick fix to make that mailet
work:
in the James app folder, open the file conf/mailetcontainer.xml
find the mailet with class WithPriority
replace the xml tag <value>8</value> by <priority>8</priority>
try to run james server again
Looks like this in conf/mailetcontainer.xml:
(...)
<mailetcontainer enableJmx="true">
<processors>
<processor state="root" enableJmx="true">
<mailet match="All" class="PostmasterAlias"/>
<mailet match="RelayLimit=30" class="Null"/>
<mailet matcher="All" class="WithPriority">
<priority>8</priority>
</mailet>
(...)
In my clojure project I have a dependency on the javax.jms.MessageListener library. I have this class file in my project in the following directory
My-project
|java-
| |src -
| | |myJavaFile.java
| | |jars -
| | |library1.jar
| | |library2.jar
| | |libarary3.jar
| |javax -
| | |jms -
| | |MessageListener.class
|project.clj
|src -
| |my-program1.clj
| |my-program2.clj
| |my-program3.clj
Then in my project.clj file I have my java-source-paths set to
:java-source-paths ["java/src" "java/src/jars/" "java/javax/jms"]
but when I go to run my project via lein repl, I get compilation errors saying
java.lang.NoClassDefFoundError: javax/jms/MessageListener
Caused by: java.lang.ClassNotFoundException: javax.jms.MessageListener
From what I've read the messagelistener.class and my library jars should be included in my classpath when the project is running but that doesn't seem to be the case.
It is my understanding that the directory structure of java projects has to match the name of the namespaces. For instance package_name.classname has to be in the folder package_name on the classpath https://docs.oracle.com/javase/tutorial/java/package/managingfiles.html
But of course using either Leiningen or Boot you just need to add [javax.jms/jms-api "1.1-rev-1"] to the :dependencies.
I am using Tanuki Software to make a window service for java. Here is my config file.
#encoding=UTF-8
# Configuration files must begin with a line specifying the encoding
# of the the file.
#********************************************************************
# Wrapper License Properties (Ignored by Community Edition)
#********************************************************************
# Professional and Standard Editions of the Wrapper require a valid
# License Key to start. Licenses can be purchased or a trial license
# requested on the following pages:
# http://wrapper.tanukisoftware.com/purchase
# http://wrapper.tanukisoftware.com/trial
# Include file problems can be debugged by removing the first '#'
# from the following line:
##include.debug
# The Wrapper will look for either of the following optional files for a
# valid License Key. License Key properties can optionally be included
# directly in this configuration file.
#include ../conf/wrapper-license.conf
#include ../conf/wrapper-license-%WRAPPER_HOST_NAME%.conf
# The following property will output information about which License Key(s)
# are being found, and can aid in resolving any licensing problems.
#wrapper.license.debug=TRUE
#********************************************************************
# Wrapper Localization
#********************************************************************
# Specify the locale which the Wrapper should use. By default the system
# locale is used.
#wrapper.lang=en_US # en_US or ja_JP
# Specify the location of the Wrapper's language resources. If these are
# missing, the Wrapper will default to the en_US locale.
wrapper.lang.folder=../lang
#********************************************************************
# Wrapper Java Properties
#********************************************************************
# Java Application
# Locate the java binary on the system PATH:
wrapper.java.command=java
# Specify a specific java binary:
#set.JAVA_HOME=/java/path
#wrapper.java.command=%JAVA_HOME%/bin/java
# Tell the Wrapper to log the full generated Java command line.
#wrapper.java.command.loglevel=INFO
# 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=sendmaill.SendMail
wrapper.java.classpath.2=../lib/wrapper.jar
wrapper.java.classpath.3=sendmaill.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../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=
# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3
# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64
# Application parameters. Add parameters as needed starting from 1
#wrapper.app.parameter.1=
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Enables Debug output from the Wrapper.
# wrapper.debug=TRUE
# 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
# Log file to use for wrapper output logging.
wrapper.logfile=../logs/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=0
# 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=0
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper General Properties
#********************************************************************
# Allow for the use of non-contiguous numbered properties
wrapper.ignore_sequence_gaps=TRUE
# Do not start if the pid file already exists.
wrapper.pidfile.strict=TRUE
# Title to use when running as a console
wrapper.console.title=Test Wrapper Sample Application
#********************************************************************
# Wrapper JVM Checks
#********************************************************************
# Detect DeadLocked Threads in the JVM. (Requires Standard Edition)
wrapper.check.deadlock=TRUE
wrapper.check.deadlock.interval=10
wrapper.check.deadlock.action=RESTART
wrapper.check.deadlock.output=FULL
# Out Of Memory detection.
# (Ignore output from dumping the configuration to the console. This is only needed by the TestWrapper sample application.)
wrapper.filter.trigger.999=wrapper.filter.trigger.*java.lang.OutOfMemoryError
wrapper.filter.allow_wildcards.999=TRUE
wrapper.filter.action.999=NONE
# Ignore -verbose:class output to avoid false positives.
wrapper.filter.trigger.1000=[Loaded java.lang.OutOfMemoryError
wrapper.filter.action.1000=NONE
# (Simple match)
wrapper.filter.trigger.1001=java.lang.OutOfMemoryError
# (Only match text in stack traces if -XX:+PrintClassHistogram is being used.)
#wrapper.filter.trigger.1001=Exception in thread "*" java.lang.OutOfMemoryError
#wrapper.filter.allow_wildcards.1001=TRUE
wrapper.filter.action.1001=RESTART
wrapper.filter.message.1001=The JVM has run out of memory.
#********************************************************************
# Wrapper Email Notifications. (Requires Professional Edition)
#********************************************************************
# Common Event Email settings.
#wrapper.event.default.email.debug=TRUE
#wrapper.event.default.email.smtp.host=<SMTP_Host>
#wrapper.event.default.email.smtp.port=25
#wrapper.event.default.email.subject=[%WRAPPER_HOSTNAME%:%WRAPPER_NAME%:%WRAPPER_EVENT_NAME%] Event Notification
#wrapper.event.default.email.sender=<Sender email>
#wrapper.event.default.email.recipient=<Recipient email>
# Configure the log attached to event emails.
#wrapper.event.default.email.attach_log=TRUE
#wrapper.event.default.email.maillog.lines=50
#wrapper.event.default.email.maillog.format=LPTM
#wrapper.event.default.email.maillog.loglevel=INFO
# Enable specific event emails.
#wrapper.event.wrapper_start.email=TRUE
#wrapper.event.jvm_prelaunch.email=TRUE
#wrapper.event.jvm_start.email=TRUE
#wrapper.event.jvm_started.email=TRUE
#wrapper.event.jvm_deadlock.email=TRUE
#wrapper.event.jvm_stop.email=TRUE
#wrapper.event.jvm_stopped.email=TRUE
#wrapper.event.jvm_restart.email=TRUE
#wrapper.event.jvm_failed_invocation.email=TRUE
#wrapper.event.jvm_max_failed_invocations.email=TRUE
#wrapper.event.jvm_kill.email=TRUE
#wrapper.event.jvm_killed.email=TRUE
#wrapper.event.jvm_unexpected_exit.email=TRUE
#wrapper.event.wrapper_stop.email=TRUE
# Specify custom mail content
wrapper.event.jvm_restart.email.body=The JVM was restarted.\n\nPlease check on its status.\n
#********************************************************************
# 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.name=SendMail
# Display name of the service
wrapper.displayname=SendMail
# Description of the service
wrapper.description=Send Mail
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START, DELAY_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
SendMail is the name of my class while sendmaill is my jar file.
When i will run StartTestWrapper-NT.bat file its give an error. I can see my service in the window services but when i click it to start it through an error.
Here is the log file tanuki software.
NOTICE | wrapper | 2013/12/31 18:13:03 | --------------------------------------------------------------------
NOTICE | wrapper | 2013/12/31 18:13:03 |
STATUS | wrapper | 2013/12/31 18:13:03 |
STATUS | wrapper | 2013/12/31 18:13:03 | Launching a JVM...
INFO | jvm 1 | 2013/12/31 18:13:04 | WrapperManager: Initializing...
INFO | jvm 1 | 2013/12/31 18:13:04 |
INFO | jvm 1 | 2013/12/31 18:13:04 | WrapperSimpleApp Usage:
INFO | jvm 1 | 2013/12/31 18:13:04 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
INFO | jvm 1 | 2013/12/31 18:13:04 |
INFO | jvm 1 | 2013/12/31 18:13:04 | Where:
INFO | jvm 1 | 2013/12/31 18:13:04 | app_class: The fully qualified class name of the application to run.
INFO | jvm 1 | 2013/12/31 18:13:04 | app_arguments: The arguments that would normally be passed to the
INFO | jvm 1 | 2013/12/31 18:13:04 | application.
ERROR | wrapper | 2013/12/31 18:13:06 | JVM exited while loading the application.
INFO | wrapperm | 2013/12/31 18:13:08 | Waiting to start...
STATUS | wrapper | 2013/12/31 18:13:10 | Launching a JVM...
INFO | jvm 2 | 2013/12/31 18:13:10 | WrapperManager: Initializing...
INFO | jvm 2 | 2013/12/31 18:13:10 |
INFO | jvm 2 | 2013/12/31 18:13:10 | WrapperSimpleApp Usage:
INFO | jvm 2 | 2013/12/31 18:13:10 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
INFO | jvm 2 | 2013/12/31 18:13:10 |
INFO | jvm 2 | 2013/12/31 18:13:10 | Where:
INFO | jvm 2 | 2013/12/31 18:13:10 | app_class: The fully qualified class name of the application to run.
INFO | jvm 2 | 2013/12/31 18:13:10 | app_arguments: The arguments that would normally be passed to the
INFO | jvm 2 | 2013/12/31 18:13:10 | application.
INFO | wrapperm | 2013/12/31 18:13:13 | Waiting to start...
ERROR | wrapper | 2013/12/31 18:13:12 | JVM exited while loading the application.
STATUS | wrapper | 2013/12/31 18:13:17 | Launching a JVM...
INFO | wrapperm | 2013/12/31 18:13:18 | Waiting to start...
INFO | jvm 3 | 2013/12/31 18:13:17 | WrapperManager: Initializing...
INFO | jvm 3 | 2013/12/31 18:13:17 |
INFO | jvm 3 | 2013/12/31 18:13:17 | WrapperSimpleApp Usage:
INFO | jvm 3 | 2013/12/31 18:13:17 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
INFO | jvm 3 | 2013/12/31 18:13:17 |
INFO | jvm 3 | 2013/12/31 18:13:17 | Where:
INFO | jvm 3 | 2013/12/31 18:13:17 | app_class: The fully qualified class name of the application to run.
INFO | jvm 3 | 2013/12/31 18:13:17 | app_arguments: The arguments that would normally be passed to the
INFO | jvm 3 | 2013/12/31 18:13:17 | application.
ERROR | wrapper | 2013/12/31 18:13:19 | JVM exited while loading the application.
INFO | wrapperm | 2013/12/31 18:13:23 | Waiting to start...
STATUS | wrapper | 2013/12/31 18:13:23 | Launching a JVM...
INFO | jvm 4 | 2013/12/31 18:13:24 | WrapperManager: Initializing...
INFO | jvm 4 | 2013/12/31 18:13:24 |
INFO | jvm 4 | 2013/12/31 18:13:24 | WrapperSimpleApp Usage:
INFO | jvm 4 | 2013/12/31 18:13:24 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
INFO | jvm 4 | 2013/12/31 18:13:24 |
INFO | jvm 4 | 2013/12/31 18:13:24 | Where:
INFO | jvm 4 | 2013/12/31 18:13:24 | app_class: The fully qualified class name of the application to run.
INFO | jvm 4 | 2013/12/31 18:13:24 | app_arguments: The arguments that would normally be passed to the
INFO | jvm 4 | 2013/12/31 18:13:24 | application.
ERROR | wrapper | 2013/12/31 18:13:26 | JVM exited while loading the application.
INFO | wrapperm | 2013/12/31 18:13:28 | Waiting to start...
STATUS | wrapper | 2013/12/31 18:13:30 | Launching a JVM...
INFO | jvm 5 | 2013/12/31 18:13:30 | WrapperManager: Initializing...
INFO | jvm 5 | 2013/12/31 18:13:30 |
INFO | jvm 5 | 2013/12/31 18:13:30 | WrapperSimpleApp Usage:
INFO | jvm 5 | 2013/12/31 18:13:30 | java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
INFO | jvm 5 | 2013/12/31 18:13:30 |
INFO | jvm 5 | 2013/12/31 18:13:30 | Where:
INFO | jvm 5 | 2013/12/31 18:13:30 | app_class: The fully qualified class name of the application to run.
INFO | jvm 5 | 2013/12/31 18:13:30 | app_arguments: The arguments that would normally be passed to the
INFO | jvm 5 | 2013/12/31 18:13:30 | application.
ERROR | wrapper | 2013/12/31 18:13:32 | JVM exited while loading the application.
FATAL | wrapper | 2013/12/31 18:13:33 | There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up.
FATAL | wrapper | 2013/12/31 18:13:33 | There may be a configuration problem: please check the logs.
STATUS | wrapper | 2013/12/31 18:13:33 | <-- Wrapper Stopped
INFO | wrapperm | 2013/12/31 18:13:33 | Waiting to start...
ERROR | wrapperm | 2013/12/31 18:13:34 | The SendMail service was launched, but failed to start.
ERROR | wrapperm | 2013/12/31 18:13:34 | Please check the log file more information: F:\Java Work\wrapper-windows-x86-64-3.5.22-st\wrapper-windows-x86-64-3.5.22-st\logs\wrapper.log
Any Help is very appreciable.
Malik,
The problem is that the WrapperSimpleApp class expects a class name as an argument. You are not currently passing any arguments. Please try adding the following:
wrapper.app.parameter.1=SendMail
This assumes that the full class name of your main class is "SendMail" as you said.
Cheers,
Leif
I try to run derby database as windows service using java service wrapper (JSW). I downloaded community edition 3.5.15.
there is wrapper config I use:
wrapper.java.command=java
#wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp
wrapper.java.classpath.1=../lib/derby.jar
wrapper.java.classpath.2=../lib/derbynet.jar
wrapper.java.classpath.3=../lib/derbytools.jar
wrapper.java.classpath.4=Wrapper.jar
wrapper.java.library.path.1=
wrapper.java.additional.1=-Dderby.system.home=c:/data/derby
#wrapper.app.parameter.1=org.apache.derby.drda.NetworkServerControl
#wrapper.app.parameter.2=start
wrapper.app.parameter.1=org.apache.derby.drda.NetworkServerControl
wrapper.app.parameter.2=3
wrapper.app.parameter.3=start
wrapper.app.parameter.4=-h
wrapper.app.parameter.5=127.0.0.1
wrapper.app.parameter.6=org.apache.derby.drda.NetworkServerControl
wrapper.app.parameter.7=true
wrapper.app.parameter.8=1
wrapper.app.parameter.9=shutdown
wrapper.console.format=PM
wrapper.console.loglevel=INFO
wrapper.logfile=log/wrapper.log
wrapper.logfile.format=LPTM
wrapper.logfile.loglevel=INFO
wrapper.logfile.maxsize=5m
wrapper.logfile.maxfiles=10
wrapper.syslog.loglevel=ERROR
wrapper.console.title=Derby DB Server
wrapper.ntservice.name=derby
wrapper.ntservice.displayname=Apache Derby Database
wrapper.ntservice.description=Apache Derby Relational Database Engine (Network Server)
wrapper.ntservice.starttype=AUTO_START
wrapper.ntservice.interactive=false
#wrapper.ntservice.account=.\derby
#wrapper.ntservice.password=derbypw
and when I try to start derby server via wrapper I get security violation exception:
c:\derby\bin>wrapper -c derby.conf
wrapper | --> Wrapper Started as Console
wrapper | Java Service Wrapper Community Edition 32-bit 3.5.15
wrapper | Copyright (C) 1999-2012 Tanuki Software, Ltd. All Rights Reserved.
wrapper | http://wrapper.tanukisoftware.com
wrapper |
wrapper | Launching a JVM...
jvm 1 | WrapperManager: Initializing...
jvm 1 | Sun Jul 22 22:11:11 BST 2012 : Security manager installed using the Basic server security policy.
jvm 1 | Sun Jul 22 22:11:11 BST 2012 : Apache Derby Network Server - 10.9.1.0 - (1344872) started and ready to accept connections on port 1527
jvm 1 | WrapperManager Error: Error in WrapperListener.start callback. java.security.AccessControlException: access denied (org.tanukisoftware.wrapper.security.WrapperPerm
ission signalStarting)
jvm 1 | WrapperManager Error: java.security.AccessControlException: access denied (org.tanukisoftware.wrapper.security.WrapperPermission signalStarting)
jvm 1 | WrapperManager Error: at java.security.AccessControlContext.checkPermission(Unknown Source)
jvm 1 | WrapperManager Error: at java.security.AccessController.checkPermission(Unknown Source)
jvm 1 | WrapperManager Error: at java.lang.SecurityManager.checkPermission(Unknown Source)
jvm 1 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperManager.signalStarting(WrapperManager.java:3268)
jvm 1 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperStartStopApp.start(WrapperStartStopApp.java:437)
jvm 1 | WrapperManager Error: at org.tanukisoftware.wrapper.WrapperManager$11.run(WrapperManager.java:3963)
jvm 1 | WrapperManager Error: Unable to remove the Wrappers shudownhook: {0}
jvm 1 | Exception in thread "WrapperListener_start_runner" java.security.AccessControlException: access denied (org.tanukisoftware.wrapper.security.WrapperPermission signal
Stopped)
jvm 1 | at java.security.AccessControlContext.checkPermission(Unknown Source)
jvm 1 | at java.security.AccessController.checkPermission(Unknown Source)
jvm 1 | at java.lang.SecurityManager.checkPermission(Unknown Source)
jvm 1 | at org.tanukisoftware.wrapper.WrapperManager.signalStopped(WrapperManager.java:3320)
jvm 1 | at org.tanukisoftware.wrapper.WrapperManager.shutdownJVM(WrapperManager.java:4058)
jvm 1 | at org.tanukisoftware.wrapper.WrapperManager.privilegedStopInner(WrapperManager.java:4363)
jvm 1 | at org.tanukisoftware.wrapper.WrapperManager.access$2900(WrapperManager.java:124)
jvm 1 | at org.tanukisoftware.wrapper.WrapperManager$11.run(WrapperManager.java:3983)
wrapper | CTRL-C trapped. Shutting down.
wrapper | Shutdown failed: Timed out waiting for signal from JVM.
wrapper | JVM did not exit on request, terminated
wrapper | <-- Wrapper Stopped
I could add permission grant to java.policy to solve this problem (I have not tried, but suppose that will work).
The thing I want to know is: what enforces security constraints (and throws security exception) in this case? I thought that all locally started java application are granted all permissions.
One more thing that confuses me: I have h2 database server (1.3.162 (2011-11-26)) running via JSW (but earlier version) there are no security grants for it. I searched for *.policy files containing wrapper word, and there was nothing. How in this case security is configured, and if it is configured at all?
I would be grateful if someone make these security issues more clear :P.
Putting Leif's comment as answer:
When you run with the Wrapper, the Wrapper classes are launching your application's main method. This is inserting classes from the wrapper.jar into the call stack. Java's security model works by limiting access to the permissions granted to the weakest method in the call stack. In order to make this work, you will need to give classes in the wrapper.jar permission to do what you want.
This is described on our site here:
http://wrapper.tanukisoftware.com/doc/english/security-model.html
I have simply donwloaded JSW community edition, unwrapped into a directory:
c:\servicetest
So here i have a bin, conf, lib and log subdirs, among others.
From now on this will be (root).
I referenced the (root)/lib/wrapper.jar into my ide (netbeans) and create a very simple service (remember the class name is Main):
public class Main extends WrapperSimpleApp {
public Main(String[] args) {
super(args);
}
#Override
public void run() {
while(true) {
Logger.getLogger(Main.class.getName()).log(Level.INFO, "I'm alive");
try
{ Thread.sleep(2000); }
catch (InterruptedException ex)
{ return; }
}
}
}
As you see, it basically does nothing but logging a message. But actually it neither starts.
I compiled the project (MyProject.jar), copied the jar into the (root) directory and modified the (root)/config/wrapper.conf adding:
wrapper.java.classpath.3=../MyProject.jar
and
wrapper.java.mainclass=textappender.Main
Then i've installed the service in command line, with:
C:\servicetest\bin>wrapper -i ../conf/wrapper.conf
then i've started the service, either via services.msc control panel or via
C:\servicetest\bin>wrapper -t ../conf/wrapper.conf
In logs/wrapper.log i get:
ERROR | wrapper | 2012/05/21 21:35:11 | JVM exited while loading the application.
UPDATE 1
Following Tanuki Software advice, i've set in my (root)/config/wrapper.conf (well, uncommented since it already was):
wrapper.debug=TRUE
And now i get this:
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: WrapperManager.stop(1) called by thread: main
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: Backend not connected, not sending packet STOP : 1
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: Stopped checking for control events.
DEBUG | wrapper | 2012/05/22 10:46:37 | Pause reading child process output to share cycles.
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: Thread, main, handling the shutdown process.
INFO | jvm 1 | 2012/05/22 10:46:37 | WrapperManager Debug: shutdownJVM(1) Thread: main
INFO | jvm 1 | 2012/05/22 10:46:38 | WrapperManager Debug: wait for 0 shutdown locks to be released.
INFO | jvm 1 | 2012/05/22 10:46:38 | WrapperManager Debug: Backend not connected, not sending packet STOPPED : 1
INFO | jvm 1 | 2012/05/22 10:46:38 | WrapperManager Debug: calling System.exit(1)
DEBUG | wrapper | 2012/05/22 10:46:38 | JVM process exited with a code of 1, setting the wrapper exit code to 1.
But given my very simple implementation, i cannot guess what is going wrong.
rather than extending WrapperSimpleApp, your main class should implement the org.tanukisoftware.wrapper.WrapperListener interface.
You can find a very detailed description about implementing the interface on our website:
http://wrapper.tanukisoftware.com/doc/english/integrate-listener.html
Please let me know if you have any further questions about the implementation and/or the configuration properties in your conf file.
Another advise which comes in handy for me sometimes, is rather than running your application immediately as service, I find it easier to do the integration by running first as console application, because you can see the output directly on your console. Once everything seems working, I go ahead and install/run as service.
To run as console application, you would run for example:
C:\servicetest\bin>wrapper -c ../conf/wrapper.conf
You can also turn on debug output for the Wrapper by setting
wrapper.debug=true
in your conf file.
Edit due to the comment:
if your application is actually as simple as you describe, then just write your application as normal Java application without any Wrapper API parts.
You can use the WrapperSimpleApp to run your application out of the box with codeless integration into the Wrapper.
All you need to do is set the following properties in your conf file:
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.app.parameter.1=textappender.Main
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../MyProject.jar
With this configuration, the Wrapper will be able to run your application as windows service.
UPDATE2
I'm not sure what your code exactly looks like, but it seems you are calling WrapperManager.stop() in your main class...
Following the initial example class, I have modified the class, so it is not using any Wrapper-API (which for an simple application is not necessary):
public class Main {
public static void main(String[] args) {
while(true) {
Logger.getLogger(Main.class.getName()).log(Level.INFO, "I'm alive");
try
{ Thread.sleep(2000); }
catch (java.lang.InterruptedException ex)
{ return; }
}
}
}
After compile and creating the jar, the necessary properties in the conf file are:
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.app.parameter.1=textappender.Main
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../MyProject.jar
cheers,