• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problem in accessing servlets

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have a jsp which is trying to access a servlet(the servlet accesses an ejb).Come what may I cannot access my servlet in weblogic- it gives me Error:404.What is the path of the servlet that i should give in my jsp?(It is a form)
I have set the servlet mapping, uri etc in web.xml but to no avail!!
Using only jsp's the whole thing works fine.
What i did was manually created a
.war file( say login.war) using the jar utility which comes with j2sdk and deployed the war file using the WEBLOGIC administrative console.
login.war contained my jsps in a folder named jsps ,and the deployment descripters-web.xml and weblogic.xml inside WEB-INF folder.
though i did not mention any context root as such, I was able to successfully deploy the war file and access my jsps through the url- localhost:7001/login/jsps/myjsp.jsp.

But now i want a servlet. How should i proceed?Is the context path etc. server specific??
Here is the relevent part of web.xml:-
<servlet>
<servlet-name>control</servlet-name>
<servlet-class>friendwebapp.Control</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>control</servlet-name>
<url-pattern>/control</url-pattern>
</servlet-mapping>
This is the part of the jsp trying to acesss ControllerServlet
<form method="GET" action="/control">
Finally, the servlet class..
public class ControllerServlet extends HttpServlet {.....
Name of the war file login.war.For jsps weblogic automatically appends
/login .
Can anyone help?
Thanks.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i thought of posting this, but u beat me to it....maybe u should have posted this under BEA / Weblogic section
 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well Ram mohan ,
I did post it under that section, but unfortunately not as a new topic
and got no replies.So i am hoping to get some now.

Patience. A minor form of despair disguised as a virtue. Ambrose Bierce

 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is partly a general HTTP URL issue, and partly about app server behaviour.
In your HTML, you have specified a URL of /control. This is a relative URL, and because you have put a / at the start, it is relative to the "root" of the domain. If it is generated by a JSP at http://localhost:7001/login/jsps/myjsp.jsp, then it will resolve to the full URL http://localhost:7001/control.
Meanwhile, in your web.xml, you have mapped your servlet to the application path /control. Because this is an application path, not a full URL, this will resolve to the full URL http://localhost:7001/login/control.
As I hope you can see, the two full URLs are not the same, so your JSP will not send its form data to the right URL.
You should be able to make your JSP work by changing

to either

or

I hope that all makes sense.
 
Pallavi Sikdar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Frank, but unfortunately it did not work. I tried both ../control
and /login/control. Where else could the problem possibly lie?
My ejb jar is fine as I wrote a java application to access it.
After I click submit on the jsp page, the address bar shows:-
http://localhost:7001/login/control?user=a+pwd=a+ etc...
It's still giving Error 404.
Any more suggestions please?!!
Thanks!
Pallavi
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic