Menu

Question about installing multiple services

Help
2009-05-17
2013-06-12
  • Nobody/Anonymous

    Hello,

    I was wondering if it is possible to use YAJSW to install multiple services side-by-side.

    I notice that in the example, you set the system property wrapper.config to the location of the conf file.. and it seems to me that every installed service would have to overwrite this property in order to install.

    Is this property only read once (when doing the install) and then the configuration is kept elsewhere, or am I missing something?

    Thanks.

    Bill

     
    • Nobody/Anonymous

      Nevermind, I now get how this all works... I didn't see the wrapper config in the service parameters.  Thanks.

       
    • Nobody/Anonymous

      Hi,

      yes, you can install as many services as you want.
      using the system property is just an example, how system properties can be used.
      you will need a configuration per services.
      so just create per service a configuration file and then install the service by calling for example

      java -jar wrapper.jar -i conf/confifile.conf

      if the services have a common configuration which differs just by for example the arguments, you may create a base configuration and for each service create a configuration which includes the base.

      if you want you may also monitor multiple applications within a single service.

      - Ron

       
  • bhtan1982

    bhtan1982 - 2013-02-18

    Hi Ron,

    I created duplicates of the YAJSW in order to configure multplies services. Any disadvantages with this method?

    Best Wishes,
    bhtan

     
  • AKG

    AKG - 2013-02-18

    Hi Ron,

    I tried with bhtan, and I am  unable to bring up the two services in parallel.
    Single service is working fine.

    Note :I created two services, using  c/yajsw/conf and c/yajswCA/conf

    Please help me, i want to run both the commerce and cms instance - via jboss

    Warm Regards
    KdM

     
  • rzo

    rzo - 2013-02-27

    hello,

    one typical issue is that in both config files the system tray port is the same.
    try removing this property.

    can you start both applications using runConsole ?

    • Ron
     
  • AKG

    AKG - 2013-02-27

    Thanks Ron, I changed it and it worked …

     
  • Martin

    Martin - 2013-04-03

    Unfortunately, I have a similar problem but the above mentioned fix to remove (# wrapper.tray.port = 15002) does not work for me. I opened a tracker request with details - hope that is the correct procedure.

    https://sourceforge.net/tracker/?func=detail&aid=3609902&group_id=224503&atid=1061882

     
  • rzo

    rzo - 2013-04-03

    hello,

    yajsw should be able to run multiple services on the same machine.
    before running as service pls check the following:
    1. can each application be started separately using runConsole ?
    2. if yes can you run both in parallel using runConsole ?

    if not pls post some more details:
    - configuration files
    - log output

    • Ron
     
  • Martin

    Martin - 2013-04-03

    Hi Ron,
    I think I have found the issue. Apparently when the 2nd service is installed it sets a global working directory (?) based on the wrapper.conf for the 2nd service - which allows the 2nd service to start correctly.

    However when the 1st service is started/stopped using the Windows Service Manager, I see in wrapper.log that  the wrapper-service is using the working folder for the 2nd service to try and start the first service causing a file not found exception. So this will cause the problem I am seeing.

    In other words when the 2nd service installs it is setting its working folder correctly but unfortunately overriding the working folder for that was correctly set by the 1st service based on its wrapper.conf file. Why this is happening I am not sure.

    -Martin

     
  • Martin

    Martin - 2013-04-03

    Here is a brief log sequence which I have edited for clarity. Line 2 is not correct.

    1. INFO|wrapper|Service alpha01|13-04-03 16:47:41|working dir C:\working\Aalpha01

    2. INFO|wrapper|Service beta01|13-04-03 17:42:04|working dir C:\working\Aalpha01
    3. INFO|wrapper|Service beta01|13-04-03 17:42:04|started process with pid 1936
    4. INFO|1936/3|Service beta01|13-04-03 17:42:07|java.io.FileNotFoundException: alpha01.jar (The system cannot find the file specified)

    -Martin

     
  • Martin

    Martin - 2013-04-03

    Sorry - just a few more details.
    1. I am using the latest 11.05, running on Windows-7 32 & 64 bit workstations.
    2. The 2 services have been assigned different working folders to keep them separated. These folders are specified in the appropriate wrapper.conf file.

    3. For each service I use the genConfig utility to generate the wrapper.conf and then update a couple of fields to reflect user friendly service names. Other than that nothing else is changed.

    -Martin

     
  • Martin

    Martin - 2013-04-04

    Additional details.
    - Tried to combine both service jars in the same working folder and updated each wrapper.conf accordingly. Both services installed (installService.bat) as before, but the same problem exists where the 1st service is "overwrittent" ? by the 2nd.

    The 2nd service was then removed using uninstallService.bat. I was alarmed to find that when I now start the 1st service using Windows Service Manager the 2nd service is actually being launched - even though the 2nd service has been removed from the Windows Management Console !

    By the way, even though I updated to version 11.05, I am still seeing messages referring to "yajsw-stable-11.04" - not sure if this is intended.

    C:\test\Yajsw\yajsw-stable-11.05\yajsw-stable-11.05\bat>call setenv.bat
    "java" -Xmx30m -Djna_tmpdir="C:\test\Yajsw\yajsw-stable-11.05\yajsw-stable-11.05\bat\/../tmp" -jar "C:\test\Yajsw\yaj
    sw-stable-11.05\yajsw-stable-11.05\bat\/../wrapper.jar" -i "C:\test\Yajsw\yajsw-stable-11.05\yajsw-stable-11.05\bat\/../conf/w
    rapper.conf"
    YAJSW: yajsw-stable-11.04
    OS   : Windows Server 2008/6.0/x86
    JVM  : Oracle Corporation/1.7.0_11
    Apr 04, 2013 11:07:02 AM org.apache.commons.vfs2.VfsLog info
    INFO: Using "C:\Users\demo\AppData\Local\Temp\2\vfs_cache" as temporary files store.
    ************* INSTALLING alpha01 ***********************

    I really like this product but either I am misconfiguring some feature or this is an issue that needs to be addressed (or maybe YAJSW only supports single services). If you need any further info, I would be happy to email privately.

    -Thanks.

    -Martin

     
  • rzo

    rzo - 2013-04-04

    hello,

    i assume that there is an issue with the way you proceed.
    did you create 2 conf files ?
    that is run genconfig and then rename the file ?
    note that per default genconfig generates a file named wrapper.conf.
    this file is required not only for installing the service but also for running it.
    so if you run genconfig then install the service, then run it again for another application you will overwrite the first one. resulting in issues when you start the first service
    the easiest way to proceed would be to create a copy of the bat file one copy for each application.
    then in setenv.bat set the name of the conf file. for example:

    set conf_file="%wrapper_home%/conf/wrapper1.conf"

    create an empty conf/wrapper1.conf

    and proceed by calling genconfig, install, … for each application in the according bat folder.

    • Ron
     
  • rzo

    rzo - 2013-04-04

    ps: before installing as service you should check that you can start both of your applications simultaneously using runconsole.bat

     
  • rzo

    rzo - 2013-04-04

    ps: sorry for the typo:

    the easiest way to proceed would be to create a copy of the bat file folder, one copy for each application.

     
  • Martin

    Martin - 2013-04-04

    Hi Ron,
    Thanks for the reply.

    Each of my 2 services work flawlessly when -INDIVIDUALLY- installed and launched from Windows Service Manager.

    So, why does the installation of the 2nd service always disable the 1st service which is already installed and running correctly?? The wrapper.log confirms a problem where it is trying to load the jar for the 1st service from the work folder of the 2nd - this can't be right.

    My assumption is that once I install a service into WSM that it no longer uses the initial wrapper.conf file. If that is not true then can you say what is the correct procedure for installing and supporting multiple YAJSW services.

    Also - I do NOT run genConfig each time. I ran genConfig only once for each service to generate each wrapper.conf file. For each file I modify the service names and working directories etc. and store in a separate folder.

    Thanks.

    -Martin

     
  • rzo

    rzo - 2013-04-04

    Martin,

    pls try it as i proposed. create 2 different bat folders: bat1 and bat2 etc.
    before installing as services make sure that the both run in parallel using runconsole.bat

    i am using yajsw on multiple machines with up to 5 services per machine.
    they all work as fine.

    • Ron
     
  • Martin

    Martin - 2013-04-05

    Hi Ron,
    I configured the 2 folders bat1 &  bat2. With this configuration how do you select which wrapper.conf file to install/ run ? Do I also need conf1 & conf2 ?

    Thanks.

    -Martin

     
  • rzo

    rzo - 2013-04-05

    hello,

    1. edit bat1/setenv.bat and change wrapper.conf to wrapper1.conf
    2. edit bat2/setenv.bat and change wrapper.conf to wrapper2.conf

    3. in the conf folder create empty files: wrapper1.conf and wrapper2.conf

    4. Either edit these files with a text editor or generate the content with bat1/genConfig for the first application and bat2/genConfig for the second app. Make sure that the tray icon port in both files is different, or remove the property to use multicast if this is enabled on your computer, or disable the tray icon if you do not want one.

    5. invoke bat1/runConsole and then bat2/runConsole
    make sure that both run as expected.

    6. if they both run as expected invoke bat1/installService bat1/startService bat2/installService bat2/startService

    • Ron
     
  • Martin

    Martin - 2013-04-08

    Ron,
    Excellent !  Your steps above has resolved my multi-services issue - also it makes managing the services much easier.

    Thanks.

    Martin

     
  • Martin

    Martin - 2013-04-08

    Oops - one of the services with (embedded Jetty web server) is throwing the following exception when I access remotely via browser (JSP page).

    "org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required."

    Not getting this when I run the service from the command line. I googled this error extensively but not able to figure why this is only happening with YAJSW service.

    I did a quick jarscan to see if any of the YAJSW supplied jars include javax.servlet which can sometimes conflict with Jetty but the jars seem to be clean. I also tried adding the JDK to the classpath wrapper.conf for that service  -

    wrapper.java.classpath.2=C:\Program Files\Java\jdk1.7.0_11
    wrapper.java.classpath.3=C:\Program Files\Java\jdk1.7.0_11\lib
    wrapper.java.classpath.4=C:\Program Files\Java\jdk1.7.0_11\jre\bin

    In addition, the Windows JAVA_PATH, JAVA_JRE & PATH are all set accordingly.

    No luck yet…

    -Martin

     
  • rzo

    rzo - 2013-04-10

    hello,

    jasper requires a JDK and will not run correctly using JRE.
    adding jdk to the classpath is not a good idea.

    did you set wrapper.java.command as full path to the java.exe ? (not just wrapper.java.command=java)

    note that if you did not set this property, or just set it to java, when you run java as service it will use per default

    C:\WINDOWS.0\system32\java.exe

    which is a jre.

    with a tool such as sysinternals processexplorer you could check which files an application is using. i use it to find this kind of issues.

    fyi see also:

    http://stackoverflow.com/questions/9113346/pwc6345-there-is-an-error-in-invoking-javac-error-when-using-jetty-wtp-plugi

    • Ron
     
  • Martin

    Martin - 2013-04-10

    Hi Ron,
    Yesterday I started tracing through the wrapper services using the latest Microsoft service monitor at (http://technet.microsoft.com/en-us/sysinternals/bb896645) and saw the issue with the JDK vs. JRE - but wasn't sure how to fix it.

    As per your recommendation - I removed the JDK from the classpath and then supplied the JDK as follows:

    wrapper.java.command = C:\\Program Files\\Java\\jdk1.7.0_17\\bin\\java

    This has solved the problem and everything works great. I greatly appreciate your input.

    -Martin

     

Log in to post a comment.