Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

exceptions that shouldn't be while trying to display a signed JApplet using the appletviewer

Thread view: 
lbrtchx@hotmail.com - 25 Jul 2007 21:41 GMT
I am getting
~
ClassNotFoundException . . . "Caused by" . . . FileNotFoundException
~
exceptions
~
C:\JApps\JApplet>appletviewer -J-Djava.security.policy=test00.policy
test00.html
load: class WP04_Japplet00 not found.
java.lang.ClassNotFoundException: WP04_Japplet00
       at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at
sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at
sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
       at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
       at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
       at sun.applet.AppletPanel.run(AppletPanel.java:361)
       at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
\test00_signed.jar\test00.class (The system cannot find
the path specified)
       at java.io.FileInputStream.open(Native Method)
       at java.io.FileInputStream.<init>(FileInputStream.java:106)
       at java.io.FileInputStream.<init>(FileInputStream.java:66)
       at
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:
70)
       at
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:
161)
       at
sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
       at sun.applet.AppletClassLoader.access
$100(AppletClassLoader.java:44)
       at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:
173)
       at java.security.AccessController.doPrivileged(Native Method)
       at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
       ... 8 more
~
the thing is that I can see the actual file right there in the jar
exactly where appletviewer is telling me it can not find it
~
C:\JApps\JApplet>jar -tvf test00_signed.jar
 1962 Wed Jul 25 16:08:20 EDT 2007 META-INF/MANIFEST.MF
 2083 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.SF
 1095 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.DSA
    0 Wed Jul 25 16:08:20 EDT 2007 META-INF/
  828 Wed Jul 25 16:08:20 EDT 2007 AuthorCommentsBox00.class
  669 Wed Jul 25 16:08:20 EDT 2007 JControls00.class
 1956 Wed Jul 25 16:08:20 EDT 2007 LocalResource02.class
  543 Wed Jul 25 16:08:20 EDT 2007 navBar00.class
  573 Wed Jul 25 16:08:20 EDT 2007 navBarPix02.class
  323 Wed Jul 25 16:08:20 EDT 2007
OptionsIndexOutOfBoundsException00.class
  946 Wed Jul 25 16:08:20 EDT 2007 PixSel04.class
  836 Wed Jul 25 16:08:20 EDT 2007 PixSelCtrl00.class
  661 Wed Jul 25 16:08:20 EDT 2007 PixSelName04.class
  286 Wed Jul 25 16:08:18 EDT 2007 PopUpAktnH00.class
 3200 Wed Jul 25 16:08:18 EDT 2007 PUpAktn14.class
  885 Wed Jul 25 16:08:18 EDT 2007 PUpSel00$1.class
 1100 Wed Jul 25 16:08:18 EDT 2007 PUpSel00.class
  892 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$1.class
  589 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$2.class
 2238 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00.class
 1655 Wed Jul 25 16:08:20 EDT 2007 SldSpd04.class
  738 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$1.class
  720 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$2.class
 1497 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02.class
 1023 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02$BookInfo.class
 5316 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02.class
 8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class
    0 Tue Jul 24 17:31:28 EDT 2007 images/./
    0 Tue Jul 24 17:31:28 EDT 2007 images/./gui/
  946 Wed Feb 17 22:44:30 EST 1999 images/./gui/cut.gif
  200 Mon Sep 04 09:06:32 EDT 2006 images/./gui/warning1.gif
    0 Tue Jul 24 17:31:28 EDT 2007 images/./pix/
42499 Sun Sep 17 23:22:54 EDT 2006 images/./pix/BidOldMonkeyHalf.jpg
~
I am using windows
~
C:\JApps\JApplet>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
~
to sign the jar file and run the appletviewer with a batch file
~
SET _KD=WP04_JApplet00

SET _SNDKD=%_KD%_signed

SET _KSTR="keys.kstr"

SET _STRPW="password"

SET _DNM="CN=MM@www.com, OU=wwwabc, O=org, L=noplace, ST=AR, C=US"

SET _ALIAS="MM@www.com"

echo "// __ del(eting) %_KSTR%, *.jar,  *.class"

del %_KSTR%

echo "del *.jar"
del *.jar

echo "del *.class"
del *.class

echo "// __ Compiling all classes in directory"

javac *.java

echo "// __ jar(ring) all classes in directory"

jar cvf0 %_KD%.jar *.class -C "images/" .

keytool -genkey -keystore %_KSTR% -storepass %_STRPW% -keypass %_STRPW
% -dname %_DNM% -alias %_ALIAS%

keytool -export -keystore %_KSTR% -storepass %_STRPW% -alias %_ALIAS% -
file %_KD%.cer

