cancel
Showing results for 
Search instead for 
Did you mean: 

Bad Record MAC. exception while using urlConnection.getInputStream()

Former Member
0 Kudos

All,

In my SAP J2EE instance, from filter I am trying to do get data from an url (protocol is https).

For this I am using urlInstance.openConnection() after that urlConnection.getInputStream() and then reading from this input stream.

When I use http protocol, everything works fine. But with https, during urlConnection.getInputStream(), I get an exception saying "Bad Record MAC".

I tried to execute the same code in a standalone java program. It went fine with both http and https.

I get this error only when I run in SAP J2EE instance and only with https.

From the exception trace, I can see that while running in J2ee engine, the URLConnection instance is org.w3c.www.protocol.http.HttpURLConnection.

When I run a standalone program from command prompt, the instance is com.ibm.net.ssl.www.protocol.https.r. This runs without any issues.

I understand that these instances are different due to different URLStreamHandlerFactory instances.

But I didnt set the factory instance in either of the programs.

1. Is the exception I get is simply bcoz of instance org.w3c.www.protocol.http.HttpURLConnection?

2. In that case how can I change the factory instance in j2ee engine?

Please help.

Thanks.

Edited by: Who-Am-I on Nov 28, 2009 7:54 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

May be my question is too complex to understand. Let me put it simple.

After upgrading to NW 7.01 SP5, an existing communication between SAP J2EE engine and a 3rd party software is not working.

After a lot of debuggin I came to know that its happening at the filter we implemented to route the requests through the 3rd party authentication system.

At the filter exception is coming from org.w3c.www.protocol.http.HttpURLConnection.getInputStream.

This instance of HTTPURLConnection given by protocol handler factory(implementation of URLStreamHandlerFactory) which SAP is considering by default. I want to replace this protocol handler with another handler as I see no problems running the same program outside SAP J2EE instance.

Can we change this protocol handler factory? Where can we change it?

Former Member
0 Kudos

Well... help yourself when nobody helps...

I figured it out myself that protocol handler can be specifid at server jvm paramters at config tool.

The parameter is java.protocol.handler.pkgs

I specified my protocol handler to avoid using iaik's protocl handler and it worked. We are sending this to SAP to see what is the problem with iaik's protocol handler.

I wish it should be possible to give p.o.i.n.t.s to myself...

Former Member
0 Kudos

We are seeing the same problem. Did you get an answer back from SAP?