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.
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
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
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
Tuesday, January 25, 2011
Communication Link Failure - Mysql
Recently I have been trying mysql with Hibernate. After setting the classpath with all related jars, I am puzzled to see communication link failure error while trying to connect from Hibernate.
Finally when I tried netstat -a, I found mysql was listening at port 3336 where as the default port is 3306. After changing connection url in the hibernate-cfg.xml with port entry, all are working fine. Bad thing is it took some 2 hours to find out that the port is the real curprit. Hummmmmm learning with time.
Finally when I tried netstat -a, I found mysql was listening at port 3336 where as the default port is 3306. After changing connection url in the hibernate-cfg.xml with port entry, all are working fine. Bad thing is it took some 2 hours to find out that the port is the real curprit. Hummmmmm learning with time.
Subscribe to:
Posts (Atom)