GIT Eclipse usage basic

GIT- Basics & Eclipse Usage
This post aim at very basic usage of using GIT based tools and eclipse configurations for the same. 

  • create a new repository : create a new directory, open it and perform a
    • git init
to create a new git repository.

  • checkout a repository : Create a working copy of a local repository by running the command 
    • git clone /path/to/repository 
when using a remote server, your command will be
git clone username@host:/path/to/repository

  • Goto project dir 
1. git init
2. git status
3.git add .
4. git status
5. git commit -m "first commit"
6. Create an empty repo in GITHUB
7.copy clone url
8.git remote add origin << URL >>
9.git push -u origin master
10. Check your files are there on GIT remote

To add more / update files

  • git add . 
  • git status 
  • git commit -m "second commit"
  • git push -u origin master

Read more


Unix command to find class in jar | windows command to search class in jars

Below are the sample commands to find out required class is there in the jar files of current directory and its sub-dirs.

Unix : 

find . -type f -name '*.jar' -print0 |  xargs -0 -I '{}' sh -c 'jar tf {} | grep com/sun/net/ssl/HostnameVerifier.class &&  echo {}'
find . -type f -name '*.jar' -print0 |  xargs -0 -I '{}' sh -c 'jar tf {} | grep HostnameVerifier.class &&  echo {}'
Ex :
[kg6378@bldv0014 jdk1.6.0_20]$ find . -type f -name '*.jar' -print0 |  xargs -0 -I '{}' sh -c 'jar tf {} | grep com/sun/net/ssl/HostnameVerifier.class &&  echo {}'
com/sun/net/ssl/HostnameVerifier.class
./jre/lib/jsse.jar

[kg6378@bldv0014 jdk1.6.0_20]$ find . -type f -name '*.jar' -print0 |  xargs -0 -I '{}' sh -c 'jar tf {} | grep HostnameVerifier.class &&  echo {}'
com/sun/deploy/security/CertificateHostnameVerifier.class
./jre/lib/deploy.jar
javax/net/ssl/HostnameVerifier.class
javax/net/ssl/HttpsURLConnection$DefaultHostnameVerifier.class
sun/net/www/protocol/https/DefaultHostnameVerifier.class
com/sun/net/ssl/HostnameVerifier.class
./jre/lib/jsse.jar

Windows : 


forfiles /S /M *.jar /C "cmd /c jar -tvf @file | findstr /C:"HostnameVerifier.class" && echo @path"


C:\Users\kg6378\Desktop\jdk-7u79-windows-x64\tools>cd C:\Krish\MyDocs\SWS\Jdk1.6
.0_14

C:\Krish\MyDocs\SWS\Jdk1.6.0_14>forfiles /S /M *.jar /C "cmd /c jar -tvf @file |
 findstr /C:"HostnameVerifier.class" && echo @path"

  3517 Thu May 21 09:19:20 EDT 2009 com/sun/deploy/security/CertificateHostnameV
erifier.class
"C:\Krish\MyDocs\SWS\Jdk1.6.0_14\jre\lib\deploy.jar"
   194 Thu Feb 05 13:54:20 EST 2009 javax/net/ssl/HostnameVerifier.class
   618 Thu Feb 05 13:54:22 EST 2009 javax/net/ssl/HttpsURLConnection$DefaultHost
nameVerifier.class
   384 Thu Feb 05 13:54:22 EST 2009 sun/net/www/protocol/https/DefaultHostnameVe
rifier.class
   272 Thu Feb 05 13:54:32 EST 2009 com/sun/net/ssl/HostnameVerifier.class
"C:\Krish\MyDocs\SWS\Jdk1.6.0_14\jre\lib\jsse.jar"

C:\Krish\MyDocs\SWS\Jdk1.6.0_14>





Read more


JBOSS - Profiles - socket binding - offset - Groups - Server

JBOSS - Profiles - socket binding - offset - Groups - Server

In JBOSS above are some common yet important terminology.

Each Server instance will fall under a group. It can follow its own socket binding.
Each group falls under a profile. Default , Full , Full-has etc

Based on socket binding default HTTP port and server offset we need to find out the server running http port. 

Read more


Caused by: org.jboss.modules.xml.XmlPullParserException: Failed to add resource root 'abc.jar' at path 'abc.jar' (position: END_TAG seen ...

Getting the below error ? Global modules classes not available ?

Caused by: org.jboss.modules.xml.XmlPullParserException: Failed to add resource root 'abc.jar' at path 'abc.jar' (position: END_TAG seen ...\n... @8:33) caused by: java.util.zip.ZipException: error in opening zip file
    at org.jboss.modules.ModuleXmlParser.parseResourceRoot(ModuleXmlParser.java:723) [jboss-modules.jar:1.3.3.Final-redhat-1]
    at org.jboss.modules.ModuleXmlParser.parseResources(ModuleXmlParser.java:572) [jboss-modules.jar:1.3.3.Final-redhat-1]
    at org.jboss.modules.ModuleXmlParser.parseModuleContents(ModuleXmlParser.java:394) [jboss-modules.jar:1.3.3.Final-redhat-1]
    at org.jboss.modules.ModuleXmlParser.parseDocument(ModuleXmlParser.java:219) [jboss-modules.jar:1.3.3.Final-redhat-1]
    at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:153) [jboss-modules.jar:1.3.3.Final-redhat-1]
    ... 18 more



Solution : This is just because your global module jar file is corrupted and can not be read. Delete and copy the jar properly.

More similar error : 
09:38:16,093 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.module.service."deployment.TestWebProj.war".main: org.jboss.msc.service.StartException in service jboss.module.service."deployment.TestWebProj.war".main: JBAS018759: Failed to load module: deployment.TestWebProj.war:main
    at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:91) [jboss-as-server-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913) [jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_95]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_95]
    at java.lang.Thread.run(Thread.java:682) [rt.jar:1.6.0_95]

Read more


JBOSS : WARs deployment shell script

Below is simple example of deploying the list of WARs from a props file and deploy into JBOSS.
---------Script 1 invokes script 2 and creates a log file---------
#!/bin/sh
datestr=$(date +%Y%m%d_%H%M%S)
./connectToCLLI.sh > AsocDeploymentLog_$datestr
-----------------------------------------------------------------------

----------SCRIPT 2 , reads props file and get the WAR file and Group information-------
#!/bin/ksh
echo "Setting JBOSS Env"
export JBOSS_HOME=/export/opt/jboss/jboss-eap-6.3
export JAVA_HOME=/opt/app/java/jdk/jdk160
export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin
export JB_CLI=$JBOSS_HOME/bin/jboss-cli.sh
DEPLOYMENT_HOST=`nslookup \`hostname\` |grep Name | awk '/:/{print $2}'`
export HOME_DIR=/pbcf/ctfr1603/

echo "JBOSS Environment is ready and connecting to CLLI"
allDeployed=0
for LINE in `cat deploymentDescABC.props | grep -v "#"`
{
 VAL1=`echo $LINE |cut -d '|' -f1 `
 GROUPS=`echo $LINE |cut -d '|' -f2 `
 export WAR_FILE=$HOME_DIR$VAL1
 echo "Deploying $WAR_FILE now"
 #export COMMANDS="connect,deploy $WAR_FILE --force,quit"
 export COMMANDS="connect,deploy $WAR_FILE --server-groups=$GROUPS,quit"
 echo "COMMANDS is $COMMANDS"
 if $JB_CLI -c --controller=$DEPLOYMENT_HOST:9999  --commands="$COMMANDS"
  then
       echo "Deployment successful for $WAR_FILE !!"
 else
       echo "Deployment failed for $WAR_FILE "
       allDeployed=1
       break
 fi
}
if [ $allDeployed = "0" ]
  then
       echo "Overall deployment of all WARs is successful"
else
       echo "Overall deployment FAILED !!"
fi 
 ---------------------------------------------------------------------------------------------------------

----------Sample Props file -------------
 # list of WARs for ASOC Module
/abc/def/MyTestwar|G2
/abc/def/YourTestwar|G2
All WARs done#
----------------------------------------------

Sample Deploy and undeploy commands : 
 [jboss@hex0015 bin]$ ./jboss-cli.sh --controller=hex0015.abc.com:9999
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
----------------------------
[disconnected /] connect
[domain@hex0015.abc.com:9999 /] deploy /ssd/etc/jboss_config/atp/csac/PressQuery.war --all-server-groups
[domain@hex0015.abc.com:9999 /]  undeploy PressQuery.war --all-relevant-server-groups
 

Read more


JBOSS start and stop shell scripts - domain mode - host controller - domain controller

 JBOSS start and stop shell scripts - domain mode - host controller - domain controller
===========START DOMAIN CONTROLLER MACHINE JBOSS=================
echo "Setting JBOSS Env"
export JAVA_HOME=/opt/app/java/jdk/jdk160
export PATH=$PATH:/opt/app/jboss/jboss-eap-6.3/bin:$JAVA_HOME/bin
echo "PATH is : $PATH"

echo "JBOSS Environment is ready and starting jboss in domain mode"
echo "MY:JAVA_OPTS: $JAVA_OPTS"
export JAVA_OPTS="$JAVA_OPTS -DASOCPropsFile=/abc/etc/abc.props -DLNSPropsFile=/pns/etc/pns.props -DAVSPropsFile=/bvs/etc/bvs.props -DEOTPropsFile=/toe/etc/toe.props -DLPSPropsFile=/psl/etc/psl.props -DADLPropsFile=/hfl/etc/hfl.props -Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true"
echo "MY AFTER:JAVA_OPTS: $JAVA_OPTS"

/export/opt/jboss/jboss-eap-6.3/bin/domain.sh -b cldv0015.abc.cpf.com -bmanagement cldv0015.abc.cpf.com &
=============================================
============START HOST CONTROLLER==========
=============================================

==========STOP JBOSS Process harshly==============
echo "Stopping JBOSS JAVA processes"

for i in `ps -eaf | grep jboss | grep java | cut -d " " -f6`
{
        kill -9 $i
    echo "Killing: $i"
}
ps -eaf | grep jboss | grep java
echo "Stop completed"
============================================

Read more

Translate

Enter your email address:

Buffs ...

Visitors


hits counter
View My StatsCheck Google Page Rank

Add to Google Reader or Homepage

Bookmark and Share

Tags


Powered by WidgetsForFree