This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Cannot find class in a signed jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Cannot find class in a signed jar file" Watch "Cannot find class in a signed jar file" New topic
Author

Cannot find class in a signed jar file

H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 168
Hello

I have a signed file that contains two classes

client/main.class
client/second.class

I have set the main class to be "main.class" in my jar file
this main class creates an object of second.class ...

but the problem i'm getting is NoClassFoundException and it points to the second.class!?



thats my command

C:\jones>java -cp c:\jones\compute.jar;c:\foo\client\mySignedFile.jar -Djava.security.policy=client.policy client.main
127.0.0.1


they are both in the signed file i've checked... thats what i get when i view the jar


And thats my Manifest.MF


what could be a problem?

Thanks
HannaH
[ July 21, 2008: Message edited by: H Melua ]
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Does client.second have a dependency on the compute.jar? And if so, is that jar signed? My primary experience with signed JARs is with Java Web Start and Applets. And for those, all the secondary jars also need to be signed. I can't remember what error you get if they are not. I'm not sure if the same requirement holds for running signed jars directly. But, I'd try signing that compute jar as well and see if that resolves it for you.

As a secondary note, since your jar's manifest defines the main-class, instead of specifying the main class on the command line and the jar in the classpath, you can use the -jar switch to identify both. And if you add the compute.jar to the Manifest using the "Class-Path" attribute (and it can be specified as a relative path) you could then simply enter:

to run it. It keeps the command line simpler.


Let us know if that solves it. If not, perhaps someone else has some insight.
H Melua
Ranch Hand

Joined: Jan 04, 2005
Posts: 168
Thanks a lot for replying

It doesn't apply to RMI because the compute.jar is defined by the server, and then used by the client... and so i shouldnt need to sign it myself... I need the permissions from the server...

I realised that i was missing the codebase , it was always there i dont know how it disapepared
Djava.rmi.server.codebase=file:/c:/jones/client


But now i'm having another trouble with permissions, but for this thread, it is solved

I was going to set the attribute, but when i first time attempted to change the manifest it said to me "invalid digest of message...", so i decided not to touch it again

Thanks a lot for your attempt
very much appreciated..
HannaH
[ July 22, 2008: Message edited by: H Melua ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Cannot find class in a signed jar file
 
Similar Threads
Updated servlets assignment page
A strange compile classpathing issue Im having
NoClassDefFoundError: org/springframework/context/ApplicationListener
Jar file
Need Servlets 4a Help