Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Run on Server for Servlet
Run on Server for Servlet [message #201128] Wed, 03 October 2007 16:50 Go to next message
Eclipse UserFriend
Originally posted by: Mark.Rosenthal.cexp.com

Eclipse Europa, WST 2.0.0

1. Project = MyProject
2. Servlet class = com.foo.HelloWorldServlet
3. MyProject/WebContent/WEB-INF/web.xml contains
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>
</servlet-mapping>
4. Right click on HelloWorldServlet.java, click Run As->Run on Server
5. The test browser opens with the URL:
http://localhost:8080/MyProject/servlet/com.foo.HelloWorldSe rvlet
6. Which results in a 404.
7. As expected given web.xml, the servlet can be accessed at:
http://localhost:8080/MyProject/HelloWorldServlet

It seems like the URL being generated is what would be used with the (now
disabled by default) invoker servlet mapping. How to configure the test
browser to launch with what is configured in web.xml?
Re: Run on Server for Servlet [message #201151 is a reply to message #201128] Wed, 03 October 2007 18:23 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1354
Registered: July 2009
Senior Member
Mark,

It should work as you expect. The servlet declaration and mapping in
the web.xml should be recognized as the URI for the servlet and
incorporated into the URL. For some unknown reason, this isn't working
and the default "/servlet/<servlet class>" URI is being used as the fall
back. In the past, I've seen this caused by bugs, but I'm not aware of
any such bugs that aren't already fixed.

Unfortunately, I don't have any good guesses as to why this is
happening. I can conceive of some simple typos that could cause this,
but none off the top of my head where the expected URL would still work.
Are there any other dynamic web projects with servlets that have the
same problem?

Cheers,
Larry


Mark Rosenthal wrote:
> Eclipse Europa, WST 2.0.0
>
> 1. Project = MyProject
> 2. Servlet class = com.foo.HelloWorldServlet
> 3. MyProject/WebContent/WEB-INF/web.xml contains
> <servlet-mapping>
> <servlet-name>HelloWorldServlet</servlet-name>
> <url-pattern>/HelloWorldServlet</url-pattern>
> </servlet-mapping>
> 4. Right click on HelloWorldServlet.java, click Run As->Run on Server
> 5. The test browser opens with the URL:
> http://localhost:8080/MyProject/servlet/com.foo.HelloWorldSe rvlet
> 6. Which results in a 404.
> 7. As expected given web.xml, the servlet can be accessed at:
> http://localhost:8080/MyProject/HelloWorldServlet
>
> It seems like the URL being generated is what would be used with the (now
> disabled by default) invoker servlet mapping. How to configure the test
> browser to launch with what is configured in web.xml?
>
>
Re: Run on Server for Servlet [message #201218 is a reply to message #201151] Thu, 04 October 2007 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Mark.Rosenthal.cexp.com

Thanks Larry,

Per your suggestion, I have tried creating another Dynamic Web Project from
scratch as follows:

1. New Project->Dynamic Web Project
2. Target Runtime->Apache Tomcat v6.0
3. Configurations->Default Configuration for Apache Tomcat v6.0
4. No EAR Membership
5. Project Facets->Dynamic Web Module 2.5 and Java 5.0
6. Context Root->DynamicWebProject2
7. Content Directory->WebContent
8. Java Source Directory->src
9. Generate Deployment Descriptor->checked
10. Right-click on Java Resources:src
11. New Package->com.foo
12. Right-click on com.foo
13. New Web->Servlet
14. Class name->HelloWorldServlet
15. URL Mappings: /HelloWorldServlet (The default)
16. Create Servlet (accept defaults)
17. Edit servlet to output "Hello, World".
18. Automatically generated web.xml contains:
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>
</servlet-mapping>
19. Right-Click on HelloWorldServlet.java
20. Run As->Run on Server
21. Choose Existing Server->Tomcat v6.0 Server at localhost
22. Add and Remove Projects->DynamicWebProject2 is already configured
23. Browser opens with:
http://localhost:8080/DynamicWebProject2/servlet/com.foo.Hel loWorldServlet
24. 404
25. Servlet can be accessed from:
http://localhost:8080/DynamicWebProject2/HelloWorldServlet

Do you get different results with Europa WST/JST 2.0.0 ?

Regards,
-Mark



"Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
news:fe0mnl$sht$1@build.eclipse.org...
> Mark,
>
> It should work as you expect. The servlet declaration and mapping in the
> web.xml should be recognized as the URI for the servlet and incorporated
> into the URL. For some unknown reason, this isn't working and the default
> "/servlet/<servlet class>" URI is being used as the fall back. In the
> past, I've seen this caused by bugs, but I'm not aware of any such bugs
> that aren't already fixed.
>
> Unfortunately, I don't have any good guesses as to why this is happening.
> I can conceive of some simple typos that could cause this, but none off
> the top of my head where the expected URL would still work. Are there any
> other dynamic web projects with servlets that have the same problem?
>
> Cheers,
> Larry
>
>
> Mark Rosenthal wrote:
>> Eclipse Europa, WST 2.0.0
>>
>> 1. Project = MyProject
>> 2. Servlet class = com.foo.HelloWorldServlet
>> 3. MyProject/WebContent/WEB-INF/web.xml contains
>> <servlet-mapping>
>> <servlet-name>HelloWorldServlet</servlet-name>
>> <url-pattern>/HelloWorldServlet</url-pattern>
>> </servlet-mapping>
>> 4. Right click on HelloWorldServlet.java, click Run As->Run on Server
>> 5. The test browser opens with the URL:
>> http://localhost:8080/MyProject/servlet/com.foo.HelloWorldSe rvlet
>> 6. Which results in a 404.
>> 7. As expected given web.xml, the servlet can be accessed at:
>> http://localhost:8080/MyProject/HelloWorldServlet
>>
>> It seems like the URL being generated is what would be used with the (now
>> disabled by default) invoker servlet mapping. How to configure the test
>> browser to launch with what is configured in web.xml?
Re: Run on Server for Servlet [message #201224 is a reply to message #201218] Thu, 04 October 2007 15:50 Go to previous messageGo to next message
Rob Frost is currently offline Rob FrostFriend
Messages: 64
Registered: July 2009
Member
Looks like you've hit the bug in the Java EE 5 class
org.eclipse.jst.jee.ui.internal.deployables.WebDeployableArt ifactUtil.getModuleObject()
that was fixed in 2.0.1:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=197809
-Rob
"Mark Rosenthal" <Mark.Rosenthal@cexp.com> wrote in message
news:fe302p$f3p$1@build.eclipse.org...
> Thanks Larry,
>
> Per your suggestion, I have tried creating another Dynamic Web Project
> from scratch as follows:
>
> 1. New Project->Dynamic Web Project
> 2. Target Runtime->Apache Tomcat v6.0
> 3. Configurations->Default Configuration for Apache Tomcat v6.0
> 4. No EAR Membership
> 5. Project Facets->Dynamic Web Module 2.5 and Java 5.0
> 6. Context Root->DynamicWebProject2
> 7. Content Directory->WebContent
> 8. Java Source Directory->src
> 9. Generate Deployment Descriptor->checked
> 10. Right-click on Java Resources:src
> 11. New Package->com.foo
> 12. Right-click on com.foo
> 13. New Web->Servlet
> 14. Class name->HelloWorldServlet
> 15. URL Mappings: /HelloWorldServlet (The default)
> 16. Create Servlet (accept defaults)
> 17. Edit servlet to output "Hello, World".
> 18. Automatically generated web.xml contains:
> <servlet-mapping>
> <servlet-name>HelloWorldServlet</servlet-name>
> <url-pattern>/HelloWorldServlet</url-pattern>
> </servlet-mapping>
> 19. Right-Click on HelloWorldServlet.java
> 20. Run As->Run on Server
> 21. Choose Existing Server->Tomcat v6.0 Server at localhost
> 22. Add and Remove Projects->DynamicWebProject2 is already configured
> 23. Browser opens with:
> http://localhost:8080/DynamicWebProject2/servlet/com.foo.Hel loWorldServlet
> 24. 404
> 25. Servlet can be accessed from:
> http://localhost:8080/DynamicWebProject2/HelloWorldServlet
>
> Do you get different results with Europa WST/JST 2.0.0 ?
>
> Regards,
> -Mark
>
>
>
> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
> news:fe0mnl$sht$1@build.eclipse.org...
>> Mark,
>>
>> It should work as you expect. The servlet declaration and mapping in the
>> web.xml should be recognized as the URI for the servlet and incorporated
>> into the URL. For some unknown reason, this isn't working and the
>> default "/servlet/<servlet class>" URI is being used as the fall back.
>> In the past, I've seen this caused by bugs, but I'm not aware of any such
>> bugs that aren't already fixed.
>>
>> Unfortunately, I don't have any good guesses as to why this is happening.
>> I can conceive of some simple typos that could cause this, but none off
>> the top of my head where the expected URL would still work. Are there any
>> other dynamic web projects with servlets that have the same problem?
>>
>> Cheers,
>> Larry
>>
>>
>> Mark Rosenthal wrote:
>>> Eclipse Europa, WST 2.0.0
>>>
>>> 1. Project = MyProject
>>> 2. Servlet class = com.foo.HelloWorldServlet
>>> 3. MyProject/WebContent/WEB-INF/web.xml contains
>>> <servlet-mapping>
>>> <servlet-name>HelloWorldServlet</servlet-name>
>>> <url-pattern>/HelloWorldServlet</url-pattern>
>>> </servlet-mapping>
>>> 4. Right click on HelloWorldServlet.java, click Run As->Run on Server
>>> 5. The test browser opens with the URL:
>>> http://localhost:8080/MyProject/servlet/com.foo.HelloWorldSe rvlet
>>> 6. Which results in a 404.
>>> 7. As expected given web.xml, the servlet can be accessed at:
>>> http://localhost:8080/MyProject/HelloWorldServlet
>>>
>>> It seems like the URL being generated is what would be used with the
>>> (now disabled by default) invoker servlet mapping. How to configure the
>>> test browser to launch with what is configured in web.xml?
>
>
Re: Run on Server for Servlet [message #201248 is a reply to message #201224] Thu, 04 October 2007 17:06 Go to previous message
Eclipse UserFriend
Originally posted by: Mark.Rosenthal.cexp.com

Hello Rob,

I installed wtp 2.0.1 all-in-one and that fixed the problem.

Thanks!
-Mark

"Rob Frost" <rfrost@bea.com> wrote in message
news:fe324d$m4f$1@build.eclipse.org...
> Looks like you've hit the bug in the Java EE 5 class
> org.eclipse.jst.jee.ui.internal.deployables.WebDeployableArt ifactUtil.getModuleObject()
> that was fixed in 2.0.1:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=197809
> -Rob
> "Mark Rosenthal" <Mark.Rosenthal@cexp.com> wrote in message
> news:fe302p$f3p$1@build.eclipse.org...
>> Thanks Larry,
>>
>> Per your suggestion, I have tried creating another Dynamic Web Project
>> from scratch as follows:
>>
>> 1. New Project->Dynamic Web Project
>> 2. Target Runtime->Apache Tomcat v6.0
>> 3. Configurations->Default Configuration for Apache Tomcat v6.0
>> 4. No EAR Membership
>> 5. Project Facets->Dynamic Web Module 2.5 and Java 5.0
>> 6. Context Root->DynamicWebProject2
>> 7. Content Directory->WebContent
>> 8. Java Source Directory->src
>> 9. Generate Deployment Descriptor->checked
>> 10. Right-click on Java Resources:src
>> 11. New Package->com.foo
>> 12. Right-click on com.foo
>> 13. New Web->Servlet
>> 14. Class name->HelloWorldServlet
>> 15. URL Mappings: /HelloWorldServlet (The default)
>> 16. Create Servlet (accept defaults)
>> 17. Edit servlet to output "Hello, World".
>> 18. Automatically generated web.xml contains:
>> <servlet-mapping>
>> <servlet-name>HelloWorldServlet</servlet-name>
>> <url-pattern>/HelloWorldServlet</url-pattern>
>> </servlet-mapping>
>> 19. Right-Click on HelloWorldServlet.java
>> 20. Run As->Run on Server
>> 21. Choose Existing Server->Tomcat v6.0 Server at localhost
>> 22. Add and Remove Projects->DynamicWebProject2 is already configured
>> 23. Browser opens with:
>> http://localhost:8080/DynamicWebProject2/servlet/com.foo.Hel loWorldServlet
>> 24. 404
>> 25. Servlet can be accessed from:
>> http://localhost:8080/DynamicWebProject2/HelloWorldServlet
>>
>> Do you get different results with Europa WST/JST 2.0.0 ?
>>
>> Regards,
>> -Mark
>>
>>
>>
>> "Larry Isaacs" <Larry.Isaacs@sas.com> wrote in message
>> news:fe0mnl$sht$1@build.eclipse.org...
>>> Mark,
>>>
>>> It should work as you expect. The servlet declaration and mapping in
>>> the web.xml should be recognized as the URI for the servlet and
>>> incorporated into the URL. For some unknown reason, this isn't working
>>> and the default "/servlet/<servlet class>" URI is being used as the fall
>>> back. In the past, I've seen this caused by bugs, but I'm not aware of
>>> any such bugs that aren't already fixed.
>>>
>>> Unfortunately, I don't have any good guesses as to why this is
>>> happening. I can conceive of some simple typos that could cause this,
>>> but none off the top of my head where the expected URL would still work.
>>> Are there any other dynamic web projects with servlets that have the
>>> same problem?
>>>
>>> Cheers,
>>> Larry
>>>
>>>
>>> Mark Rosenthal wrote:
>>>> Eclipse Europa, WST 2.0.0
>>>>
>>>> 1. Project = MyProject
>>>> 2. Servlet class = com.foo.HelloWorldServlet
>>>> 3. MyProject/WebContent/WEB-INF/web.xml contains
>>>> <servlet-mapping>
>>>> <servlet-name>HelloWorldServlet</servlet-name>
>>>> <url-pattern>/HelloWorldServlet</url-pattern>
>>>> </servlet-mapping>
>>>> 4. Right click on HelloWorldServlet.java, click Run As->Run on Server
>>>> 5. The test browser opens with the URL:
>>>> http://localhost:8080/MyProject/servlet/com.foo.HelloWorldSe rvlet
>>>> 6. Which results in a 404.
>>>> 7. As expected given web.xml, the servlet can be accessed at:
>>>> http://localhost:8080/MyProject/HelloWorldServlet
>>>>
>>>> It seems like the URL being generated is what would be used with the
>>>> (now disabled by default) invoker servlet mapping. How to configure
>>>> the test browser to launch with what is configured in web.xml?
>>
>>
>
>
Previous Topic:developing taglibs
Next Topic:Problems developing a plugin based on SSE (ModelHandler Error?!)
Goto Forum:
  


Current Time: Tue Apr 16 18:44:41 GMT 2024

Powered by FUDForum. Page generated in 1.32281 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top