Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Calling Struts from standalone Java application" Watch "Calling Struts from standalone Java application" New topic
Author

Calling Struts from standalone Java application

Vijay Chandran
Ranch Hand

Joined: Jan 07, 2007
Posts: 178
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: http://192.168.107.80:8888
/https-SAMBA_LoginServer/authenticate.do?terminal=ST with url= http://192.168.10
7.80:8888/https-SAMBA_LoginServer/authenticate.do?terminal=ST
java.io.IOException: Server returned HTTP response code: 401 for URL: http://192
.168.107.80:8888/https-SAMBA_LoginServer/authenticate.do?terminal=ST
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:1170)
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
49)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:236)
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
read.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
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,
Vijay
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

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


[How To Ask Questions On JavaRanch]
srinivas kande
Greenhorn

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
Bartender

Joined: Oct 29, 2001
Posts: 8971
    
    9

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