Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Jars needed for HttpsURLConnection

Posted on 2004-11-04
27
Medium Priority
?
488 Views
Last Modified: 2013-11-24
hi,

Using HttpsURLConnection class gives me ClassDefNotFoundException. Can anybody tell which jars are needed here.
0
Comment
Question by:kumvjuec
  • 12
  • 11
  • 2
  • +2
27 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 12496637
Why not just update your Java?
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12496641
what is ur jdk version? can u do exception.printStaxktrace?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12496671
You probably have < 1.4 - upgrade!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:kumvjuec
ID: 12496702
It is 1.4.2
I found on net that it is inbuilt. But still I am getting
rootCause =
java.lang.NoClassDefFoundError: javax/net/ssl/HttpsURLConnection
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12496717
HttpsURLConnection is being used inside an Action class and this webappl is running on Tomcat 5.0.25
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12496759
If you're having runtime problems, then Tomcat is loading  < 1.4
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12496788
I think it is runtime, because my files are compiling properly. Can you tell how can I solve this?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12496821
You need to ensure that Tomcat is started with >= 1.4 in its classpath
0
 
LVL 6

Expert Comment

by:mightyone
ID: 12496961
see CEHJ reply about the wrong jre beeing loaded.+#

see if in the tomcats config another java_home is specified
0
 

Expert Comment

by:macgillm
ID: 12498541
change your java_home environment variable and have it point to a jdk that's higher than 1.4 you most likely installed tomcat with an old jdk installed
0
 
LVL 6

Expert Comment

by:mightyone
ID: 12499070
;-)

is there an echo?
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12502035
How do I find that which version the tomcat is using. afaik there has never been a version before 1.4 installed on my computer.

There is one other problem I have found - all https URLs are throwing MalFormedUrlException
But in Eclipse, when I am running the same code, the https URLs are also working.

Please help me how to configure Tomcat. My java_home is pointing towards c:\j2sdk1.4.2_04
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12502166
I installed Tomcat again, and the same war file is working fine on the newly installed Tomcat. So this means that there must be some wrong configuration settings for Tomcat. Can you please help me what to change where in the older Tomcat so that it may work??
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12502832
It's difficult to say without knowing your environment. JAVA_HOME you say is set to >= 1.4 but it doesn't seem to be behaving like that. You should be able to confirm the last point by printing the value of System property "java.vm.version" in a JSP/servlet
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12503171
I don't know whether I have narrowed down the problem, but here is what I find.
When I start Tomcat from the taskbar's icon (Monitor Tomcat), then the https urls are working.
But when the same Tomcat is started from Eclipse (i am using tomcat plugin with default settings), then https urls throw malformedurlexception.
Please help me, there must be somthing different with the ways the two startups are taking place.
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12503181
Doing System.getProperty gives me 1.4.2_04-b05
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12503183
You'll have to trace the initialisation through in order:

>>When I start Tomcat from the taskbar's icon

see what the shortcut points to, then examine *it* and so  on ...
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12503191
The code I am talking about is a single line

URL url = new URL("https://www.site.com");
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12503200
OK - i've just done some investigation. IN my 1.4 installation, the HttpsUrlConnection classes are actually in jsse.jar. Are you perhaps missing that in your Tomcat classpath?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12503206
>>The code I am talking about is a single line

I'm talking about your environment, not your code. The code at this point is of no interest
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12503219
>>IN my 1.4 installation, the HttpsUrlConnection classes are actually in jsse.jar.

That goes for 1.5 too, so i'd take a guess that all versions from 1.4 to 1.5 are the same. Look at the JRE jars
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12503240
I found jsse.jar in the jre/lib directory

In case of "Monitor Tomcat"
JVM is C:\Program Files\Java\j2re1.4.2_04\bin\client\jvm.dll
Java Classpath is C:\Program Files\Apache Software Foundation\Tomcat 5.0\bin\bootstrap.jar
Java Options are
-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 5.0
-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\endorsed
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 5.0

In Eclipse,
I have specified the same JVM
When I give bootstrap.jar in my classpath, Tomcat does not start.
I am just trying to give it the Java Options too
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12503342
Try putting the full path to jsse.jar into the classpath. Quote it if it contains spaces
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12503372
Thanks CEHJ, this has worked. :)
Last thing - can I just put this jar in some directory without specifying it in the classpath??

Thanks a lot
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 12503504
Not really 'correct' to do so, but should work if you put it into

java.endorsed.dirs
0
 
LVL 3

Author Comment

by:kumvjuec
ID: 12503586
Thanks CEHJ, you have always solved my problem
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12503626
8-)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

564 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