Tomcat "Authentication Required"

I'm using:
  • Tomcat 6.0
  • NetBeans 6.7.1
  • Windows Vista
Having error like this:
Access to Tomcat server has not been authorized. Set the correct username and password with the "manager" role in the Tomcat customizer in the Server Manager
Damn I took 12 hours to settle this. You guys may experience the same problem if you are using bundle package installation (it should be fine but if you did self configuration then you may experience this).

If you start your Tomcat, I think there should be no problem. See configuration done for your CATALINA after installation:


  • See your CATALINA_BASE.
  • It may look something like this: C:\Users\Compaq\.netbeans\6.7\apache-tomcat-6.0.18_base.Inside it will be a conf folder.
  • Look for tomcat_users.xml. The IDE uses that as catalina home.
  • Open it, you may see something like this:


Put the same username & password in your server configuration tab:


Close & reopen your IDE. Resatrt Tomcat. Good luck.

My reference(s) :

Help! Cannot Start Tomcat

No worries. This is normal for Vista users. You will experience this when you install Tomcat only or if you install it with NetBeans bundle package or when you try to run it with Sysdeo plugin in Eclipse. Whatever you try, nothing gonna get it right.

If so, then you might have the issue with Vista security. See here: Tomcat & Vista Security or Eclipse & Vista Security.

Learn MVC Web Apps

Here is one good tutorial. All Java, No Froth: 6 Easy Steps to MVC Web Apps. Enjoy it!

Credit(s):
My colleagues
All Java, No Froth: 6 Easy Steps to MVC Web Apps

Servlet Essentials

Hi there,

Straight away, we want to start Servlet codings. Consider we already have Java basics which are Java Core and basics of JavaBeans. We also already have the complete environment settings. What to do then?

Follow the steps:

  1. Get to know to javax.servlet package. It contains all the classes & interfaces to build servlets. Google it for more info.
  2. GenericServlet (which is in Servlet API) class to be extended hence, inherited by our class. This class provides functionality that makes it easy to handle requests & responses.


Running Servlet from Netbeans

This tutorial assuming you are going to create a project using JSP + Servlet + Javabeans

Starting:

  1. Open Netbeans.

Creating a project (if you do not have one yet or you wish to have a new one):
  1. File > New Project. "New Project" window appears.
  2. In the "Choose Project" step, choose Java Web > Web Application. Click Next.
  3. In the "Name and Location" step, enter your "Project Name". In this case, we use 'MyServlet'. You may locate your Project Location & Project Folder. We are going to use the default. Click Next.
  4. In the "Server and Settings" step, choose your Apache Tomcat server. I'm going to use 'Java EE 5' for "Java EE version".
  5. We are not going to use any "Frameworks". Just click Finish.

Your project will be created and opened. See that in "Projects" window.


Creating a servlet file:

  1. In the "Project" window, right click your project name node. In our case, it is 'MyServlet'. Choose New > Servlet. "New Servlet" window appears.
  2. It is directly goes to second step which is "Name and Location". Put yours. We are going to use 'MyServletFile'. Click Next.
  3. Leave the default settings in the "Configure Servlet Deployment". Click Finish.

There goes your 1st servlet file. Refer image below:


You may see default servlet code template readily created for you.

(Click for larger view)

You may do stuff in servlet. Compile & run it.

My reference(s): Java Servlet - Re: how can i run servlet in netbeans

About this blog

This blog is created just for my 'nota kaki' of Java. I'm quite a forgetful person that I always lost my notes & have to reopen pages to look at it back. Going through that takes times. To avoid that, I've decided to write them in here & share with others. Some info I found from other pages will be credited to whom it should be. If I did not do so, please remind me since.. you know how such forgetful I am.

First of all, the credits goes to Software Department of KRIM Network Sdn. Bhd. Though many 'things' we have gone through.. I really love you all especially him :D

Caution! I do not accept any 'praises' or something like that. Hate it! Questions regarding JAVA is acceptable. Sharing info is most welcomed.

Enjoy the notes