LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-01-2010, 04:21 AM   #1
joel2001k
Member
 
Registered: Mar 2007
Distribution: GNU/Linux debian unstable main
Posts: 95

Rep: Reputation: 17
jnacontrib win32 service doesn't start


Hi, I have to work with fu**ing windows xp there's xampp with tomcat plugin installed on it. I wrote a program for it that uses a rmi server to provide data which will be sent by the server pages and finally presentated by a GUI.
Now I want my server started automatically on system startup. I've allready looked at jni but there seems to be a problem with mingw-gcc and sun's dll. So I switched to jna. I downloaded jnacontrib package, compiled and packaged it. The service is installed now but I can't start it. It gives me error 1053 back when trying to start it from service control. When I try it to start from command line `java MvServer` nothing happens. I posted below the service relevant code.

MvService.java
Code:
public class MvService
	extends Win32Service
{	
	public MvService()
	{
		super("MvService");
	}

	public void onStop()
	{
	}

	public void onStart()
	{
		try{
			Runtime.getRuntime().exec("rmiregistry.exe");
		}catch(IOException e){
			System.out.println("couldn't start rmiregistry");
		}
		
		new Thread(new Runnable(){
			public void run(){
				RMISecurityManager security_manager;
				MvServer server;
			
				try{
					security_manager = new RMISecurityManager();
					System.setSecurityManager(security_manager);

					server = new MvServer();
					Naming.rebind("MvServer", server);
				}catch(Exception e){
					e.printStackTrace();
				}
			}
		}).start();
	}
}
MvServer.java
Code:
	public static void main(String[] args)
	{
		MvService service;
	
		service = new MvService();
		
		if(args.length == 1){
			if(args[0].equals("install")){
				service.install("Module Viewer Server",
						"i-ch module viewer and overview of trainees",
						null,
						null,
						null,
						"java.exe -Djava.rmi.server.codebase=file:///c/classes/MvServer/ -Djava.security.policy=policy.txt -cp .;\\Programme\\jdom-1.1\\build\\jdom.jar;\\Programme\\Java\\jdk1.6.0_13;\\xampp\\tomcat\\lib\\servlet-api.jar;\\Programme\\jna\\jna.jar;\\Programme\\jna\\jnacontrib.jar -Xrs MvServer");
			}else if(args[0].equals("uninstall")){
				service.uninstall();
			}else{
				System.out.println("Arguments:");
				System.out.println("install   = install service");
				System.out.println("uninstall = uninstall service");
				System.out.println("<none>    = run service");
			}
		}else{
			service.init();
		}
	}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Q: how to start a service when system start acerlinux AIX 2 04-10-2009 05:45 AM
when i try to start samba pdc's smb service nmbd failed to start . sandeepchau123 Linux - Newbie 2 10-20-2007 01:59 PM
service could not start LinuxRam Linux - Newbie 4 08-26-2004 06:03 AM
Start service HiGate Linux - General 3 01-25-2003 04:19 PM
How do I start WINE And How Do I Install a Win32 program on it? Ely Linux - Software 7 04-11-2002 10:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration