• 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
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Problem accessing a servlet in weblogic

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I try to access a servlet via weblogic 8.1 I get the following error:


Found no context for "/servlet/brokearage.broker.co.servlet.broker.TestServlet". This request does not match the
context path for any installed Web applications, and there is no default Web application configured.>

These are the steps I took



1) Created a servlet

package brokearage.broker.co.servlet.broker;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestServlet
{

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out = response.getWriter();
out.println("Broker Up and Running");
}


}

2) Created a web.xml file

<?xml version="1.0"?>
<!DOCTYPE WEB-APP PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
<display-name>TestServlet</display-name>
<description>TestServlet</description>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>brokearage.broker.co.servlet.broker.TestServlet</servlet-class>
</servlet>
</web-app>


3) Jarred it into a war file : BrokerWAR.war

META-INF\MANIFEST.MF (Empty)
WEB-INF\web.xml
WEB-INF\classes\brokearage\broker\co\servlet\broker\TestServlet.class


4) Jarred the war file into a EAR file
BrokerWAR.war in the top directory

5)Edited the application.xml

<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
<application>
<display-name/>
<module>
<ejb>BrokerEJB.jar</ejb>
</module>
<module>
<java>TradeJar.jar</java>
</module>
<module>
<web>
<web-uri>BrokerWAR.war</web-uri>
<context-root>BrokerWAR</context-root>
</web>
</module>
</application>


6) Called the servlet with the following url:

http://localhost:11001/servlet/brokearage.broker.co.servlet.broker.TestServlet

Thanks for any help

Tony
 
Tony Evans
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In weblogic console I get the following

This page allows you to view the general configuration of this Web Application module.
Name: BrokerWAR
The name of this Web application deployment.
Context Root: (No Value Assigned)
The URI prefix used in HTTP requests for resources that are part of this Web application module.
Path: C:\domain\brokerdomain\applications\BrokerEAR.ear\BrokerWAR.war
The path, located on the Administration Server, of the original source files for this Web application module.

So it can see my war file but states that no Context Root: (No Value Assigned)

Where can I assign the Context Root.

I thought it was the assigned in the ear : application:


<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN'
'http://java.sun.com/dtd/application_1_3.dtd'>
<application>
<display-name></display-name>
<module>
<ejb>BrokerEJB.jar</ejb>
</module>
<module>
<java>TradeJar.jar</java>
</module>
<module>
<web>
<web-uri>BrokerWAR.war</web-uri>
<context-root>BrokerWAR</context-root>
</web>
</module>
</application>
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also create a weblogic.xml file to declare the context root:
weblogic.xml documentation
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
<application>
<display-name/>
<module>
<ejb>BrokerEJB.jar</ejb>
</module>
<module>
<java>TradeJar.jar</java>
</module>
<module>
<web>
<web-uri>BrokerWAR.war</web-uri>
<context-root>BrokerWAR</context-root>
</web>
</module>
</application>

6) Called the servlet with the following url:

http://localhost:11001/servlet/brokearage.broker.co.servlet.broker.TestServlet



Your application context root was declared as BrokerWAR, but you're using the servlet as your context root in your servlet call. Also, we access the servlet by the servlet-name in the web.xml rather than it's fully qualified name.
 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic