Solved

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

Posted on 2009-04-14
11
1,346 Views
Last Modified: 2012-05-06
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
Comment
Question by:tia_kamakshi
  • 6
  • 5
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24137500
You are ignoring exceptions which won't help at all. printStackTrace throughout and don't throw Exception from main
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24138596
Also, you should use logging, particularly with an application like this which runs in the background
0
 

Author Comment

by:tia_kamakshi
ID: 24140125
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 24140142
You're still ignoring exceptions
0
 

Author Comment

by:tia_kamakshi
ID: 24146007
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 24147166
>>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
 

Author Comment

by:tia_kamakshi
ID: 24147455
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 24147657
It is *now* yes ;-) It wasn't originally in your first posting
0
 

Author Comment

by:tia_kamakshi
ID: 24147915
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
 

Author Closing Comment

by:tia_kamakshi
ID: 31569827
Many Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24148206
:-)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Fibonacci challenge 11 84
array220 challenge 8 48
wordmultiple challenge 12 92
Systems talking to each other 5 110
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now