Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 166981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:11:37+00:00 2026-05-11T12:11:37+00:00

I tried to deploy a servlet I have created to Glassfish application server, and

  • 0

I tried to deploy a servlet I have created to Glassfish application server, and I seem to have hit a bit of a stumbling block. The code deploys fine to the auto deploy folder, and once it’s deployed the following is written to the log file:

[#|2009-03-16T13:41:29.303+0000|INFO|sun-appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Timer-7;|[AutoDeploy] Selecting file /opt/glassfish-2.1.b60e/domains/imageTransformer/autodeploy/image-transformer.war for autodeployment.|#]  [#|2009-03-16T13:41:29.304+0000|INFO|sun-appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Timer-7;|Autoundeploying application :image-transformer|#]  [#|2009-03-16T13:41:29.360+0000|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=23;_ThreadName=Timer-7;| classLoader = WebappClassLoader   delegate: true   repositories:     /WEB-INF/classes/ ----------> Parent Classloader: EJBClassLoader :  urlSet = [] doneCalled = false   Parent -> java.net.URLClassLoader@39cf701c  |#]  [#|2009-03-16T13:41:29.361+0000|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=23;_ThreadName=Timer-7;| SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@5e7408d9|#]  [#|2009-03-16T13:41:29.487+0000|INFO|sun-appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Timer-7;|[AutoDeploy] Successfully autoundeployed : /opt/glassfish-2.1.b60e/domains/imageTransformer/autodeploy/image-transformer.war.|#]  [#|2009-03-16T13:41:29.612+0000|INFO|sun-appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Timer-7;|deployed with moduleid = image-transformer|#]  [#|2009-03-16T13:41:29.783+0000|INFO|sun-appserver2.1|javax.enterprise.system.tools.deployment|_ThreadID=23;_ThreadName=Timer-7;|[AutoDeploy] Successfully autodeployed : /opt/glassfish-2.1.b60e/domains/imageTransformer/autodeploy/image-transformer.war.|#] 

So no obvious errors, but after that I get a 404 from accessing the path that the servlet should be bound to. Is there another step that I need to go through?

the web.xml in my WAR file looks like this:

<web-app>      <servlet>        <servlet-name>MyServlet</servlet-name>          <servlet-class>my.servlet.MyServlet</servlet-class>      </servlet>      <servlet-mapping>         <servlet-name>MyServlet</servlet-name>         <url-pattern>/hello</url-pattern>     </servlet-mapping>  </web-app> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:11:38+00:00Added an answer on May 11, 2026 at 12:11 pm

    There were a couple of problems with this deployment. Firstly, there is a requirement for a second configuration file to be included in the WEB-INF directory, named sun-web.xml. Its contents need to be something along the lines of:

    <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE sun-web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Application Server 8.1 Servlet 2.4//EN' 'http://www.sun.com/software/appserver/dtds/sun-web-app_2_4-1.dtd'> <sun-web-app error-url=''>     <context-root>/MyServlet </context-root> </sun-web-app> 

    It seems to have the potential to get a lot more complex than this (see the documentation).

    Secondly, I had to change the header for the web.xml file, so it read accordingly:

    <?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'         xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd'         version='2.4'>     <servlet>         <servlet-name>MyServlet</servlet-name>         <servlet-class>my.servlet.MyServlet</servlet-class>     </servlet>      <servlet-mapping>         <servlet-name>MyServlet</servlet-name>         <url-pattern>/hello</url-pattern>     </servlet-mapping> </web-app> 

    Note the headers indicating that this is servlet spec 2.4.

    Finally, it also seems that you can’t access this servlet directly; you have to prepend MyServlet/ (or the servlet specific name) to the beginning of the path. So to access this servlet requires you to visit /MyServlet/hello.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you using System.Linq; ? Distinct is an extension method… May 12, 2026 at 1:06 am
  • Editorial Team
    Editorial Team added an answer Not a fully featured implementation, but it should get you… May 12, 2026 at 1:06 am
  • Editorial Team
    Editorial Team added an answer You can do it with some different ugliness: struct InitFoo… May 12, 2026 at 1:06 am

Related Questions

I am trying to deploy Sonar (automatic code monitoring tool) on a Jetty 7
I want to write a simple P2P test app which uses HTTP as underlying
I am trying to deploy a ClickOnce app. It had worked previously when the
I am trying to deploy my MVC app on a subdomain, unfortunately I get

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.