Total Visitors

Sunday, November 24, 2013

What is AJP? A short introduction



  • AJP is used to communicate between the web server and the servlet container
  • The Apache JServ Protocol (AJP) is a binary protocol that can proxy inbound requests from a web server through to an application server that sits behind the web server. The web server is a “reverse proxy,” meaning, its purpose is to handle incoming traffic from the Internet on behalf of the application server.
  • Gal Shachor was the original designer of this protocol. There is, apparently, no current documentation of how the protocol works.
  • Apache JServ is a 100% pure Java servlet engine fully compliant with the JavaSoft Java Servlet APIs 2.0 specification
  • Web implementers typically use AJP in a load-balanced deployment where one or more front-end web servers feed requests into one or more application servers.
  • AJP runs in Apache HTTP Server using the mod_jk plugin.
  • When it was developed the goals of this protocol was
    • Increasing performance (speed, specifically).
    • Adding support for SSL, so that isSecure() and getScheme() will function correctly within the servlet container.
  • A binary format was presumably chosen over the more readable plain text for reasons of performance.

Monday, November 18, 2013

Enabling Debug Facility in JBoss7 AS.

Go to bin/standalone.conf.bat of JBoss 7 AS:-

Inside this file just remove the rem from the below given line:

rem # Sample JPDA settings for remote socket debugging
set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

Then if you are using eclipse as an IDE do the following steps:-
1) Go to Debug configuration
2) Go to Remote Java Application
3) Assign Port: 8787
4) Give your desire Project name and Enjoy!

Wednesday, November 13, 2013

Migration From JBoss6 to JBoss7 AS Servers

1) Make a lib dir inside the EAR and copy paste only the required.(Removed)
Place all your depended lib inside the EarContent/lib folder.
2) Go to Eclipse and make add the lib classpath from this EarContent/lib folder.
3) Here in SRS it will give jxl error, so give classpath of this specific jxl jar file which is situated inside common.


1) ERROR: Caused by: org.jboss.msc.service.ServiceNotFoundException: Service service jboss.ejb.default-resource-adapter-name-service not found
solution: inside standalone.xml add the following lines under "<subsystem xmlns="urn:jboss:domain:ejb3:1.2">"
in standalone.xml:-
<mdb>
  <resource-adapter-ref resource-adapter-name="hornetq-ra"/>
  <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
Note:
If you are configuring it inside standalone.xml but inside standalone-full.xml it is not required and no error will be displayed.

2) Create Connection Pooling.
Go to Datasource and make a connection pooling for your database.
In JBoss 7 configuration the JNDI path is different:
private final String GLOBAL = "java:global";
private final String EJB ="SRSEJB";
Its: GLOBAL + EksConstants.FILE_SEPARATOR+ EAR_NAME + EksConstants.FILE_SEPARATOR +EJB+ EksConstants.FILE_SEPARATOR + jndiName;
--Goto persistance.xml and do the following:
<jta-data-source>java:jboss/SRSOracleDS</jta-data-source>

3) Caused by: java.lang.NoClassDefFoundError: jxl/format/CellFormat
-- https://community.jboss.org/thread/195522
That location isn't meant for placing the application jars. You'll have to package the jxl.jar within
the EarContent/lib folder
That's what the EE spec says about application libraries.

4) Switch to standalone-full.xml, here you don't have to explicitly write step:1

5) Go to standalone.conf.bat and standalone.conf file and change standalone.xml to respective .xmls.

6) In JB7 the @WebContext has changed the jar path. Earlier it was import org.jboss.wsf.spi.annotation.WebContext;
Now it has changed to import org.jboss.ws.api.annotation.WebContext;

7) As in JBoss6 go to your hornetq-jms.xml and pick up:
<jms-queue name="SRSScheduleQueue">
<entry name="/queue/SRSScheduleQueue"/>
</jms-queue>
and paste it inside the standalone-full.xml of JB7 under  "<jms-destinations>"

8)
Go to JBoss Admin Console and add your property configuration in System Properties.
Or add properties at run time manually by CLI(Command Line Argument) as shown below:-
 As in JBoss6 go to your properties-service.xml and pick up:
JBOSS_CONF_FOLDER=C:/jboss-6.1.0.Final/server/conf
SRS_PROP=SRS.properties
RESOURCE_PROP=resources.properties
paste it in a notepad and save it as a .properties file in a drive (say D:/).
-- Prepare a bat file as shown below:
c:
cd C:\jboss-as-7.1.1.Final\bin
standalone.bat --properties d:\srsConfig.properties
Run it...
Observation:-
After load the properties, u can see it at
localhost:8080 > Configuration > Environment Properties
Note:-
Run it......

9) Set your mail configuration inside standalone-full.

Hot Deployment in JB7

#Steps:- https://community.jboss.org/message/723945

1. Please make sure to add
<configuration>
<jsp-configuration development="true"/>
</configuration>
in standalone.xml under <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">        

2. Go to jboss-as-7.1.1.Final/modules/org/jboss/as/web/main
  Place the jboss-as-web-7.1.1.Final-RECOMPILE.jar in there. You can download from http://www.datafilehost.com/download-2cb9ff04.html

3. Open module.xml (jboss-as-7.1.1.Final/modules/org/jboss/as/web/main) and add the following line
<!--resource-root path="jboss-as-web-7.1.1.Final.jar"/-->
<resource-root path="jboss-as-web-7.1.1.Final-RECOMPILE.jar"/>

-----------------------------------OR ANOTHER WAY!-----------------------------

<servlet>
            <servlet-name>jsp</servlet-name>
            <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
            <init-param>
                <param-name>development</param-name>
                <param-value>true</param-value>
            </init-param>
            <load-on-startup>3</load-on-startup>
        </servlet>

How to configure Domain and Host in JBoss 7 AS Server

1) Domain Side (Master)
eg :-(say)
Domain(Master):-10.112.98.200
Host(Slave):-10.112.98.154

Remember:- If we want to create a host then we should first create Users for the host by clicking on add-user.bat cmd.
Then its username and password is used inside the HOST side in host.xml file.
Here say username:- slave and password:- admin

On DOMAIN Side:-
Create User by running add_user.bat. eg:- username: slave password:admin
Create bat with this command:-
domain.bat -b 10.112.98.154 -Djboss.bind.address.management=10.112.98.154
Now run it...

2) Host Side (Slave)
Create a bat file:-
c:
cd C:\jboss-as-7.1.1.Final_Cluster\bin
domain.bat -b 10.112.98.200 -Djboss.domain.master.address=10.112.98.154 -Djboss.bind.address.management=10.112.98.200

3)
Open host.xml : add server identities inside managementRealm attribute and Secret value in base64 format:

Convert Host Created password into base64 decoding using online decoder and place it inside the <secret value>.

<host name="slave" xmlns="urn:jboss:domain:1.2">     <--- username (which was created on Master)

<security-realm name="ManagementRealm">
<server-identities>
<!-- Replace this with either a base64 password of your own, or use a vault with a vault expression -->
      <secret value="YWRtaW4="/>                 <--- password (which was created on Master)
</server-identities>
<authentication>
<properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
</authentication>
</security-realm>

### Edit the <domain-controller> at host section to read:
 <domain-controller>
       <!--<local/>-->
       <!-- Alternative remote domain controller configuration with a host and port -->
       <remote host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>
    </domain-controller>

Don't forget to add the the security-realm attribute otherwise you will get messages like:


[Host Controller] 16:26:06,454 ERROR [org.jboss.remoting.remote.connection] (Rem
oting "host1:MANAGEMENT" read-1) JBREM000200: Remote connection failed: javax.se
curity.sasl.SaslException: Authentication failed: all available authentication m
echanisms failed
[Host Controller] 16:26:06,469 ERROR [org.jboss.as.host.controller] (Controller
Boot Thread) JBAS010901: Could not connect to master. Aborting. Error was: java.
lang.IllegalStateException: JBAS010942: Unable to connect due to authentication
failure.

Now run your Host side...You can access the link either from Master's or Host's IP Address.

Friday, April 15, 2011

Linux Basic Commands

What is Linux?

Linux is a free and open-source operating system based on the Unix operating system. It was created by Linus Torvalds in 1991 and has since grown to become one of the most popular and widely used operating systems in the world.

Linux is known for its stability, security, and flexibility. It can be used on a wide range of devices, from smartphones and tablets to servers and supercomputers. Linux is also popular in the web hosting industry, powering many websites and web applications.

One of the key features of Linux is that it is open-source, meaning that its source code is freely available to anyone who wants to use it, modify it, or contribute to its development. This has led to a large and active community of developers and users who work together to improve and enhance the operating system.

Linux comes in many different distributions or "distros," each with its own unique set of features and applications. Some popular Linux distros include Ubuntu, Debian, Fedora, and CentOS.

Basic Commands:

ls - list files and directories in the current directory.

cd - change directory to the specified directory.

mkdir - create a new directory.

rm - remove a file or directory.

cp - copy a file or directory.

mv - move or rename a file or directory.

cat - concatenate and display the contents of a file.

grep - search for a pattern in a file or files.

sudo - execute a command with superuser privileges.

ps - display information about currently running processes.

top - display information about resource usage by processes.

chmod - change the permissions of a file or directory.

chown - change the owner of a file or directory.

tar - create or extract a tar archive.

ssh - connect to a remote server over SSH protocol. 

Friday, December 31, 2010

‘Six’ best web frameworks in Java


1. Java Server Faces – JSF

  • From Sun Microsystems
  • Based on Component Centric approach
  • Best Feature : The most using web framework. Because of its component architecture, the developer doesn’t need to mess with writing HTML, JavaScript etc to get rich “AJAX” type of functionality. It also takes care of state and event management. It has very less configurationtoo.
JavaServer Faces (JSF) is a new standard Java framework for building Web applications. It simplifies development by providing a component-centric approach to developing Java Web user interfaces. JavaServer Faces also appeals to a diverse audience of Java/Web developers. “Corporate developers” and Web designers will find that JSF development can be as simple as dragging and dropping user interface (UI) components onto a page, while “systems developers” will find that the rich and robust JSF API offers them unsurpassed power and programming flexibility. JSF also ensures that applications are well designed with greater maintainability by integrating the well established Model-View-Controller (MVC) design pattern into it’s architecture. Finally, since JSF is a Java standard developed through Java Community Process (JCP), development tools vendors are fully empowered to provide easy to use, visual, and productive develop environments for JavaServer Faces.
2. GWT
  • From Google
  • Based on Widgets
  • Best Feature : Speed development. Easy to develop good, neat and “Browser independent” Ajax applications. Give more stress to pure browser independent ;) .
Google Web Toolkit (GWT) is an open source Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don’t speak browser quirks as a second language. Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatibilities between web browsers and platforms, and JavaScript’s lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.GWT lets you avoid many of these headaches while offering your users the same dynamic, standards-compliant experience. You write your front end in the Javaprogramming language, and the GWT compiler converts your Java classes to browser-compliant JavaScript and HTML.Project Home and More features
  • From Mc4j
  • Based on MVC architecture
  • Best Feature: No Configurations ) . Annotation based programming makes coding more interesting and easy.
Stripes is a presentation framework for building web applications using the latest Java technologies. The main driver behind Stripes is that web application development in Java is just too much work! It seems like every existing framework requires gobs of configuration.Project Home and more features
  • From SpringSource
  • Based on MVC architecture
  • Best Feature : Speed development. Now so many Annotations are also included (v2.5). Its from SpringSource and have a good support too. Being a person who likes and works with Spring framework.. I really encouraged by their good and really fast support.
Spring Web MVC is the own web framework of Spring Framework.The Spring MVC Framework’s architecture and design are in such a way that every piece of logic and functionality is highly configurable. Also Spring can integrate effortlessly with other popular Web Frameworks like StrutsWebWorkJava Server Faces andTapestry. It means that you can even instruct Spring to use any one of the Web Frameworks. More than that Spring is not tightly coupled with Servlets or Jsp to render the View to the Clients. Integration with other View technologies like VelocityFreemarkerExcel or Pdf is also possible
  • From Apache
  • Based on MVC architecture
  • Best Feature : No more ActionForms! Use any JavaBean to capture form input or put properties directly on an Action class. Use both binary and String properties! and its enhanced and rich tags
Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applications. The framework is designed to streamline the full development cycle, from building, to deploying, to maintaining applications over time.Project Home and More Features
6. Wicket
  • From Apache
  • Based on Component Centric approach
  • Best Feature : Swing-like OO Component Model. This feature separates Wicket from all other frameworks