Sunday, August 8, 2010

PermGen Space eclipse


One of the reason is due to changes in "Java 6u21 distribution"

The change was done in "java.dll" to replace "Sun MicroSystems" to "Oracle Corporation"

Solutions :

1, Degrade to java 6u20 version

2, modify PermGen Space by starting eclipse with "-vmargs -XX:PermSize=64M -XX:MaxPermSize=128M" as options

Ex: eclipse -vmargs -XX:PermSize=64M -XX:MaxPermSize=128M


Postgresql ReStore Command

1, In Windows XP, Go to “All Programs” --> “Postgresql” --> “psql”

2, Accept default settings and you will get prompt like “postgres-#

3, Postgresql has its own utility for Restore called “psql”.

The most common options used are :

1, -d --> database name

2, -U --> user of the database(default is postgres)

3, -f --> backup (*.dmp) file

Syntax : psql [options]

Ex: To restore “archive1.dmp” into a database “mydatabase”,

Run the commands below .

A, create database mydatabase

B,psql –d mydatabase –U postgres –f “E:\archive1.dmp

Postgresql BackUp Command

1, In Windows XP, Go to Run , type cmd to open Command Prompt

2, Go to the Bin directory inside the Postgresql Installation directory

For EX : E:\workdir\Postgresql\bin

3, Postgresql has its own utility for BackUp called “pg_dump”.

The most common options used are :

1, -h à localhost (hostname)

2, -p à port (default is 5432)

3, -U à user of the database(default is postgres)

4, -f à output backup file name with location

Syntax : pg_dump [options] [databasename]

Ex: To backup “mydatabase” into a file “archive1.dmp” in location “E:\” ,

Use pg_dump -h localhost -p 5432 -U postgres –f “E:\archive1.dmpmydatabase

Sunday, July 25, 2010

Configuring JBoss server in Eclipse

1.Open eclipse -->select server windows --> right click -->New Server
2.Select Jboss As 5.1 under Jboss community in New server popup window-->click next
3.Configure the Home Dirctory as E:\BonAppetit_Product\jboss-5.1.0.GA
4.select server as default-->Click Finish

Steps to Create and Deploy a Prototype Application

Lets see how to do Rapid Application Development from existing database using Seam - Gen tool provided by seam

1, open command prompt and go to the location where seam is extracted
ex : D:\BonAppetit_Product\jboss-seam-2.2.0.GA

2, if you get problem :The JAVA_HOME environment variable should point to a JDK, not a JRE
solution : right-click "My computer", Properties ->Advanced Tab -> Environmental Variables,
and click "New" button to add JAVA_HOME environmental variable .

Provide following values:
a, variable name : JAVA_HOME
b, variable value : (for ex:) C:\Program Files\Java\jdk1.6.0_21

and click ok and do step-1 again .

3, type "seam setup" command and do as defined below :

[echo] Welcome to seam-gen :-)
[input] Enter your Java project workspace (the directory that contains
your Seam projects) [C:/Projects] [C:/Projects]
D:\BonAppetit_Product\Eclipse\Workspace_BonAppetit_Product

[input] Enter your JBoss home directory [C:/Program Files/jboss-4.2.2.GA]
[C:/Program Files/jboss-4.2.2.GA]
D:\BonAppetit_Product\jboss-5.1.0.GA

[input] Enter the project name [myproject] [myproject]
BonPro
[echo] Accepted project name as: BonPro

[input] Do you want to use ICEfaces instead of RichFaces [n] (y, [n])
n

[input] Select a RichFaces skin [blueSky] ([blueSky],
classic, ruby, wine, deepMarine, emeraldTown, japanCherry, DEFAULT)
emeraldTown

[input] Is this project deployed as an EAR (with EJB
components) or a WAR (with no EJB support) [ear] ([ear], war)
ear

[input] Enter the Base package name for your Java Classes
[com.mydomain.Bonpro] [com.mydomain.Bonpro]
com.Bonpro

[input] Enter the Java package name for your session
beans [com.Bonpro.action] [com.Bonpro.action]
com.Bonpro.action

[input] Enter the Java package name for your entity beans
[com.Bonpro.model] [com.Bonpro.model]
com.Bonpro.model

[input] Enter the Java package name for your test cases
[com.Bonpro.action.test] [com.Bonpro.action.test]
com.Bonpro.test

[input] What kind of database are you using? [hsql] ([hsql], mysql,
oracle, postgres, mssql, db2, sybase, enterprisedb, h2)
postgres

[input] Enter the Hibernate dialect for your database
[org.hibernate.dialect.PostgreSqlDialect] [org.hibernate.dialect.PostgreSqlDialect]
Hit Enter key (automatically generated one !!!)

[input] Enter the filesystem path to the JDBC driver jar [lib/h2.jar]
D:\BonAppetit_Product\jboss-5.1.0.GA\postgresql-8.4-701.jdbc4.jar

[input] Enter JDBC driver class for your database [org.h2.Driver]
[org.postgresql.Driver]
Hit Enter key (automatically generated one !!!)

[input] Enter the JDBC URL for your database [jdbc:postgresql:.] [jdbc:postgresql:.]
jdbc:postgresql:sample
(format : jdbc:postgreql:database name)

[input] Enter database username [sa] [sa]
postgres

[input] Enter database password [] []
postgres

[input] Enter the database schema name (it's OK to leave it blank) [] []
Hit Enter key (automatically generated one !!!)

[input] Enter the database catalog name (it's OK to leave it blank) [] []
Hit Enter key (automatically generated one !!!)

[input] Are you working with tables that already exist in the database?
[n] (y, [n])
y

[input] Do you want to drop and re-create the database tables and data in
import.sql each time you deploy? [n] (y, [n])
n

[propertyfile] Creating new property file:
D:\BonAppetit_Product\jboss-seam-2.2.0.GA/seam-gen/build.properties
[echo] Installing JDBC driver jar to JBoss server
[copy] Copying 1 file to
D:\BonAppetit_Product\jboss-5.1.0.GA\server\default\lib
[echo] Type 'seam create-project' to create the new project
BUILD SUCCESSFUL

Now, you had configured settings for the project. To create project , go to next step .

4, Now type 'seam create-project' and it will create a new project for you in the workspace location provided by you in the above step

5, Now open eclipse -> New -> General - > Existing Projects into WorkSpace -> Select root Directory (as given by you in step - 3) -> Finish

6, Once imported, the project will automatically build and will get deployed in the JBoss server.

7. Now start the JBoss server and browse following URL :
(for ex :) http://localhost:8080/BonPro(Project name provided by you in step-3)
(format : http://localhost:8080/project-name)

Now we have created a sample prototype application
using seam-gen from an existing database !!!

Configuring JBoss Tools in Eclipse

1, Go the website : http://labs.jboss.com/tools/download.html

2, Choose latest stable release under update sites and copy the link:
for ex: http://download.jboss.org/jbosstools/updates/stable/galileo/

3, open eclipse -> Help -> Install New Software -> Add ..

4, provide following information in the "Add site" window came now .

a, Name : Jboss Tools (any name as you wish)
b, Location : http://download.jboss.org/jbosstools/updates/stable/galileo/ (url copied in step 2)

5, Choose "All JBoss Tools" and Click "Next" -> "I accept the terms and conditions" -> Finish

Now JBoss Tools are getting Configured into the Eclipse IDE !!!