jarsigner -keystore %_KSTR% -storepass %_STRPW%  -keypass %_STRPW% -
signedjar %_SNDKD%.jar %_KD%.jar %_ALIAS%

echo "del *.class"
del *.class

del %_KD%.jar

appletviewer -J-Djava.security.policy=%_KD%.policy %_KD%.html
~
which I have used without any problems in other cases
~
What is going on there?
~
Thanks
lbrtchx
lbrtchx@hotmail.com - 25 Jul 2007 21:46 GMT
also, my java policy file looks like this:
~
keystore "keys.kstr";

grant codeBase "file:C:/JApps/JApplet/-" {
permission java.security.AllPermission;
};
Andrew Thompson - 25 Jul 2007 23:20 GMT
...
> ClassNotFoundException . . . "Caused by" . . . FileNotFoundException
...
>java.lang.ClassNotFoundException: WP04_Japplet00
...
>C:\JApps\JApplet>jar -tvf test00_signed.jar
...
>  8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class
...
> What is going on there?

'Case'.  Always use correct case.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Nigel Wade - 26 Jul 2007 09:27 GMT
> Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
> \test00_signed.jar\test00.class (The system cannot find
>  the path specified)

> ~
>  the thing is that I can see the actual file right there in the jar
> exactly where appletviewer is telling me it can not find it
>  which I have used without any problems in other cases
> ~
>  What is going on there?

Which file can you see? I don't see a file called test00.class in your jar,
which is the file that the classloader says it cannot find. Maybe my eyesight
is failing?

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Twisted - 26 Jul 2007 10:03 GMT
On Jul 25, 4:41 pm, lbrt...@hotmail.com wrote:
> load: class WP04_Japplet00 not found.
>   8212 Wed Jul 25 16:08:20 EDT 2007 WP04_JApplet00.class

Oops. It's looking for "Japplet" but the closest you have is
"JApplet". Even if the Windoze machine you're using has a case-
insensitive filesystem, the jar file's inner filesystem and Java are
both case-sensitive and will see the difference. (Also, if the class
is internally named with a capital A it would still not have worked in
all likelihood. If it is internally named with a small a, then it
won't work even if you change the class to load to use a capital A to
match the jar file name. All three must match case, and with case
insensitive filesystems, the class name on the command line or in the
HTML code and the class name in the source file must still match case.)
Roedy Green - 26 Jul 2007 14:41 GMT
>WP04_Japplet00

Where's the package? Put every class in a jar in a package.  You
invite trouble when you code in a non-idiomatic way.

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

lbrtchx@hotmail.com - 26 Jul 2007 15:58 GMT
Sorry
~
actually the classes I was using were called WP04_Japplet00, etc,
naming/cases were consistent
~
the thing is that I trimmed down the example in order to debug it
using "test00" as the name of file
~
I am still having the problem, which I can notunderstand. Let me
reproduce it cleanly and repost it here
~
lbrtchx
Roedy Green - 26 Jul 2007 16:17 GMT
> actually the classes I was using were called WP04_Japplet00, etc,
>naming/cases were consistent

General rule.  Tell the truth.  When you tell fibs to simplify, you
often mask the source of the trouble.  To simplify, simplify your
actual compilable source code, and quote the whole thing precisely.
This process often helps you solve your own problem.  See
http://mindprod.com/jgloss/sscce.html

When you have more than one class, organise your classes into
packages.  See http://mindprod.com/jgloss/package.html

"." not " _" separates package name from class.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

lbrtchx@hotmail.com - 26 Jul 2007 16:52 GMT
OK here it is
~
C:\JApps\JApplet>appletviewer -J-Djava.security.policy=test00.policy
test00.html
load: class test00 not found.
java.lang.ClassNotFoundException: test00
       at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:183)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at
sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:127)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at
sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:626)
       at sun.applet.AppletPanel.createApplet(AppletPanel.java:778)
       at sun.applet.AppletPanel.runLoader(AppletPanel.java:707)
       at sun.applet.AppletPanel.run(AppletPanel.java:361)
       at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.FileNotFoundException: C:\JApps\JApplet
\test00_signed.jar\test00.class (The system cannot find the path
specified)
       at java.io.FileInputStream.open(Native Method)
       at java.io.FileInputStream.<init>(FileInputStream.java:106)
       at java.io.FileInputStream.<init>(FileInputStream.java:66)
       at
sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:
70)
       at
sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection....
161)
       at
sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:295)
       at sun.applet.AppletClassLoader.access
$100(AppletClassLoader.java:44)
       at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:
173)
       at java.security.AccessController.doPrivileged(Native Method)
       at
sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:170)
       ... 8 more
~
the thing is that I can see the actual file right there in the jar
exactly where appletviewer is telling me it can not find it
~
C:\JApps\JApplet>jar -tvf test00_signed.jar
 1962 Wed Jul 25 16:08:20 EDT 2007 META-INF/MANIFEST.MF
 2083 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.SF
 1095 Wed Jul 25 16:08:20 EDT 2007 META-INF/MM_G.DSA
    0 Wed Jul 25 16:08:20 EDT 2007 META-INF/
  828 Wed Jul 25 16:08:20 EDT 2007 AuthorCommentsBox00.class
  669 Wed Jul 25 16:08:20 EDT 2007 JControls00.class
 1956 Wed Jul 25 16:08:20 EDT 2007 LocalResource02.class
  543 Wed Jul 25 16:08:20 EDT 2007 navBar00.class
  573 Wed Jul 25 16:08:20 EDT 2007 navBarPix02.class
  323 Wed Jul 25 16:08:20 EDT 2007
OptionsIndexOutOfBoundsException00.class
  946 Wed Jul 25 16:08:20 EDT 2007 PixSel04.class
  836 Wed Jul 25 16:08:20 EDT 2007 PixSelCtrl00.class
  661 Wed Jul 25 16:08:20 EDT 2007 PixSelName04.class
  286 Wed Jul 25 16:08:18 EDT 2007 PopUpAktnH00.class
 3200 Wed Jul 25 16:08:18 EDT 2007 PUpAktn14.class
  885 Wed Jul 25 16:08:18 EDT 2007 PUpSel00$1.class
 1100 Wed Jul 25 16:08:18 EDT 2007 PUpSel00.class
  892 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$1.class
  589 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00$2.class
 2238 Wed Jul 25 16:08:20 EDT 2007 PUpSpdSel00.class
 1655 Wed Jul 25 16:08:20 EDT 2007 SldSpd04.class
  738 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$1.class
  720 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02$2.class
 1497 Wed Jul 25 16:08:20 EDT 2007 SplitPanes02.class
 1023 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02$BookInfo.class
 5316 Wed Jul 25 16:08:20 EDT 2007 TreeDemo02.class
 8212 Wed Jul 25 16:08:20 EDT 2007 test00.class
    0 Tue Jul 24 17:31:28 EDT 2007 images/./
    0 Tue Jul 24 17:31:28 EDT 2007 images/./gui/
  946 Wed Feb 17 22:44:30 EST 1999 images/./gui/cut.gif
  200 Mon Sep 04 09:06:32 EDT 2006 images/./gui/warning1.gif
    0 Tue Jul 24 17:31:28 EDT 2007 images/./pix/
42499 Sun Sep 17 23:22:54 EDT 2006 images/./pix/BidOldMonkeyHalf.jpg
~
I am using windows
~
C:\JApps\JApplet>java -version
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
~
to sign the jar file and run the appletviewer with a batch file
~
SET _KD=test00

SET _SNDKD=%_KD%_signed

SET _KSTR="keys.kstr"

SET _STRPW="password"

SET _DNM="CN...@www.com, OU=wwwabc, O=org, L=noplace, ST=AR, C=US"

SET _ALIAS="M...@www.com"

echo "// __ del(eting) %_KSTR%, *.jar,  *.class"

del %_KSTR%

echo "del *.jar"
del *.jar

echo "del *.class"
del *.class

echo "// __ Compiling all classes in directory"

javac *.java

echo "// __ jar(ring) all classes in directory"

jar cvf0 %_KD%.jar *.class -C "images/" .

keytool -genkey -keystore %_KSTR% -storepass %_STRPW% -keypass
%_STRPW
% -dname %_DNM% -alias %_ALIAS%

keytool -export -keystore %_KSTR% -storepass %_STRPW% -alias %_ALIAS%
-
file %_KD%.cer

jarsigner -keystore %_KSTR% -storepass %_STRPW%  -keypass %_STRPW% -
signedjar %_SNDKD%.jar %_KD%.jar %_ALIAS%

echo "del *.class"
del *.class

del %_KD%.jar

appletviewer -J-Djava.security.policy=%_KD%.policy %_KD%.html
~
also, my java policy file looks like this:
~
keystore "keys.kstr";

grant codeBase "file:C:/JApps/JApplet/-" {
permission java.security.AllPermission;
}
~
Thanks
lbrtchx
lbrtchx@hotmail.com - 26 Jul 2007 19:07 GMT
Oops! No mistery whatsoever, a typo crept in ...
~
lbrtchx


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.