[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1370
  • Last Modified:

tanukisoftware - 1053: The service did not respond to the start or control request in a timely fashion.

Hi,

I am installing my simple Java application using tanukisoftware

It installs great my application as windows services and I can see my application in windows services

But When I start my windows service. I get the error

Could not start the test Timer service on Local Computer
1053: The service did not respond to the start or control request in a timely fashion.


And when I run it as a consle . I get the error below

Also, Please see my code in code snippet area and I am attaching my conf file with extension as .txt


ERROR:

wrapper  | --> Wrapper Started as Console
wrapper  | Java Service Wrapper Community Edition 3.3.3
wrapper  |   Copyright (C) 1999-2009 Tanuki Software, Ltd.  All Rights Reserved.

wrapper  |     http://wrapper.tanukisoftware.org
wrapper  |
wrapper  | Launching a JVM...
jvm 1    | I am running
jvm 1    | I am running
jvm 1    | I am running
wrapper  | Startup failed: Timed out waiting for a signal from the JVM.
wrapper  |
wrapper  | ---------------------------------------------------------------------
---
wrapper  | Advice:
wrapper  | The Wrapper consists of a native component as well as a set of classe
s
wrapper  | which run within the JVM that it launches.  The Java component of the

wrapper  | Wrapper must be initialized promptly after the JVM is launched or the

wrapper  | Wrapper will timeout, as just happened.  Most likely the main class
wrapper  | specified in the Wrapper configuration file is not correctly initiali
zing
wrapper  | the Wrapper classes:
wrapper  |     TimerTest
wrapper  | While it is possible to do so manually, the Wrapper ships with helper

wrapper  | classes to make this initialization processes automatic.
wrapper  | Please review the integration section of the Wrapper's documentation
wrapper  | for the various methods which can be employed to launch an applicatio
n
wrapper  | within the Wrapper:
wrapper  |     http://wrapper.tanukisoftware.org/doc/english/integrate.html
wrapper  | ---------------------------------------------------------------------
---


Please Guide

Many Thanks
import java.util.Timer;
import java.util.TimerTask;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Random;
//import System.Threading;
 
 
public class TimerTest {
 
	public static
	void main(String[] args)
	throws Exception
	{
 
 
		int initialDelay = 5000;
	    int interval = 1000;
 
		Timer timer = new Timer();
		timer.schedule(new TimerTask()
		{
		    public void run()
		    {
		        System.out.println("I am running");
		        try
		        {
		    	    TimerTest.createFile();
		    	    Thread.sleep(10000);
				}catch(Exception ex)
				{
				}
		    }
 
 
 
		}, initialDelay, interval);
 
	}
 
 
	public static void createFile()
	            throws Exception
	    {
			String strFilename = "C:\\java\\schedular\\hello.txt";
			Calendar cal = Calendar.getInstance();
		    SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy-Hmmss");
 
		    Random generator = new Random();
		    String DateIs = sdf.format(cal.getTime());
 
        String strUniqueReference = String.valueOf(generator.nextInt())+DateIs;
 
 
	        BufferedWriter bufferedWriter = null;
 
	        bufferedWriter = new BufferedWriter(new FileWriter(strFilename));
 
	        bufferedWriter.write(strUniqueReference);
 
	        if (bufferedWriter != null)
	        {
	            bufferedWriter.flush();
	            bufferedWriter.close();
	        }
    }
}

Open in new window

wrapperconf.txt
0
tia_kamakshi
Asked:
tia_kamakshi
  • 6
  • 5
1 Solution
 
CEHJCommented:
You are ignoring exceptions which won't help at all. printStackTrace throughout and don't throw Exception from main
0
 
CEHJCommented:
Also, you should use logging, particularly with an application like this which runs in the background
0
 
tia_kamakshiAuthor Commented:
Many Thanks for your reply.

I have removed throws exception from main

Still same Exception

Not sure, I have just seen, May be I have to do something like this

http://wrapper.tanukisoftware.org/doc/english/integrate-listener.html

Anyway, right now my updated code is:

public static
      void main(String[] args)
      {


            int initialDelay = 5000;
          int interval = 1000;

            Timer timer = new Timer();
            timer.schedule(new TimerTask()
            {
                public void run()
                {
                    System.out.println("I am running");
                    try
                    {
                          TimerTest.createFile();
                          Thread.sleep(10000);
                        }catch(Exception ex)
                        {
                        }
                }



            }, initialDelay, interval);

      }
STATUS | wrapper  | 2009/04/14 17:38:10 | --> Wrapper Started as Console
STATUS | wrapper  | 2009/04/14 17:38:10 | Java Service Wrapper Community Edition 3.3.3
STATUS | wrapper  | 2009/04/14 17:38:10 |   Copyright (C) 1999-2009 Tanuki Software, Ltd.  All Rights Reserved.
STATUS | wrapper  | 2009/04/14 17:38:10 |     http://wrapper.tanukisoftware.org
STATUS | wrapper  | 2009/04/14 17:38:10 | 
STATUS | wrapper  | 2009/04/14 17:38:11 | Launching a JVM...
INFO   | jvm 1    | 2009/04/14 17:38:16 | I am running
INFO   | jvm 1    | 2009/04/14 17:38:26 | I am running
INFO   | jvm 1    | 2009/04/14 17:38:36 | I am running
ERROR  | wrapper  | 2009/04/14 17:38:43 | Startup failed: Timed out waiting for a signal from the JVM.
ADVICE | wrapper  | 2009/04/14 17:38:43 | 
ADVICE | wrapper  | 2009/04/14 17:38:43 | ------------------------------------------------------------------------
ADVICE | wrapper  | 2009/04/14 17:38:43 | Advice:
ADVICE | wrapper  | 2009/04/14 17:38:43 | The Wrapper consists of a native component as well as a set of classes
ADVICE | wrapper  | 2009/04/14 17:38:43 | which run within the JVM that it launches.  The Java component of the
ADVICE | wrapper  | 2009/04/14 17:38:43 | Wrapper must be initialized promptly after the JVM is launched or the
ADVICE | wrapper  | 2009/04/14 17:38:43 | Wrapper will timeout, as just happened.  Most likely the main class
ADVICE | wrapper  | 2009/04/14 17:38:43 | specified in the Wrapper configuration file is not correctly initializing
ADVICE | wrapper  | 2009/04/14 17:38:43 | the Wrapper classes:
ADVICE | wrapper  | 2009/04/14 17:38:43 |     TimerTest
ADVICE | wrapper  | 2009/04/14 17:38:43 | While it is possible to do so manually, the Wrapper ships with helper
ADVICE | wrapper  | 2009/04/14 17:38:43 | classes to make this initialization processes automatic.
ADVICE | wrapper  | 2009/04/14 17:38:43 | Please review the integration section of the Wrapper's documentation
ADVICE | wrapper  | 2009/04/14 17:38:43 | for the various methods which can be employed to launch an application
ADVICE | wrapper  | 2009/04/14 17:38:43 | within the Wrapper:
ADVICE | wrapper  | 2009/04/14 17:38:43 |     http://wrapper.tanukisoftware.org/doc/english/integrate.html
ADVICE | wrapper  | 2009/04/14 17:38:43 | ------------------------------------------------------------------------
ADVICE | wrapper  | 2009/04/14 17:38:43 | 
ERROR  | wrapper  | 2009/04/14 17:38:43 | JVM did not exit on request, terminated
STATUS | wrapper  | 2009/04/14 17:38:48 | Launching a JVM...
INFO   | jvm 2    | 2009/04/14 17:38:53 | I am running
INFO   | jvm 2    | 2009/04/14 17:39:04 | I am running
INFO   | jvm 2    | 2009/04/14 17:39:14 | I am running
ERROR  | wrapper  | 2009/04/14 17:39:20 | Startup failed: Timed out waiting for a signal from the JVM.
ADVICE | wrapper  | 2009/04/14 17:39:20 | 
ADVICE | wrapper  | 2009/04/14 17:39:20 | ------------------------------------------------------------------------
ADVICE | wrapper  | 2009/04/14 17:39:20 | Advice:
ADVICE | wrapper  | 2009/04/14 17:39:20 | The Wrapper consists of a native component as well as a set of classes
ADVICE | wrapper  | 2009/04/14 17:39:20 | which run within the JVM that it launches.  The Java component of the
ADVICE | wrapper  | 2009/04/14 17:39:20 | Wrapper must be initialized promptly after the JVM is launched or the
ADVICE | wrapper  | 2009/04/14 17:39:20 | Wrapper will timeout, as just happened.  Most likely the main class
ADVICE | wrapper  | 2009/04/14 17:39:20 | specified in the Wrapper configuration file is not correctly initializing
ADVICE | wrapper  | 2009/04/14 17:39:20 | the Wrapper classes:
ADVICE | wrapper  | 2009/04/14 17:39:20 |     TimerTest
ADVICE | wrapper  | 2009/04/14 17:39:20 | While it is possible to do so manually, the Wrapper ships with helper
ADVICE | wrapper  | 2009/04/14 17:39:20 | classes to make this initialization processes automatic.
ADVICE | wrapper  | 2009/04/14 17:39:20 | Please review the integration section of the Wrapper's documentation
ADVICE | wrapper  | 2009/04/14 17:39:20 | for the various methods which can be employed to launch an application
ADVICE | wrapper  | 2009/04/14 17:39:20 | within the Wrapper:
ADVICE | wrapper  | 2009/04/14 17:39:20 |     http://wrapper.tanukisoftware.org/doc/english/integrate.html
ADVICE | wrapper  | 2009/04/14 17:39:20 | ------------------------------------------------------------------------
ADVICE | wrapper  | 2009/04/14 17:39:20 | 
ERROR  | wrapper  | 2009/04/14 17:39:20 | JVM did not exit on request, terminated
STATUS | wrapper  | 2009/04/14 17:39:23 | CTRL-C trapped.  Shutting down.
STATUS | wrapper  | 2009/04/14 17:39:23 | <-- Wrapper Stopped

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
CEHJCommented:
You're still ignoring exceptions
0
 
tia_kamakshiAuthor Commented:
Hi,

Many Thanks for your reply.

I am trying to add wrapper as suggested in documentation of tanukisoftware

I have created a Main.java file, from that I am trying to call my TimerTest.java file

But I am getting the exception

C:\java\schedular\app\Main.java:33: cannot find symbol
symbol  : constructor TimerTest(java.lang.String[])
location: class TimerTest
        m_app = new TimerTest( args );
                ^
C:\java\schedular\app\Main.java:34: cannot find symbol
symbol  : method start()
location: class TimerTest
        m_app.start();
             ^
C:\java\schedular\app\Main.java:57: cannot find symbol
symbol  : method stop()
location: class TimerTest
        m_app.stop();
             ^
3 errors

Tool completed with exit code 1

Please help me in fixing it

Many Thanks for yoour co-operation


Mainjava.txt
TimerTestjava.txt
0
 
CEHJCommented:
>>m_app = new TimerTest( args );

You don't have a constructor for TimerTest that takes a String array, but you attempt to call one
0
 
tia_kamakshiAuthor Commented:
Thanks for your reply.

Isn't it method public TimerTest(String[] args)  is constructor in my TimerTest.java

I  was compiling Main.java, When I get this error.

Please guide me to fix this

Many Thanks



public TimerTest(String[] args)
	{
			System.out.println("I am in constructor");
 
			try
					{
						int initialDelay = 5000;
				    	int interval = 1000;
 
						Timer timer = new Timer();
						timer.schedule(new TimerTask()
						{
						    public void run()
						    {
						        System.out.println("I am running");
						        try
						        {
						    	    TimerTest.createFile();
						    	    Thread.sleep(10000);
								}catch(Exception ex)
								{
									System.out.println("Exception occurs1: "+ex.toString());
								}
						    }
						}, initialDelay, interval);
					}catch(Exception ex2)
					{
						System.out.println("Exception occurs2: "+ex2.toString());
		}
	}

Open in new window

0
 
CEHJCommented:
It is *now* yes ;-) It wasn't originally in your first posting
0
 
tia_kamakshiAuthor Commented:
Many Thanks, It works great now.

It was picking my class file from classpath.

Therefore not picking the updated file

It works great now.

Many Many Thanks for all your help
0
 
tia_kamakshiAuthor Commented:
Many Thanks
0
 
CEHJCommented:
:-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now