Monday, October 21, 2013

Create web project using maven plugin and set the facets...


  <!-- Allows to create an eclipse project with mvn eclipse:clean eclipse:eclipse -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <wtpversion>2.0</wtpversion>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>

                    <additionalProjectFacets>
                        <jst.jaxrs>1.1</jst.jaxrs>
                        <jst.jstl>1.2</jst.jstl>
                        <jst.web>3.0</jst.web>
                    </additionalProjectFacets>

                    <!-- Set Eclipse project to UTF-8 (if you use eclipse) -->
                    <additionalConfig>
                        <file>
                            <name>.settings/org.eclipse.core.resources.prefs</name>
                            <content>
                                <![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]>
                            </content>
                        </file>
                    </additionalConfig>

                </configuration>
            </plugin>

Friday, May 3, 2013

Align maven with eclipse to create a web application project


In RAD Window à Preferences à J2EE à Project, update web project default folders to support Maven folder structure as shown below.

Note: move all java source files to src/main/java folder & all content inside WebContent folder to src/main/webapp folder.


Install Maven Integration for Eclipse using Help à Install New Software wizard.
M2E plugin url  -  http://download.eclipse.org/technology/m2e/releases




Thursday, February 17, 2011

Build Failure while running "ConfigEngine.sh/bat wp-modify-ldap-security" task for LDAP configuration on websphere portal server 6.1.5

Error:

00000055 exception     E com.ibm.ws.wim.config.LDAPRepositoryConfigHelper getEntityType CWWIM5014E LDAP entity type PersonAccount is not found.
00000055 exception     E com.ibm.ws.wim.config.LDAPRepositoryConfigHelper getEntityType
                                 com.ibm.websphere.wim.exception.WIMConfigurationException: CWWIM5014E LDAP entity type PersonAccount is not found.
    at com.ibm.ws.wim.config.LDAPRepositoryConfigHelper.getEntityType(LDAPRepositoryConfigHelper.java:1251)
    at com.ibm.ws.wim.config.LDAPRepositoryConfigHelper.deleteIdMgrLDAPEntityType(LDAPRepositoryConfigHelper.java:355)
    at com.ibm.ws.wim.config.commands.LDAPRepositoryConfig.deleteIdMgrLDAPEntityType(LDAPRepositoryConfig.java:145)
    at com.ibm.ws.wim.config.commands.IdMgrRepositoryConfigCommandsProvider.deleteIdMgrLDAPEntityType(IdMgrRepositoryConfigCommandsProvider.java:227)

Solution:

 Goto the path ../wp_profile\config\cells\chnsp\wim\config\wimconfig.xml

  modify the file with adding the below code, it should be added after the tag

</config:ldapServerConfiguration>

            <config:ldapEntityTypes name="PersonAccount" searchFilter="">
        <config:objectClasses>inetorgperson</config:objectClasses>
      </config:ldapEntityTypes>
      <config:ldapEntityTypes name="Group" searchFilter="">
        <config:objectClasses>groupOfNames</config:objectClasses>
      </config:ldapEntityTypes>
      <config:groupConfiguration>
        <config:memberAttributes dummyMember="uid=dummy" name="member" objectClass="groupOfNames"
            scope="direct"/>
      </config:groupConfiguration>

How to checkout projects from SVN using command prompt

Prerequisite:

  Download CollabNet Subversion Command-Line Client from  http://www.collab.net/downloads/subversion/

Checkout:

 mvn scm:checkout -DconnectionUrl=scm:svn:http://example.com/svn/trunk/ -DcheckoutDirectory=/home/jp -Dusername=user@example.com -Dpassword=example

Update:

mvn scm:update

Wednesday, February 16, 2011

Useful linux commands

1. List the JAVA processes running on linux:

          ps -ef | grep java | awk '{print $2 "  "  $8}'

     Result:
         
           2070  /opt/Portal61/WebSphere/AppServer/java/bin/java
           7440  /opt/IBM/WebSphere/AppServer61/java/bin/java
           8952  /usr/java/jdk1.5.0_11/bin/java

Open windows share folder on linux

Mount:

mount -t cifs -o username=jp, password=jp //192.168.183.1/doc /home/prakash/doc

Unmount:

umount -f /home/prakash/doc

WinSCP is the best tool that is used to transfer the data between windows and linux. But if we consider the transfer rate it will take much time to transfer, so, as you consider transfer rate windows share is the best one.

Tuesday, February 15, 2011

How to get cobertura coverage report for *VO.java files


In some scenario where we want to take coverage report for *VO.java files which has only setters and getters. We might have tried with mvn cobertura:cobertura command where we ever getting coverage for other java files not for VO.java files.

Workaround:

                Default behavior of exclusion file type is **/*VO.class.
 Solution:

<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>

<configuration>
    <instrumentation>
        <includes>
            <include>**/*VO.class</include>
        </includes>

        <excludes>
            <exclude>**/*Test.class</exclude>
        </excludes>
    </instrumentation>
</configuration>
</plugin>

How to disble "Expression Language" in JSP

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html" isELIgnored="false" %>

<table>
    <tr>
        <td>
            <c:out value="${message}"/>
        </td>
    </tr>
</table>
       

Wednesday, October 7, 2009

Scope in Web Apps

Request Scope
  • Only during the life-time of a single page request->rendering process
Session Scope
  • For as long as a “User” session is maintained (eg: for a user logged in)
Application Scope
  • For as long as the Web App is running

Sunday, July 19, 2009

Maven Instrumentation for EJB project

mvn compile -Doutput.directory=target/classes cobertura:instrument install -Dwas-ejb

Wednesday, May 27, 2009

Useful mvn commands

mvn eclipse:eclipse -DdownloadSources=true

This will set up the eclipse environment and also download the source for the jar files.

mvn clean install war:inplace

This will create a open war inside the target directory. This is very useful to modify non-java resources.

mvn clean install -Dmaven.test.skip=true

This will skip the unit tests . It helps to speed up the install but it is a bad practice.

mvn clean compile install -Dwas-ejb

This will create stub and skeleton for EJB projects.

mvn clean compile install -Dwas6.wasHome="D:\My-Projects\Pack-group\runtimes\base_v61

This will help to deploy EJB projects into WAS.

Thursday, May 21, 2009

ERROR: invalid console appender config detected, console stream is looping

set JAVA_OPTS=-Dorg.jboss.logging.Log4jService.catchSystemOut=false
bin\run.bat

Or, do as
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME% -Dorg.jboss.logging.Log4jService.catchSystemOut=false

Tuesday, December 9, 2008

How to clear Browser caching?

response.setHeader("Cache-Control", "no-store"); //HTTP 1.1
response.setHeader("Pragma", "no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); //prevents caching at the proxy server