users@glassfish.java.net

Re: deploy a servlet in sun app server 8

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Wed, 29 Apr 2009 10:18:01 -0700

On 04/28/09 09:20 AM, glassfish_at_javadesktop.org wrote:
> Hi, I'm having troubles deploying a servlet in Sun App Server 8, my scenario is like this:
>
> 1. context-root=tamayo
>
> 2. the web.xml:
> <?xml version="1.0" encoding="UTF-8"?>
>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
>
> <display-name>tamayo1</display-name>
>
> <servlet>
>
> <display-name>empdets</display-name>
>
> <servlet-name>empdets</servlet-name>
>
> <servlet-class>empdets</servlet-class>
>
> <servlet-mapping>
>
> <servlet-name>empdets</servlet-name>
>
> <url-pattern>/jaco</url-pattern>
>
> </servlet-mapping>
>
> </servlet>
>
> </web-app>
>
>
>
> 3. the findemp.html calls the empdets servlet, in the <form> tag I have:
> <form name='frmemp' action='http://localhost:8080/tamayo/jaco' method='get'>
>
> 4. when the user press submit I got a 404 status code --Not Found--
>
> 5. the servlet, the EAR file and the html are in the same directory
>
> My question is: what am I missing to find the servlet? is my web.xml wrong? something with my ear file?
>
> I'm attaching my EAR file if you want to take a look
>

Your EAR file fails to deploy for me, with this error message:

  CLI171 Command deploy failed : Deploying application in domain failed;
  Error loading deployment descriptors for module [tamayo1] Line 8
  Column 18 -- Deployment descriptor file WEB-INF/web.xml in archive
  [war-ic.war]. cvc-complex-type.2.4.a: Invalid content was found
  starting with element 'servlet-mapping'. One of
  '{"http://java.sun.com/xml/ns/j2ee":init-param,
  "http://java.sun.com/xml/ns/j2ee":load-on-startup,
  "http://java.sun.com/xml/ns/j2ee":run-as,
  "http://java.sun.com/xml/ns/j2ee":security-role-ref}' is expected.

I've looked at the WEB-INF/web.xml of the embedded WAR file, and
found that it is malformed:

  <?xml version="1.0" encoding="UTF-8"?>
  <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <display-name>tamayo1</display-name>
  <servlet>
  <display-name>empdets</display-name>
  <servlet-name>empdets</servlet-name>
  <servlet-class>empdets</servlet-class>
  <servlet-mapping>
  <servlet-name>empdets</servlet-name>
  <url-pattern>/jaco</url-pattern>
  </servlet-mapping>
  </servlet>
  </web-app>

You need to move the closing </servlet> right after </servlet-class>
and before <servlet-mapping>.

After making this change, I was able to deploy and submit the form
without any issues.

I've used Glassfish v2.1, BTW, but I would not expect SJSAS 8.x to
behave any
different.

Thanks,

Jan

> Regards
> [Message sent by forum member 'htamayo' (htamayo)]
>
> http://forums.java.net/jive/thread.jspa?messageID=344169
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>