• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Making my own servlet (for the first time...)

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear friends,

I trying to get into the world of J2EE, building my own Servlet, and it seems not so smooth and easy... I need help.

I working with the Intellij environment , I open New Project -> web service->Apache Axis. Everything was great. But then, I added
my own MyServlet extends HttpServlet , put a breakpoing in "my init()" and "my doGet()" and was expecting, execute the server (apache)
and expected to see the program stop on my breakpoint, but nope.

Can somebody help me? I guess the problem is the definition in web.xml, but I dont know how to change it.
Here is my current xml:


<display-name>Apache-Axis</display-name>
<servlet>
<display-name>Apache-Axis Servlet</display-name>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet>
<display-name>Axis Admin Servlet</display-name>
<servlet-name>AdminServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet>
<display-name>SOAPMonitorService</display-name>
<servlet-name>SOAPMonitorService</servlet-name>
<servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class>
<init-param>
<param-name>SOAPMonitorPort</param-name>
<param-value>5101</param-value>
</init-param>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SOAPMonitorService</servlet-name>
<url-pattern>/SOAPMonitor</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
</web-app>


what should I do?
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change? No, the problem is that you don't have a definition in that web.xml file for your MyServlet class. You have to put one in there. Hint: it should look like the other ones which are already there.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web service?

Why did you choose a web service project in IntelliJ?

Web services are not web applications. I think this is a mis-step on your part.
 
Ori Weisler
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys!!

Thanks you for the fast reply!!!

1. I changed the web.xml adding those lines:
<servlet>
<display-name>MyServelet</display-name>
<servlet-name>MyServelet</servlet-name>
<servlet-class>example.MyServlet</servlet-class>
</servlet>

still doesnt work (should I write down the all path? where should the servlet class should be?)

2. I tried to google some info, and its was written that in order to open J2EE project, this is the right way.
What do you recommend?
 
Ori Weisler
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
also when I open web application it asks for choosing web service
 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ori,
Read again what bear has suggested. WebService != Web Application.

I working with the Intellij environment , I open New Project -> web service->Apache Axis.


I use MyEclipse and it has something like this New Project -> Web Project to create Web Project and not Web Service.

Do you see similar kind of option in Intellij IDE? Then we can come to other problem related to Servlet.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Start over. Really.

You do not need all that web services crap clogging things up and getting in the way. It's just going to make things that much harder to get going.

My recommendation is to grab a copy of the Servlet Specification and read it from cover to cover before proceeding any further. It's a surprisingly easy read and will let you know what's what with regards to servlets.
 
Ori Weisler
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tnx guys.

I made it, at last.

I dont understand one thing, why dont keep things simple?

I've just learn learn the ASP.NET with great videos made by microsoft, they keep things simple, and explain
step by step, in a video/pdf.

Why there is nothing like that for Java/J2ee???

Tnx anyway.
 
Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Material? There is tons of material out on internet. Google it.
Video? I have seen couple on www.youtube.com for Java. I am sure you will get some for J2EE(now Java EE) too.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You made it complicated for yourself by choosing the wrong option and polluting your project with all that web services stuff.

It actually is rather simple. Did you read the Servlet Spec like I advised? If not, you really have no cause for complaint.

And yeah, there are tons and tons of Java material out there.
 
Ori Weisler
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tnx again!

 
Hang a left on main. Then read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic