jQuery in Action, 3rd edition
The moose likes Sockets and Internet Protocols and the fly likes Calling Struts from standalone Java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Calling Struts from standalone Java application" Watch "Calling Struts from standalone Java application" New topic

Calling Struts from standalone Java application

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 186

Dear friends,

I am trying to call a Struts Action class from my standalone Java application. I am getting this Exception when i am trying to connect with the web server. Kindly provide me some help regarding this. I am using Sun One Web Server 6.1

>>>>> Exception caught in Utility :: getURLData:EXCEPTION::ioe= java.io.IOExcept
ion: Server returned HTTP response code: 401 for URL:
/https-SAMBA_LoginServer/authenticate.do?terminal=ST with url= http://192.168.10
java.io.IOException: Server returned HTTP response code: 401 for URL: http://192
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
at utilities.Utility.getURLData(Utility.java:1334)
at gui.LoginFrame.after_btLogin(LoginFrame.java:1658)
at gui.LoginFrame.actionPerformed(LoginFrame.java:913)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
at java.awt.Component.processMouseEvent(Component.java:5517)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5282)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3984)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1791)
at java.awt.Component.dispatchEvent(Component.java:3819)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Thanks & Regards,
Joe Ess

Joined: Oct 29, 2001
Posts: 9168

The HTTP error code 401 means the request requires user authentication.

[How To Ask Questions On JavaRanch]
srinivas kande

Joined: Nov 02, 2008
Posts: 1
can anyone give me a sample code to call a url or .do of a web application from a stand alone java program
Joe Ess

Joined: Oct 29, 2001
Posts: 9168

Welcome to the JavaRanch.
There's a number of examples of how to access a URL here.
I agree. Here's the link: http://aspose.com/file-tools
subject: Calling Struts from standalone Java application
It's not a secret anymore!