• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

UrlyBird: Codebase file location

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I am having some problems launching my server application due to the location of the codebase file. Basically, my application is launched and packaged using a single .jar file named runme.jar. When this is run using the java -jar command with the parameter "server", it launches the server.

I am trying to set the JVM parameters such as java.security.policy programmatically. I have succcessfully been able to do this for java.security.policy and java.rmi.server.hostname. However, when I try to do this for java.rmi.server.codebase, I am having some issues.

Basically, if I specify the absolute directory of the runme.jar file, using the command:

System.setProperty("java.rmi.server.codebase", "file:/c:/.../runme.jar")

it works fine. If I try to set it using a relative path by using the command:

System.setProperty("java.rmi.server.codebase", "file:/runme.jar")

I receive the error message "java.lang.ClassNotFoundException: suncertify.server.RemoteData_Stub".

I have attempted to retrieve the classpath by printing the command System.getProperty("java.class.path"). When I do this, it only prints runme.jar. I am not sure if this is normal or not but attempting to add additional class paths by adding Class-Path entries to the manifest file does not result in any new paths being displayed.

I am just wondering if someone can help me out in order to run my application without specifying the codebase on the command line as required by the spec.

Thanks Guys!

Dan.
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dan,

Welcome to JavaRanch and this forum.

I assume you are going down this path because you are trying to start the rmi registry from the command line, and then trying to connect your server to it.

You might want to look at the java.rmi.registry.LocateRegistry class - in particular the createRegistry method. Using this you can start the registry from within your server application, which means taht your codebase will be automagically correct, and no security policy will be necessary.

Regards, Andrew
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats great, thanks for your help andrew. I will take a look at this class and see how it goes.

Thanks again!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic