I'm trying to get my program to be a service so I found procrun from http://commons.apache.org/proper/commons-daemon/procrun.html but I made a installService.bat and keep recieving the same error message when I try to run
./prunsrv.exe //TS//InkEstService
The error code is this
[2016-06-15 09:44:06] [warn] [ 7136] The system cannot find the Registry key for service 'InkEstService'
[2016-06-15 09:44:06] [error] [ 7136] Load configuration failed
[2016-06-15 09:44:06] [error] [ 7136] The system cannot find the file specified.
[2016-06-15 09:44:06] [error] [ 7136] Commons Daemon procrun failed with exit value: 2 (Failed to load configuration)
[2016-06-15 09:44:06] [error] [ 7136] The system cannot find the file specified.
my installService.bat is as follows
set SERVICE_NAME=InkEstService
set PR_INSTALL=C:\Users\TStraley\Desktop\commons-daemon\prunsrv.exe
REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=c:\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_LOGLEVEL=Error
REM Path to java installation
set PR_JVM=C:\Program Files\Java\jdk1.8.0_92\jre\bin\server\jvm.dll
set PR_CLASSPATH=C:\Users\TStraley\Desktop\Ink/Estimator\InkDataCollection.jar
REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=Platform.Platform
set PR_STARTMETHOD=start
REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=Platform.Platform
set PR_STOPMETHOD=stop
REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000
REM Install service
prunsrv.exe //IS//%SERVICE_NAME%
I've been following the tutorial provided on https://joerglenhard.wordpress.com/2012/05/29/build-windows-service-from-java-application-with-procrun/ ... any ideas would be greatly appreciated!
You need to rename the prunsrv.exe to the name same as your service i.e "InkDataCollection.exe"
I have tried this it works for me.
Related
I am having trouble getting environment variables to resolve On a Linux VM when I start up a WildFly java application.
<system-properties>
<property name="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
<property name="appname.url" value="https://${env.Environment}/appname"/>
</system-properties>
When I echo that environment variable (defined in /etc/environment) I get the following:
[ ~ ]$ echo $Environment
tst
I've tried updating the standalone.xml to have this these two properties set to true:
<subsystem xmlns="urn:jboss:domain:ee:4.0">
<spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
Also tried updating bin/jboss-cli.xml with this setting set to true:
<resolve-parameter-values>true</resolve-parameter-values>
Starting the application using it's service (i.e., systemctl restart appname) throws errors in the logs like this:
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([("system-property" => "appname.url")]) - failure description: "WFLYCTL0211: Cannot resolve expression 'https://${env.Environment}/appname'"
Unfortunately, this does not resolve my issue. Any ideas?
Solution for this involved a few steps to get environment variables recognized by the WildFly app's service. It isn't exactly an environment variable, it's the closest you can get. Per this thread on stackexchange, service strips all environment variables, so they cannot be referenced. Therefore, you must create a file that stores those variables and then source it in startup.
Here they are:
Update bin/standalone.conf with a new line to include JAVA_OPTS="$JAVA_OPTS -Denv.Environment=$Environment"
Create /etc/default/appname file so it can be sourced later on. That file only contains the line Environment=tst
Update /etc/init.d/appname file with
[ -f /etc/default/appname ] && . /etc/default/appname
export Environment
reload systemctl's daemon systemctl daemon-reload
restart the service systemctl restart appname
I am trying to run the typical Flume first example to get tweets and store them in HDFS using Apache FLume.
[Hadoop version 3.1.3; Apache Flume 1.9.0]
I have configured flume-env.sh:
`
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
export CLASSPATH=$CLASSPATH:/FLUME_HOME/lib/*
Configured the agent as shown in the TwitterStream.properties config file:
# Naming the components on the current agent.
TwitterAgent.sources = Twitter
TwitterAgent.channels = MemChannel
TwitterAgent.sinks = HDFS
# Describing/Configuring the source
TwitterAgent.sources.Twitter.type = org.apache.flume.source.twitter.TwitterSource
TwitterAgent.sources.Twitter.consumerKey = **********************
TwitterAgent.sources.Twitter.consumerSecret = **********************
TwitterAgent.sources.Twitter.accessToken = **********************
TwitterAgent.sources.Twitter.accessTokenSecret = **********************
TwitterAgent.sources.Twitter.keywords = tutorials point, java, bigdata, mapreduce, mahout, hbase, nosql
# Describing/Configuring the sink
TwitterAgent.sinks.HDFS.type = hdfs
TwitterAgent.sinks.HDFS.hdfs.path = hdfs://localhost:9000/user/twitter_data/
TwitterAgent.sinks.HDFS.hdfs.fileType = DataStream
TwitterAgent.sinks.HDFS.hdfs.writeFormat = Text
TwitterAgent.sinks.HDFS.hdfs.batchSize = 1000
TwitterAgent.sinks.HDFS.hdfs.rollSize = 0
TwitterAgent.sinks.HDFS.hdfs.rollCount = 10000
# Describing/Configuring the channel
TwitterAgent.channels.MemChannel.type = memory
TwitterAgent.channels.MemChannel.capacity = 10000
TwitterAgent.channels.MemChannel.transactionCapacity = 100
# Binding the source and sink to the channel
TwitterAgent.sources.Twitter.channels = MemChannel
TwitterAgent.sinks.HDFS.channel = MemChannel
And then running the command:
bin/flume-ng agent -c /home/jiglesia/hadoop/flume/conf/ -f TwitterStream.properties -n TwitterAgent -Dflume.root.logger=INFO, console -n TwitterAgent
Getting the following ERROR during the execution:
Info: Sourcing environment configuration script /home/jiglesia/hadoop/flume/conf/flume-env.sh
Info: Including Hadoop libraries found via (/home/jiglesia/hadoop/bin/hadoop) for HDFS access
/home/jiglesia/hadoop/libexec/hadoop-functions.sh: line 2360: HADOOP_ORG.APACHE.FLUME.TOOLS.GETJAVAPROPERTY_USER: bad substitution
/home/jiglesia/hadoop/libexec/hadoop-functions.sh: line 2455: HADOOP_ORG.APACHE.FLUME.TOOLS.GETJAVAPROPERTY_OPTS: bad substitution
Info: Including Hive libraries found via () for Hive access
I don't know why it says Bad Substitution.
I finally attach the entire log if it could say anything to you:
Info: Sourcing environment configuration script /home/jiglesia/hadoop/flume/conf/flume-env.sh
Info: Including Hadoop libraries found via (/home/jiglesia/hadoop/bin/hadoop) for HDFS access
/home/jiglesia/hadoop/libexec/hadoop-functions.sh: line 2360: HADOOP_ORG.APACHE.FLUME.TOOLS.GETJAVAPROPERTY_USER: bad substitution
/home/jiglesia/hadoop/libexec/hadoop-functions.sh: line 2455: HADOOP_ORG.APACHE.FLUME.TOOLS.GETJAVAPROPERTY_OPTS: bad substitution
Info: Including Hive libraries found via () for Hive access
+ exec /usr/lib/jvm/java-8-openjdk-amd64/jre//bin/java -Xmx20m -Dflume.root.logger=INFO, -cp '/home/jiglesia/hadoop/flume/conf:/home/jiglesia/hadoop/flume/lib/*:/home/jiglesia/hadoop/etc/hadoop:/home/jiglesia/hadoop/share/hadoop/common/lib/*:/home/jiglesia/hadoop/share/hadoop/common/*:/home/jiglesia/hadoop/share/hadoop/hdfs:/home/jiglesia/hadoop/share/hadoop/hdfs/lib/*:/home/jiglesia/hadoop/share/hadoop/hdfs/*:/home/jiglesia/hadoop/share/hadoop/mapreduce/lib/*:/home/jiglesia/hadoop/share/hadoop/mapreduce/*:/home/jiglesia/hadoop/share/hadoop/yarn:/home/jiglesia/hadoop/share/hadoop/yarn/lib/*:/home/jiglesia/hadoop/share/hadoop/yarn/*:/lib/*' -Djava.library.path=:/home/jiglesia/hadoop/lib/native org.apache.flume.node.Application -f TwitterStream.properties -n TwitterAgent console -n TwitterAgent
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/jiglesia/hadoop/flume/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/jiglesia/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (org.apache.flume.node.Application).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
The environment variables configured in the bashrc file:
# HADOOP VARIABLES START
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/
export HADOOP_HOME=/home/jiglesia/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib/native"
# HADOOP VARIABLES END
# FLUME VARIABLES START
FLUME_HOME=/home/jiglesia/hadoop/flume
PATH=$PATH:/FLUME_HOME/bin
CLASSPATH=$CLASSPATH:/FLUME_HOME/lib/*
# FLUME VARIABLES END
Thanks for your help !
You've referenced bash variables incorrectly.
Try this
FLUME_HOME=$HADOOP_HOME/flume
PATH=$PATH:$FLUME_HOME/bin
CLASSPATH=$CLASSPATH:$FLUME_HOME/lib/*.jar
Note: I'd suggest not putting flume as a subdirectory of Hadoop.
I recommend using Apache Ambari to install and configure Hadoop and Flume processes
I have a Gradle project that I'm trying to deploy locally with gradlew stopServers deploy startServers but it fails with this error:
:components/verification-ear:stopServers
Stopping server: localhost/server-three
Failed to get the list of the operation properties: "JBAS014883: No resource definition is registered for address [
("host" => "localhost"),
("server-config" => "server-three")
]"
:components/verification-ear:stopServers FAILED
FAILURE: Build failed with an exception.
I don't understand why this is throwing an error. I have servers 1 & 2 shut off while 3 is running full-ha. My JBOSS_HOME variable is correct and I'm running in domain mode from the JBoss Home bin.
I have jdk 1.7
path,classpath,catalina_home are set
this was the error
E:\apache-tomcat-7.0.56\bin>tomcat7.exe
The system cannot find the path specified.
Unable to create logger at ''
[2014-11-23 23:03:48] [error] [ 7388] Failed creating java C:\Program Files\Java
\jre7\bin\server\jvm.dll
[2014-11-23 23:03:48] [error] [ 7388] The system cannot find the path specified.
[2014-11-23 23:03:48] [error] [ 7388] ServiceStart returned 1
[2014-11-23 23:03:48] [error] [ 7388] The system cannot find the path specified.
[2014-11-23 23:03:48] [error] [ 7388] Commons Daemon procrun failed with exit va
lue: 3 (Failed to run service as console application)
[2014-11-23 23:03:48] [error] [ 7388] The system cannot find the path specified.
The system cannot find the path specified.
Failed to run service as console application
E:\apache-tomcat-7.0.56\bin>
I had the same problem. Here is what I was able to figure out:
This error happens because you don't have the privilege to modify the E:\apache-tomcat-7.0.56\logs directory. In my case, it was because I installed Tomcat by doing starting a CMD shell in "Run as administrator" mode (which forces you to log in as an administrator), and then doing "unzip apache-tomcat-7.0.57-windows-x64.zip". This seems to not set up the permissions necessary for the files to be accessed correctly by the service installer even when running in the "Run as administrator" privilege.
Now, if I go to my normal user account CMD shell and unzip the .zip file, and then go back to the administrator CMD shell and run service install , it works.
In fact, if I make a copy of the apache-tomcat-7.0.57 directory using COPY /S/D, and then try to install from that directory, it also works when you do a service install as an administrator.
Hope this helps.
I've read many topics such as Tomcat server is not starting as service: %1 is not a valid Win32 application or Tomcat 7 won't start
But it did not worked for me.
First of all I'm running Windows Server 64bits. I performed the following steps:
Downloaded Xampp (I believe it's 64bits..because I couldn't find a
64 bits in their website)
Download JDK 8.20 x64 bits
Since I was in doubt about the Tomcat in Xampp, I've download the Tomcat x64 and replace the whole content in the c:\xampp\tomcat\
After everything is installed I needed to update the Environment Variables, and so I did.
After completed this steps I installed successfully the Tomcat Service, although it gives error when starting. I found the logs of the errors I and get the following:
[info] [ 5096] Commons Daemon procrun (1.0.15.0 32-bit) started
[info] [ 5096] Running 'Tomcat7' Service...
[info] [ 4876] Starting service...
[error] [ 4876] %1 is not a valid Win32 application.
[error] [ 4876] Failed creating java C:\Program Files\Java\jdk1.8.0_20\bin\server\jvm.dll
[error] [ 4876] %1 is not a valid Win32 application.
[error] [ 4876] ServiceStart returned 1
[error] [ 4876] %1 is not a valid Win32 application.
[info] [ 5096] Run service finished.
[info] [ 5096] Commons Daemon procrun finished
So I check if the file jvm.dll existed in that folder (C:\Program Files\Java\jdk1.8.0_20\bin\server\jvm.dll), but I found that it does not. I searched a little more and I found that file is actually in the folder C:\Program Files\Java\jre1.8.0_20\bin\server\jvm.dll!
I then open Tomcat7 at C:\xampp\tomcat\bin and changed the path to the correct one.
But still, I keep getting the same error. What am I doing wrong?
Solved.
So, I had to do two steps.
Download jre-7u67-windows-x64.exe
Select, in the Tomcat7, in the tab "Java", the option "Use Default".
After that I was able to start the service properly. Plus, I've changed the port of tomcat in xampp, since by default is 8080, I changed to 9000 and I can now enter the project by localhost:9000/myproject