Problems while using Typica !! Urgent

16 views
Skip to first unread message

Dharmesh

unread,
Aug 22, 2007, 12:50:17 AM8/22/07
to typica
Hello,

I am kind of new to this library. I read thru the stuff and it seems
wonderful. I tried using in my PC. I have a tomcat server and have
included the necessary jars and dependency. But when I try to run ur
enque sample code I get the following errors

SEVERE: EXCEPTION
com.xerox.amazonws.sqs.SQSException: Remote host closed connection
during handshake
at
com.xerox.amazonws.sqs.QueueService.listMessageQueues(QueueService.java:
177)
at com.xerox.amazonws.sqs.SQSUtils.getMessageQueue(SQSUtils.java:104)
at com.xerox.amazonws.sqs.SQSUtils.connectToQueue(SQSUtils.java:63)
at com.EnqueTypicaSample.main(EnqueTypicaSample.java:33)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed
connection during handshake
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:
742)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:
1030)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:
1057)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:
1041)
at
sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:
402)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:
170)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
938)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:
234)
at
com.xerox.amazonws.sqs.QueueService.listMessageQueues(QueueService.java:
157)
... 3 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:
333)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:
723)
... 11 more

I am using the eclipse IDE. Please help me out where I am going wrong.
Thanking you in anticipation.

Dharmesh

dkav...@gmail.com

unread,
Aug 22, 2007, 8:31:37 PM8/22/07
to typica
I'm scratching my head on this one. Which version of the JDK are you
using? Have you tried running outside of eclipse?

> sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Abstrac...
> 170)
> at
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection....
> 938)
> at
> sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConn...

Dharmesh

unread,
Aug 22, 2007, 11:29:17 PM8/22/07
to typica
Thanks for the reply .. I am using JDK 1.5.0_11...I havent tried
outside eclipse, but since I assume it wont make difference..can it be
so that a firewall is blocking ..Pls reply asap

Regards
Dharmesh

On Aug 23, 5:31 am, "dkavan...@gmail.com" <dkavan...@gmail.com> wrote:
> I'm scratching my head on this one. Which version of the JDK are you
> using? Have you tried running outside of eclipse?
>
> On Aug 22, 12:50 am, Dharmesh <vaghan...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > I am kind of new to this library. I read thru the stuff and it seems
> > wonderful. I tried using in my PC. I have a tomcat server and have
> > included the necessary jars and dependency. But when I try to run ur
> > enque sample code I get the following errors
>
> > SEVERE: EXCEPTION
> > com.xerox.amazonws.sqs.SQSException: Remote host closed connection
> > during handshake
> > at
> > com.xerox.amazonws.sqs.QueueService.listMessageQueues(QueueService.java:
> > 177)
> > at com.xerox.amazonws.sqs.SQSUtils.getMessageQueue(SQSUtils.java:104)
> > at com.xerox.amazonws.sqs.SQSUtils.connectToQueue(SQSUtils.java:63)
> > at com.EnqueTypicaSample.main(EnqueTypicaSample.java:33)
> > Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed
> > connection during handshake
> > at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:
> > 742)
> > at

> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocke­tImpl.java:
> > 1030)
> > at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.jav­a:
> > 1057)
> > at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.jav­a:

> > Dharmesh- Hide quoted text -
>
> - Show quoted text -

Dharmesh

unread,
Aug 23, 2007, 5:11:35 AM8/23/07
to typica
Hi,

Also, I am trying to open the URL "http://queue.amazonaws.com/" but in
my browser it shows ..Bad request ..

Regards,
Dharmesh

> > - Show quoted text -- Hide quoted text -

dkav...@gmail.com

unread,
Aug 23, 2007, 9:22:24 AM8/23/07
to typica
Dharmesh,
Your jdk version is just fine. When I hit that URL, I get this XML
reply;
<Response>
<Errors>
<Error>
<Code>InvalidAction</Code>
<Message>The action urn:Get is not valid for this web service.</
Message>
</Error>
</Errors>
<RequestID>6620af44-20f3-4d67-b29c-b0da98748181</RequestID>
</Response>
I've seen firewalls block requests to AWS. This has been a problem
within Xerox (a client of mine). Do you require proxy settings in your
browser where you are? I've never had a problem from my home ISP or
from wireless connections at many shops I've been to. (and my company
doesn't block the requests with our firewall, www.directThought.com)

Can you run "traceroute queue.amazonaws.com" ?

One simple thing to try would be some of the test code I have on the
typica wiki. Nothing fancy happening there. You'd run it as a
standalone app, either inside your IDE or not, but it wouldn't require
a web container.

David

Dharmesh

unread,
Aug 24, 2007, 12:18:26 AM8/24/07
to typica
Hello,

Thanks for the guidance.. I tried that sample code both within and
without the IDE .. but get the same error as
"com.xerox.amazonws.sqs.SQSException: Connection refused: connect .."
Also I wanted to know the difference in the
code snippet shown in the wiki and that of the code shown in the link
above the snippet.. One shows the use of "localhost" and other doesnt.
Can you please also clarify what is the difference and whether its
essential or not. I will
try to run the code having unrestrice internet access and let u know
whether the problem still persist..

Regards
Dharmesh

dkav...@gmail.com

unread,
Aug 24, 2007, 9:19:54 AM8/24/07
to typica
Dharmesh,
The localhost setting is because sometimes I run "tcpmon" which comes
with apache-axis. It allows me to proxy the traffic to and from one of
the amazon services and provides a nice way to view that traffic. It
really does sound like you have something affecting traffic between
you and the web service.

David

Dharmesh

unread,
Aug 28, 2007, 12:13:57 AM8/28/07
to typica
Hi there,

I figured it out .. I guess it wasnt working because of some firewall
and proxy.. Thanks for your help :)
Also can you please tell me how I can find out whether a queue already
exists while creating it .. I have used
SQSUtils.getMessageQueue() but it returns an object of the queue if
already existing and if the queue is not existing it also returns a
queue object but after creating one .. It means it never returns a
null value for me to check whether the queue is existing .. Please
tell me where am I going wrong ..

Regards
Dharmesh

dkav...@gmail.com

unread,
Aug 28, 2007, 9:02:26 AM8/28/07
to typica
Dharmesh,
Have you tried setting these properties to get it working from behind
the proxy?
http.proxyHost (default: <none>)
http.proxyPort (default: 80 if http.proxyHost specified)
http.nonProxyHosts (default: <none>)
Those are standard in the JDK.

As far as testing to see if a queue is created, You'll simply have to
do that manually. There isn't any method in the SQS API that provides
that, so you'll need to call QueueService.listMessageQueues(String
prefix) and look through that list.

David

Dharmesh

unread,
Aug 29, 2007, 6:28:17 AM8/29/07
to typica
Hello,

Well I tried to work on an unrestricted net without ne proxy, so it
works. Now I am making a web application where the user will enter the
details which will be tossed in the queue. I use tomcat server and
when I try to access it I am getting it


java.lang.RuntimeException: Could not find sha1 algorithm
at com.xerox.amazonws.common.AWSConnection.encode(AWSConnection.java:
145)
at
com.xerox.amazonws.common.AWSQueryConnection.makeRequest(AWSQueryConnection.java:
103)
at
com.xerox.amazonws.sqs.QueueService.listMessageQueues(QueueService.java:
157)
at com.xerox.amazonws.sqs.SQSUtils.getMessageQueue(SQSUtils.java:104)
at MessageProcessor.RecieveAllMessages.<init>(RecieveAllMessages.java:
33)
at
org.apache.jsp.PendingApprovals_jsp._jspService(PendingApprovals_jsp.java:
97)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
328)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
315) ....

It works fine on a stand alone application. I have also included the
necessary jar files in the lib folder of tomcat webapps
Please help me out in determining what must be wrong

Regards,
Dharmesh

Dharmesh

unread,
Aug 29, 2007, 7:00:27 AM8/29/07
to typica
Hello,

Also I thought that using SQSUtils.connectToQueue .. I can specify the
tomcat server as "localhost" but it gives an error as handhake
refused .. Please help me out .. I have to access my SQS thru Tomcat
as its a web application also I checked

String ext = System.getProperty("java.ext.dirs");
System.out.println("java.ext.dirs=" + ext);

to see whether its pointing to the directory where sunjce_provider.jar
is present and it does point to it ..
Please help me as soon as possible.

Regards
Dharmesh

dkav...@gmail.com

unread,
Aug 29, 2007, 7:07:00 AM8/29/07
to typica
Hi,
I'm not sure how you are trying to make localhost work. Are you saying
that tomcat is configured to respond to SQS requests, or simply to
proxy them to queue.amazonaws.com ?

David

> ...
>
> read more »

Dharmesh

unread,
Aug 29, 2007, 11:41:57 PM8/29/07
to typica
Hi,

Actually I am trying to develop a web application where the users can
register themselves and the registered details will be then tossed in
the queue. For that purpose I have developed a html page which then
calls the servlet hosted in tomcat which then interacts with the SQS
for inserting in the queue .. The problem that I am facing is the
stand alone application works fine. But when I try through an servlet
it gives an error as "could not find sha1 algorithm" ...

Hope I have made myself some what clear. Please help me out

Dharmesh

> ...
>
> read more »

dkav...@gmail.com

unread,
Aug 30, 2007, 7:30:50 AM8/30/07
to typica
It sounds like the code that does signing of the requests is where the
problem is. That code only calls stuff that is in the JDK, so I'm not
sure that you're missing jar files in your tomcat install. Are you
using the same version of the JDK for your external test and your
tomcat instance? When you run tomcat, it uses your JAVA_HOME to
determine what JDK to use. Though, if you're running in an IDE, you'll
need to check what's defined in there.

David

> ...
>
> read more »

James Murty

unread,
Aug 30, 2007, 9:39:19 PM8/30/07
to typica
You may have to explicitly import the Java security packages
(containing the sha1 algorithm) into your JSP page if you are
performing Typical operations inside the page.

Alternately you should probably think about putting all your SQS code
into servlets rather than JSPs and have your pages be very simple ones
that trigger the servlet to do the real work. I have found that the
less code you have in your JSPs the simpler your life will be.

Reply all
Reply to author
Forward
0 new messages