Monday, February 28, 2011

Beware of helping

When you do help, just make sure you are 100% aware of whom you are helping and what kind of person he is and what kind of habits he is having though you know him from your college days. Otherwise surely you will be in trouble. This happened to me since I shared my room to a ...

My Learnings today

Attended one interview today and learned something about OOPS.

Example for Abstract Class and interface:

Interface is for generalization and Abstract class in for specification. For example if you would like to manage car, bike, lorry etc. They all belong to Vehicle category which is generalization, car has wiper and bike does not have wiper which is specialization.

Tuesday, February 22, 2011

Good technical certification sites

Tried these two sites which are really good technical certification sites.

http://www.ucertify.com
http://www.brainbench.com

Ucertify has very good format for the test. It makes us to learn concepts with intuitive questions.  Brainbench has lot of free tests and relatively its easy to pass brain bench test than ucertify. There are two free practice tests in ucertify that helps you to qualify for the other practice tests and the real test.

Friday, February 18, 2011

Glassfish - Form Based Authentication

One interesing thing I missed out is role name defined in web.xml should be mapped to user group name in glassfish server. I have set role name as admin in web.xml and created an user in glassfish through Admin Console ----> Security ----> Realms ---->  File ---> Manager Users. On creating the user set the groupname as given in web.xml and it works.

Thursday, February 17, 2011

Adding xml entries in Blogs

Today suddenly I am getting xml entries are not getting displayed properly in my blog post. Then found it is because of Compose Settings in Post Options. If you set Compose Settings as Interpret typed HTML, xml entries are not displayed correctly i.e xml to html translation is not happening properly. If I set Compose Settings as Interpret typed HTML, then translation is happening properly.

JBoss - Form Based Authentication

This is how I made Form Based authentication work for JBoss.

web.xml entries:

<security-role>
                <role-name>admin</role-name>
        </security-role>             
   <security-constraint>

    <display-name>User Name/ Password </display-name>

    <web-resource-collection>
        <web-resource-name>Makes User Authentication Necessary for all</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>

    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>

</security-constraint>
 
  <login-config>
           <auth-method>FORM</auth-method>
            <realm-name>file</realm-name>
           <form-login-config>
                        <form-login-page>/WEB-INF/jsp/login.jsp</form-login-page>
                        <form-error-page>/WEB-INF/jsp/error.jsp</form-error-page>
                </form-login-config>
  </login-config>

Then <jbosshome>/server/default/conf/login-config.xml has to be edited to update web-console application-policy. My login-config.xml looks like,

<application-policy name="web-console">
    <authentication>
      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
        flag="required">
        <module-option name="usersProperties">users.properties</module-option>
        <module-option name="rolesProperties">roles.properties</module-option>
      </login-module>
    </authentication>
  </application-policy>

Added users.properties and roles.properties in <jbosshome>/server/default/conf directory. This setup works for me.

Wednesday, February 16, 2011

Morning Dreams History

During my child hood I used to get dreams like fighting with soldiers, fighting with snakes. I get sequence of events and not persons. I normally wake up before identifying the persons with whom I am fighting. But now a days I am getting persons and faces. One day Sachin saying to me that he knows me in the dreams. Hummmmm.. but in reality I am unable to get a ticket for a World Cup India match in Chennai.

Monday, February 14, 2011

Friday, February 11, 2011

Issues on Jboss ear file creation


While creating ear file as specified in my earlier blog post faced below issues. Believe it could help someone to save some time.


1. Tried creating a service by writing a class then extends ServiceMBeanSupport and implementing methods like createService(), startService(), stopService(). But on deployment it throwed JMXNotComplaintException. What you need to do is you have to write an Interface (either with some method you would like to expose through JMX or empty interface). And the important point here to note is that interface's name should end with MBean otherwise jboss complains the above. Funny thing but many users faced the same.

2. Creating default users for jboss. Its straight forward as I used default form based authentication. Edited /server/default/conf/login-config.xml and changed users properties and roles properties file for web-console policy.

3. Loading an xml file from the ear file.

My ear has the below directory structure for a xml file. If you would like to bundle an xml file in the ear, then have it under <WEB-INF>/classes directory.

Create your first EAR file

What and all you ear file can have?

For example, it can have Jar (Java Archive), War (Web Archive) and Sar (Service Archive). Jar file has all class files. War has the directory structure as below

WEB-INF------------->classes   -- All client classes are bundled here
WEB-INF-------------->lib  --- All client side dependent jars are bundled here
WEB-INF -------->web.xml ----> web deployment descriptor

It could contain struts bean configuration file or spring controller configuration file based on the technology you are using.

Sar files are Service Archive files where it has service configuration files. For example jboss application server has jboss-service.xml as service bean configuration file. My Sar has the below directory structure

Sar
    --------> SearchService.jar     (it has all service related beans)
    ---------> META-INF ----> jboss-service.xml (it has service bean configurations)

Complete ear has the below directory structure

ear
    -------> SearchService.sar
    --------> job.war                      
    --------->META-INF/application.xml
    --------->META-INF/jboss-app.xml

where application.xml has entries for job.war and jboss-app.xml has entries for SearchService.sar