Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Struts from standalone Java application

 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTTP error code 401 means the request requires user authentication.
 
srinivas kande
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9265
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
There's a number of examples of how to access a URL here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic