Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

Thursday, 13 February 2014

apt-get install debian PT2 (Tomcat 7)

No post for two months and now two post in a day, sometime life if strange.
Until yesterday I cannot be able to install properly Apache Tomcat 7 service and configure it on eclipse environment. Today I've do it almost easily, just to point out the concept that life is strange. 

First of all: you need to put your user into the sudoer list by typing in a terminal the following line: sudo adduser <username> sudo

Then you must log off and again log in.
Now your user have the super user grant when you call the sudo command.

But we are here to talk about install and configure tomcat7.

You must download the tar.gz from the official website , then extract it in one directory at your choice, i choose the standard download directory in my /home/.
Then from the command line move the whole directory in the /usr/lib directory using sudo mv /path/To/apache-tomcat-7 /usr/lib

To start and stop the service now run respectively these two command in terminal: 



  • Start: sudo /usr/lib/apache-tomcat-7.0.50/bin/startup.sh
  • Stop: sudo /usr/lib/apache-tomcat-7.0.50/bin/shutdown.sh
With this method there isn't a single shell script to restart the service, you must instead manually stop and re-start with this two script or, if you are able to do it, write one script by yourself.

At this point if you type http://localhost:8080 on your browser you can see the landing page of tomcat.



Now you need to configure the admin user of the manager-pages of your server.
Open the file /usr/lib/<apache-tomcat dir>/conf/tomcat-users.xml and inside the tag <tomcat-user> put the following line:


<role rolename="manager-gui"/>
<user username="<your user>" password="<your password>" roles="manager-gui,admin-gui"/>

Stop and restart the service, and access the manager app after typing your credential when needed.



From here you can easily deploy your project without using the file manager other than manage session and project.

Configuring Tomcat as server of Eclipse:

You have just install Tomcat in the way that I described above. Now you want to use it on eclipse, right?
Nothing most simple: 
You must go to Windows->preferences->server->Runtime Environment and add your Tomcat server.
Once you have add the server you can try a simple JSP page to test it.

If you do it, remember to stop the tomcat from a terminal window, or eclipse do not take it well and cry like a little girl.


Arrived here you probably ask why I don't install Tomcat from repository.
The answer is simple: apt-get install tomcat7 allows you to use the useful commands service tomcat7 start/restart/stop but divide the tomcat directory in a lot of places, so eclipse can retrieve some of the file that he need to use the server. 
There is a lot of tutorial for fix this problem, but to me no one seems working.


In the next post I'll explain how to install and configure MySql dbms.
Ygy Freezone



Wednesday, 12 February 2014

apt-get install debian PT1 (Java jdk & Eclipse)


It's been a long time since my last post, more than two months, I apologize but in this months I change company and I do not have so much time to develop my personal project, I swear ASAP I'll restart my Arduino guide.

In my personal "dev machine" until last sunday I have a development environment based on win-xp, and because, as you can probably know, Microsoft cut every support to it in the nexts month I decided to migrating my dev-laptop on linux, and after some advice from some of my linux-enthusiast friends I choose the Debian distribution.

Is important to know that I am a Win power user, and I don't know almost nothing about Linux and his terminal based management, in fact I come from an environment completely different from it, and because I think this is a good challenge for me and useful for someone else I decided to post this worklog about the installation and configuration of my good-old dev-laptop.


This is what I want on my machine:




The Installation of the new OS:

Coming from a win environment, I don't have really clear in my mind what problem can have a open source system. One of this problem is the lack of open source firmware for some of the hardware in my laptop.
For my specific case the missing firmware was for the wifi antenna and for the Ati Radeon.

To retrieve this firmware and driver after the full basic installation, you need first to modify the repository list in /etc/apt/sources.list

To do this, you must first find the repository that you need.
I use the repository list built from http://debgen.simplylinux.ch/ 

After the update of the repository list, I open a terminal (I do it as root, since my user isn't in the sudoer list and sudo command do not work. I'll add my user in the sudoer in the near future, because I do not feel good to be root every time I use apt-get) and type aptitude.





Aptitude is a package manager, and I find it very useful. 

Using some simply shortkeys you can find everything you want inside the repository.


Aptitude shortkeys:
u -> update list
U (shift + u) -> mark upgradable
/ -> find name packet (n -> next result, shift + n -> previous result)
+ -> install this packet
- -> remove this packet
g -> install/remove


After the installation of the missing firmware/driver, you can choose to change GUI of my Debian, for example KDE.
KDE is not the default gui of debian, so you must install it.
From the terminal type: sudo apt-get install kde-full



I choose to maintain the Gnome GUI style, which is the default gui of debian.



Now you have your system ready, all firmware and driver installed and the gui reflect what you want.
It's time to satisfy your first developer needs (no its neither porn nor coffee).

The Installation of the Java Jdk and Eclipse IDE:


As you can read in the Debian wiki, Debian provides several Java implementations. Each of them have a development environment (JDK) and a runtime (known as JRE, or Java Virtual Machines JVM).

Open the terminal and type sudo aptitude  then search ("/") "?provides(java-runtime)" on your system to list available packages.
I choose to install the latest OpenJDK which is based on the java 7, instead of the default jdk proposed by Debian which is based on java 6.

To install Eclipse, since on the repository i found only old and deprecated version, I choose to download directly from the website the Eclipse IDE for Java EE Developers.

Doing this, exactly like in win, you only need to extract the tar.gz file into a directory and run eclipse.
You can also configure your system in a way he can run eclipse from terminal or from the main menu ad you can see here.
Honestly, the procedure to make possible run eclipse from terminal do not work for me, it give me some error either on root or normal user. I'll study the causes in the future.
Instead the method to create a new menu item is work fine.


Yesterday I tried also to download and install tomcat, with not much success.

So next time: Installing Tomcat 7 and configuring it, associate tomcat to Eclipse and configure it.
Ygy Frezoone.