UnixServerAdmin

Server Administration & Management

How to Download Oracle Latest Java JRE/JDK in linux by bypassing license using wget

Oracle has recently disabled direct download of java from their servers. So to download java, users have to visit their site via web browser and have to accept their license and terms, then users will get the download link. But if you are working of linux servers in which you can’t access the web browser, then  you should use wget command on the console. Use Below command to download java from linux terminal.

#  wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F” “http://download.oracle.com/otn-pub/java/jdk/7u25-b15/jdk-7u25-linux-x64.tar.gz”

Where :

Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F :- It is a single cookie for all that is needed to bypass license and terms

–no-cookies : – Cookies are a mechanism for maintaining server-side state.  The server sends the client a cookie using the “Set-Cookie” header, and the client responds with the same cookie upon further requests.

–no-check-certificate : – Don’t check the server certificate against the available certificate authorities.  Also don’t require the URL host name to match the common name presented by the certificate.

Advertisements

June 26, 2013 Posted by | Java, Tips & Tricks | , , | Leave a comment

Protected: How to configure Tomcat to run as a Service

This content is password protected. To view it please enter your password below:

December 3, 2011 Posted by | Java, Shell Script, Tips & Tricks, Tomcat | , , , , | Enter your password to view comments.

Tomcat Application Server

Apache Tomcat (or Jakarta Tomcat or simply Tomcat) is an open source servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Oracle Corporation, and provides a “pure Java” HTTP web server environment for Java code to run.

Tomcat should not be confused with the Apache web server, which is a C implementation of an HTTP web server; these two web servers are not bundled together, although they are frequently used together as part of a server application stack. Apache Tomcat includes tools for configuration and management, but can also be configured by editing XML configuration files.

Components :- Tomcat was released with Catalina (a servlet container), Coyote (an HTTP connector) and Jasper (a JSP engine).

Catalina :–> is Tomcat’s servlet container. Catalina implements Sun Microsystems’ specifications for servlet and JavaServer Pages (JSP). In Tomcat, a Realm element represents a “database” of usernames, passwords, and roles (similar to Unix groups) assigned to those users. Different implementations of Realm allow Catalina to be integrated into environments where such authentication information is already being created and maintained, and then utilize that information to implement Container Managed Security as described in the Servlet Specification.

Coyote :–> is Tomcat’s HTTP Connector component that supports the HTTP 1.1 protocol for the web server or application container. Coyote listens for incoming connections on a specific TCP port on the server and forwards the request to the Tomcat Engine to process the request and send back a response to the requesting client.

Jasper :–> is Tomcat’s JSP Engine. Tomcat 5.x uses Jasper 2, which is an implementation of the Sun Microsystems’s JavaServer Pages 2.0 specification. Jasper parses JSP files to compile them into Java code as servlets (that can be handled by Catalina). At runtime, Jasper detects changes to JSP files and recompiles them.

November 9, 2011 Posted by | Java, Tomcat | , , | Leave a comment

Application Servers

An application server is a software framework that provides an environment in which applications can run, no matter what the applications are or what they do.It is dedicated to the efficient execution of procedures (programs, routines, scripts) for supporting the construction of applications.

The term was originally used when discussing early client–server systems to differentiate servers that run SQL services and middleware servers from file servers.

Later, the term took on the meaning of Web applications, but has since evolved further into that of a comprehensive service layer. An application server acts as a set of components accessible to the software developer through an API defined by the platform itself. For Web applications, these components are usually performed in the same machine where the Web server is running, and their main job is to support the construction of dynamic pages.

However, present-day application servers target much more than just Web page generation: they implement services like clustering, fail-over, and load-balancing, so developers can focus on implementing the business logic.

Normally the term refers to Java application servers. When this is the case, the application server behaves like an extended virtual machine for the running applications, transparently handling connections to the database on one side, and connections to the Web client on the other. Other uses of the term may refer to the services that a server makes available or the  computer hardware on which the services run.

Java Application Servers

The Web modules include servlets, JavaServer Pages and Enterprise JavaBeans. Business logic resides in Enterprise JavaBeans – a modular server component providing many features, mostly improving application scalability. The Hibernate project offers an EJB-3 container implementation for the JBoss application server. Tomcat from Apache,The EAServer is from Sybase inc.

A Java Server Page (JSP) (a servlet from Java – the Java equivalent of a CGI script) executes in a Web container. JSPs provide a way to create HTML pages by embedding references to the server logic within the page. HTML coders and Java programmers can work side by side by referencing each other’s code from within their own.

The application servers mentioned above mainly serve Web applications. Some application servers target networks other than web-based ones: Session Initiation Protocol servers, for instance, target telephony networks.

Web Server is a sub set but the Application server is a super set and hence encompasses the past server information that is been stored in database.

Microsoft .NET Framework

Microsoft positions their middle-tier applications and services infrastructure in the Windows Server operating system and the .NET Framework technologies in the role of an application server.

Advantages of application servers

Data and code integrity :–> By centralizing business logic on an individual server or on a small number of server machines, updates and upgrades to the application for all users can be guaranteed. There is no risk of old versions of the application accessing or manipulating data in an older, incompatible manner.

Centralized configuration :–> Changes to the application configuration, such as a move of database server, or system settings, can take place centrally.

Security :–> A central point through which service-providers can manage access to data and portions of the application itself counts as a security benefit, devolving responsibility for authentication away from the potentially insecure client layer without exposing the database layer.

Performance :–> By limiting the network traffic to performance-tier traffic the client–server model improves the performance of large applications in heavy usage environments.

Total Cost of Ownership (TCO) :–> In combination, the benefits above may result in cost savings to an organization developing enterprise applications. In practice, however, the technical challenges of writing software that conforms to that paradigm, combined with the need for software distribution to distribute client code, somewhat negate these benefits.

Transaction Support :–> A transaction represents a unit of activity in which many updates to resources (on the same or distributed data sources) can be made atomic (as an indivisible unit of work). End-users can benefit from a system-wide standard behaviour, from reduced time to develop, and from reduced costs. As the server does a lot of the tedious code-generation, developers can focus on business logic.

November 8, 2011 Posted by | Apache, Java, Tomcat | , , , | Leave a comment

Servlets and Applets

Servlets executes on Servers and have no graphical user interface.

Applets executes on browser, have graphical user interface. An applet is a small server side application that can be loaded and controlled on the browser by the client application. An applet has limited access to resources in order to ensure security.

November 7, 2011 Posted by | Java, Tomcat | , , , | Leave a comment

Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine

The following error is occur due to memory size assigned to Tomcat service is full.

———————————————————————————————————————–
Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.
———————————————————————————————————————–

You need to run following commands from Shell

# cd /usr/local/jakarta/tomcat/bin/

# export _JAVA_OPTIONS=”-Xms20m -Xmx64m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -XX:NewSize=10m -XX:MaxNewSize=10m -XX:SurvivorRatio=6 -XX:TargetSurvivorRatio=80 -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled”

Once you run above command restart the Tomcat service

#./shutdown.sh

#./startup.sh

#./catalina.sh

October 8, 2011 Posted by | Java, Tomcat | , | Leave a comment

How to Set Java Home Directory & Path

1. Set JAVA_HOME & PATH for single user

Login to your account and open .bash_profile file:

# vi ~/.bash_profile

export JAVA_HOME=/usr/local/jdk1.6.0_27
export PATH=$PATH:/usr/local/jdk1.6.0_27/bin

2. Set JAVA_HOME / PATH for All User

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:

# vi /etc/profile
———————————————————————
#Set JAVA_HOME as follows using syntax
export JAVA_HOME=/usr/local/jdk1.6.0_27
#Set PATH as follows:
export PATH=$PATH:/usr/local/jdk1.6.0_27/bin
———————————————————————

# which java

“OR”

Type following command to make soft links:

# ln -s /usr/local/jdk1.6.0_27/bin /usr/bin

# ln -s /usr/local/jdk1.6.0_27/bin/java /usr/bin/java

September 23, 2011 Posted by | Java, Tips & Tricks, Unix/Linux | , , , | Leave a comment

workers.properties

A file that describes the host(s) and port(s) used by the workers (Tomcat processes). A sample workers.properties can be found under the /etc/httpd/conf/ directory.

# vi /etc/httpd/conf/workers.properties

worker.list=jetty
worker.jetty.port=8009
worker.jetty.host=localhost “OR” X.X.X.X
worker.jetty.type=ajp13
worker.jetty.lbfactor=1

September 21, 2011 Posted by | Java, Tomcat | , , | Leave a comment

How to configure mod_jk module

Here is the general mod_jk section in httpd.conf — note that it needs to be OUTSIDE of the virtual host sections:

# vi /etc/httpd/conf/httpd.conf

#####################################################################
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
# JkWorkersFile specify the location where mod_jk will find the workers definitions.
JkWorkersFile /etc/httpd/conf/workers.properties

# Where to put jk logs
# JkLogFile specify the location where mod_jk is going to place its log file.
# JkLogLevel set the log level between :
JkLogFile /var/log/httpd/mod_jk.log

# Set the jk log level [debug/error/info]
# info log will contains standard mod_jk activity (default).
# error log will contains also error reports.
# debug log will contains all informations on mod_jk activity
JkLogLevel info

# Select the log format
# JkLogStampFormat will configure the date/time format found on mod_jk logfile. Using the strftime()
# format string it’s set by default to “[%a %b %d %H:%M:%S %Y]”
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] “

# JkOptions indicate to send SSL KEY SIZE,
# The directive JkOptions allow you to set many forwarding options which will enable (+) or disable (-)
# following option. JkOptions ForwardKeySize , you ask mod_jk, when using ajp13, to forward also the SSL
# Key Size as required by Servlet API 2.3. This flag shouldn’t be set when servlet engine is Tomcat 3.2.x
# (on by default).
#
# JkOptions ForwardURICompat , you told mod_jk to send the URI to Tomcat normally, which is less spec compliant
# but mod_rewrite compatible, use it for compatibility with Tomcat 3.2.x engines (on by default).
#
# JkOptions ForwardURICompatUnparsed , the forwarded URI is unparsed, it’s spec compliant but broke mod_rewrite.
#
# JkOptions ForwardURIEscaped , the forwarded URI is escaped and Tomcat (since 3.3 rc2) will do the decoding part.
#
# JkOptions ForwardDirectories is used in conjunction with DirectoryIndex directive of Apache web server.
# As such mod_dir should be available to Apache, statically or dynamically (DSO)
#
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
# JkRequestLogFormat will configure the format of mod_jk individual request logging. Request logging is configured
# and enabled on a per virtual host basis. To enable request logging for a virtual host just add a JkRequestLogFormat
# config. The syntax of the format string is similiar to the Apache LogFormat command, here is a list of the available
# request log format options:
#
#     Options     Description
#     %b         Bytes sent, excluding HTTP headers (CLF format)
#     %B         Bytes sent, excluding HTTP headers
#     %H         The request protocol
#     %m         The request method
#     %p         The canonical Port of the server serving the request
#     %q         The query string (prepended with a ? if a query string exists, otherwise an empty string)
#     %r         First line of request
#     %s         Request HTTP status code
#     %T         Request duration, elapsed time to handle request in seconds ‘.’ micro seconds
#     %U         The URL path requested, not including any query string.
#     %v         The canonical ServerName of the server serving the request
#     %V         The server name according to the UseCanonicalName setting
#     %w         Tomcat worker name
JkRequestLogFormat “%w %V %T”

# The directive JkEnvVar allow you to forward an environment vars from Apache server to Tomcat engine.
JkEnvVar SSL_CLIENT_V_START

# If you have created a custom or local version of mod_jk.conf-local as noted above, you can change settings
# such as the workers or URL prefix. JkMount directive assign specific URLs to Tomcat. In general the structure
# of a JkMount directive is: You can use the JkMount directive at the top level or inside <VirtualHost> sections
# of your httpd.conf file.
# Send servlet for context /examples to worker named worker1
JkMount /examples/servlet/* worker1

# Send JSPs for context /examples to worker named worker1
JkMount /examples/*.jsp worker1
######################################################################

September 20, 2011 Posted by | Java, Tomcat | , , , , | 1 Comment

How to install mod_jk module

Installation of Mod_jk is not that hard but to make it work or integrate with apache and tomcat a bit tricky. Here is the process of install and configure apache to serve the java pages or webapps with the help of mod_jk module.

1. Install Following Package :-

# yum install gcc*

# yum install httpd

# yum install httpd-devel

2. After Installation, Start Apache Server :-

# /etc/init.d/httpd restart

# chkconfig httpd on

3. Download “mod_jk” [Tomcat Connector] modules from Internet

# wget http://www.motorlogy.com/apache//tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.32-src.tar.gz

4. Abtract package and insert following commands :-

# tar -zxvf tomcat-connectors-1.2.32-src.tar.gz

# cd tomcat-connectors-1.2.32-src

# cd native/

# ./configure –with-apxs=/usr/sbin/apxs   “OR”

# ./configure –with-apxs=/usr/sbin/apxs –with-tomcat41=/usr/local/apache-tomcat-7.0.16/

# make

# make install

September 19, 2011 Posted by | Java, Tomcat | , , , , , | Leave a comment

How to Install Java on Linux

1. Download jdk-6u27-linux-i586.bin from Orcale website and copy /root directory

2. Install jdk-6u27-linux-i586.bin file in linux

# ./jdk-6u27-linux-i586.bin

3. Copy jdk abtract folder to /usr/local directory

# cp -rvdf /root/jdk1.6.0_27 /usr/local

4. Install and Remove Java

# yum install java

======================================================================
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved
======================================================================
 Package                                   Arch                          Version                                      Repository                        Size
======================================================================
Installing:
 java-1.6.0-openjdk              x86_64                     1:1.6.0.0-1.7.b09.el5           base.repo                         27 M
Transaction Summary
=======================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 27 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : java-1.6.0-openjdk                                                                                                                    1/1

Installed:
java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5

Complete!
=====================================================================

# yum remove java

=====================================================================
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
–> Running transaction check
—> Package java-1.4.2-gcj-compat.x86_64 0:1.4.2.0-40jpp.115 set to be erased
–> Processing Dependency: java-gcj-compat >= 1.0.64 for package: gjdoc
–> Processing Dependency: java-gcj-compat >= 1.0.64 for package: gjdoc
–> Processing Dependency: java-gcj-compat for package: antlr
–> Processing Dependency: java-gcj-compat for package: antlr
—> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5 set to be erased
–> Running transaction check
—> Package antlr.x86_64 0:2.7.6-4jpp.2 set to be erased
—> Package gjdoc.x86_64 0:0.7.7-12.el5 set to be erased
–> Finished Dependency Resolution

Dependencies Resolved

=====================================================================
 Package                                     Arch                         Version                                      Repository                       Size
=====================================================================
Removing:
 java-1.4.2-gcj-compat           x86_64                    1.4.2.0-40jpp.115                    installed                           441
 java-1.6.0-openjdk                 x86_64                    1:1.6.0.0-1.7.b09.el5              installed                           73 M
Removing for dependencies:
 antlr                                           x86_64                     2.7.6-4jpp.2                             installed                           3.2 M
 gjdoc                                         x86_64                     0.7.7-12.el5                              installed                           2.2 M
Transaction Summary
=====================================================================
Remove        4 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing        : java-1.4.2-gcj-compat                                                                                                 1/4
Erasing        : antlr                                                                                                                                 2/4
Erasing        : java-1.6.0-openjdk                                                                                                      3/4
Erasing        : gjdoc                                                                                                                               4/4

Removed:
 java-1.4.2-gcj-compat.x86_64 0:1.4.2.0-40jpp.115                              java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5

Dependency Removed:
antlr.x86_64 0:2.7.6-4jpp.2                                                   gjdoc.x86_64 0:0.7.7-12.el5

Complete!
======================================================================

5. Make soft link for bin and java

# ln -s /usr/local/jdk1.6.0_27/bin /usr/bin

# ln -s /usr/local/jdk1.6.0_27/bin/java /usr/bin/java

6. Check whether java is working by the command

# java -version
======================================================================
java version “1.6.0_27”
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
======================================================================

7. Now Java is working successful.

September 17, 2011 Posted by | Java, Tips & Tricks, Tomcat, Unix/Linux | , , , , | Leave a comment

Enable & Configure Firefox for Java Console & Plugins

To configure the Java Plugin follow these steps:

1. Exit Firefox browser if it is already running.
2. Uninstall any previous installations of Java Plugin.
3. Only one Java Plugin can be used at a time. When you want to use a different plugin, or version of a plugin,
remove the symbolic links to any other versions and create a fresh symbolic link to the new one.
4. Create a symbolic link to the libnpjp2.so file in the browser plugins directory
5. Go to the plugins sub-directory under the Firefox installation directory
6. cd <Firefox installation directory>/plugins
7. Create the symbolic link
8. ln -s <Java installation directory>/lib/i386/libnpjp2.so

Note: If you are upgrading your Java version then before creating new symbolic link you should remove old symbolic
link to enable latest downloaded Java.

1. To remove old symbolic link:
2. type cd <Firefox installation directory>/plugins
3. rm libjavaplugin_oji.so

Example
If Firefox is installed at this directory:

# /usr/lib/<Firefox installation directory>/

# mkdir plugins

# cd plugins

Enter the following command to create a symbolic link to the Java Plug-in for the Mozilla browser.

# ln -s /usr/java/latest/lib/i386/libnpjp2.so

Start the Firefox browser, or restart it if it is already up. In Firefox, type about:plugins in the Location bar to confirm that the Java Plugin is loaded. You can also click the Tools menu or Type “about:config” in address bar to confirm that Java Console is there.

 

August 18, 2011 Posted by | Java, Tips & Tricks, Tomcat, Unix/Linux | , , | Leave a comment