Kumar, welcome to
Java Ranch!
First, it would help if you described the problem that you ran into, we could then provide advice concerning that particular issue. The general information you get from a "how to" question like yours only gives general advice and usually doesn't cover issues that you can run into.
Which exact version of JBoss AS 4? There are huge difference among the 4.0.x version and 4.2.x versions.
Have you installed
JBoss Tools? The JBoss Tools documentation can help you get started.
Also, why JBoss AS 4? All of those versions are very old.
You should be using either AS 6 or 7.
But here is a quick start guide:
In Eclipse, do File | New | Server then choose your version of JBoss AS from the menu. Then when you create an
EJB or dynamic web project, select that server. That's it for configuring JBoss AS in Eclipse. For Oracle, create a *-ds.xml file for you by you app. There are examples in jboss_home/docs/examples/jca.