Jars needed for HttpsURLConnection

hi,

Using HttpsURLConnection class gives me ClassDefNotFoundException. Can anybody tell which jars are needed here.
LVL 3
kumvjuecAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Why not just update your Java?
0
petmagdyCommented:
what is ur jdk version? can u do exception.printStaxktrace?
0
CEHJCommented:
You probably have < 1.4 - upgrade!
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

kumvjuecAuthor Commented:
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
kumvjuecAuthor Commented:
HttpsURLConnection is being used inside an Action class and this webappl is running on Tomcat 5.0.25
0
CEHJCommented:
If you're having runtime problems, then Tomcat is loading  < 1.4
0
kumvjuecAuthor Commented:
I think it is runtime, because my files are compiling properly. Can you tell how can I solve this?
0
CEHJCommented:
You need to ensure that Tomcat is started with >= 1.4 in its classpath
0
mightyoneCommented:
see CEHJ reply about the wrong jre beeing loaded.+#

see if in the tomcats config another java_home is specified
0
macgillmCommented:
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
mightyoneCommented:
;-)

is there an echo?
0
kumvjuecAuthor Commented:
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
kumvjuecAuthor Commented:
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
CEHJCommented:
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
kumvjuecAuthor Commented:
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
kumvjuecAuthor Commented:
Doing System.getProperty gives me 1.4.2_04-b05
0
CEHJCommented:
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
kumvjuecAuthor Commented:
The code I am talking about is a single line

URL url = new URL("https://www.site.com");
0
CEHJCommented:
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
CEHJCommented:
>>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
CEHJCommented:
>>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
kumvjuecAuthor Commented:
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
CEHJCommented:
Try putting the full path to jsse.jar into the classpath. Quote it if it contains spaces
0
kumvjuecAuthor Commented:
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
CEHJCommented:
Not really 'correct' to do so, but should work if you put it into

java.endorsed.dirs
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kumvjuecAuthor Commented:
Thanks CEHJ, you have always solved my problem
0
CEHJCommented:
8-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.