users@jax-rpc.java.net

Re: JAX-rpc: servletContext values seem to be empty

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Tue, 17 May 2005 19:18:13 -0700

Rune Science wrote:

>hi folks.
>
>I have a web.xml that doesnt seem to be fowarding the
>information to my Servlet context.
>
>Here is the web.xml:
><web-app>
> <display-name>JAX-RPC HelloWorld Web Application
>Sample</display-name>
> <description>Sample Application for JAX-RPC using
>static stubs.</description>
> <listener>
>
><listener-class>com.sun.xml.rpc.server.http.JAXRPCContextListener</listener-class>
> </listener>
> <servlet>
> <servlet-name>ActiveShip</servlet-name>
> <display-name>ActiveShip</display-name>
> <description>JAX-RPC endpoint -
>ActiveShip</description>
>
><servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
> <servlet>
> <servlet-name>ActiveShip</servlet-name>
>
>
Did you include the correct web.xml? Looks like <servlet> is defined
inside the <servlet> tag. May be you require to remove above two lines.

Jitu

> <init-param>
> <param-name>user</param-name>
> <param-value>me</param-value>
> </init-param>
> <init-param>
> <param-name>password</param-name>
> <param-value>pw</param-value>
> </init-param>
> <init-param>
> <param-name>database</param-name>
> <param-value>someconnection</param-value>
> </init-param>
> </servlet>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>ActiveShip</servlet-name>
> <url-pattern>/activeship</url-pattern>
> </servlet-mapping>
> <session-config>
> <session-timeout>60</session-timeout>
> </session-config>
></web-app>
>
>here is the top of the class. Any insight as to why
>this is not working??
>
>
>public class ActiveShipImpl implements ActiveShipIF,
>ServiceLifecycle {
>
>private ServletEndpointContext jaxrpcContext;
>
>public void init(Object context) throws
>ServiceException {
>
> jaxrpcContext = (ServletEndpointContext)context;
> System.out.println("public void init(Object
>context)");
>
> ServletContext sc =
>jaxrpcContext.getServletContext();
>
> Enumeration initParams =
>sc.getInitParameterNames();
> while( initParams.hasMoreElements() )
> {
> String initParam =
>(String)initParams.nextElement();
> System.out.println("initparam:"+initParam+":");
>
>System.out.println(sc.getInitParameter(initParam));
> }
>
> Enumeration servlets = sc.getServlets();
> while( initParams.hasMoreElements() )
> {
> String initParam =
>(String)servlets.nextElement();
> System.out.println("servlets:"+initParam+":");
> try {
> System.out.println(sc.getServlet(initParam));
> } catch (ServletException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> System.out.println("user:"+
>sc.getInitParameter("user"));
> System.out.println("password:"+
>sc.getInitParameter("password"));
> System.out.println("database:"+
>sc.getInitParameter("database"));
>
>}
>
>
>
>
>
>
>
>
>__________________________________
>Yahoo! Mail Mobile
>Take Yahoo! Mail with you! Check email on your mobile phone.
>http://mobile.yahoo.com/learn/mail
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>