This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes eclipse + postgreSQL + JBoss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "eclipse + postgreSQL + JBoss" Watch "eclipse + postgreSQL + JBoss" New topic

eclipse + postgreSQL + JBoss

Pragati Ogal

Joined: Apr 02, 2004
Posts: 2
I am using lomboz, eclipse, JBoss 3.2.3 and postgreSQL 7.4.1 for my J2EE project. I have configured JBoss to use postgreSQL as the database. When I run JBoss from the command line, I can see the jmx-console and can run my CMP EJBs. But when I do "debug server" from within eclipse, I get the following errors.
For jmx-console, I get the error:
HTTP Error 500
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: -1 in the jsp file: null

And in the server I see these exceptions:
22:39:29,334 INFO [EjbModule] Deploying AvailabilityCMP
22:39:29,444 INFO [EjbModule] Deploying ScreenNameFacade
22:39:29,504 INFO [EjbModule] Deploying AvailabilityFacade
22:39:30,275 ERROR [EntityContainer] Starting failed
org.jboss.deployment.DeploymentException: Error: can't find data source: java:/PostgresDS; - nested throwable: (javax.naming.NameNotFoundException: PostgresDS not bound)
at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.init(

In the jboss323.server file, I have:

name="JBOSS 3.2.3"
<property id="serverRootDirectory"
label="Application Server Directory:"
default="C:/jboss-3.2.3/" />
<property id="serverAddress"
default="" />
<property id="serverPort"
default="8080" />
<property id="serverConfig"
label="Server Configuration (minimal/default/all):"
default="all" />
<property id="classPathVariableName"
label="Classpath Variable Name:"
default="JBOSS323" />
<property id="classPath"
label="Classpath Variable:"
default="C:/jboss-3.2.3" />

and in the xdoclet.xml I have :
Please help me. Please suggest what I need to do. I am struggling with this problem for a long time now.
Ade Barkah
Ranch Hand

Joined: Mar 17, 2004
Posts: 65
For some reason the Postgresql datasource isn't getting deployed by the server. Were there any other Postgres related errors in the log on startup?
Make sure the basics are covered...
1) Check that you have a valid postgres-ds.xml file within the ./server/default/deploy directory:
postgres-ds.xml: (substitude own dbname, username & password)

2) Ensure that there is a copy of JBoss' JDBC library ('pg73jdbc3.jar' or newer) in ./server/default/lib.
3) Start the server manually and double check that the PostgresDS datasource gets deployed properly.
4) Make sure Eclipse is starting the instance at ./server/default and not some other instance.
-Ade Barkah

-Ade<br /><a href="" target="_blank" rel="nofollow"></a>
Amit Ghai
Ranch Hand

Joined: Mar 24, 2004
Posts: 35
Here is how to go about. hope this helps.

Procedure for configuring postgres database to the application in Jboss.
Same way can be used to configure other databases too.
Kindly note the changes are to take place in the JBOSS only.
A data source is a Java Naming and Directory Interface (JNDI) object used to obtain a connection from a connection pool to a database. The default data source configured with JBoss is the HypersonicDB data source. To use another database, you need to modify jaws.xml or standardjaws.xml.
standardjbosscmp-jdbc.xml is the standard deployment descriptor to configure the JBoss CMP container. It can be replaced with a custom configuration version, called jbosscmp-jdbc.xml. As before, this file goes in the META-INF directory of the EJB .jar file. And once again, JBoss defaults to a Hypersonic version, in this case HypersonicDB cmp. To use another database, we need to edit this file. For all the examples below I am taking amit as user and password is blank.
Postgres Configuration
PostGres is a very popular enterprise database used for its performance and reliability. To configure JBoss with PostGres, we first need to put PostGres 's driver classes in the CLASSPATH. Copy PostGres 's JDBC driver .jar file /jdbc/lib/ pg73jdbc3.jar to the server/default/lib directory.
To use PostGres 's data source, copy /docs/examples/jca/ postgres-ds.xml to the /server/default/deploy directory.
Next, we need to modify the postgres-ds.xml configuration file. The <driver-class/> and <connection-url/> settings for postgres are as follows:
<connection-url>jdbc ostgresql://</connection-url>;
Next, we modify the standardjaws.xml or jaws.xml configuration file. Set the <datasource> and <type-mapping> elements as follows:

Next, we modify the standardjbosscmp-jdbc.xml or jbosscmp-jdbc.xml configuration file, setting the <datasource> and <datasource-mapping> elements to use Postgres:

Finally, we need to modify login-config.xml to use Postgres. Add the following <application-policy> element to login-config.xml:
<application-policy name = "PostgresDbRealm">
<login-module code = ""
flag = "required">
<module-option name = "principal">amit</module-option>
<module-option name = "userName">amit</module-option>
<module-option name = "password"></module-option>
<module-option name =�managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=PostgresDS</module-option>
By modifying the postgres -ds.xml, standardjaws.xml, standardjbosscmp-jdbc.xml, and login-config.xml files, the JBoss server is configured to be used with a Postgres database.

JBoss Deployment Descriptors for EJBs
standardjaws.xml is the standard deployment descriptor for the mapping of Container Managed Persistence (CMP) entity EJBs. To use a custom configuration for mapping CMP entity EJBs, you use the jaws.xml file instead. In both cases, the file is copied to the META-INF directory of the EJB .jar file. Whichever file is used configures the following: Specify a data source and a type mapping for the data source.
Specify how tables are built/used.
Define finder methods to access the entity beans.
Define type mappings.

Reasonable people adapt themselves to the world. Unreasonable people attempt to adapt the world to themselves. All progress, therefore, depends on unreasonable people.
I agree. Here's the link:
subject: eclipse + postgreSQL + JBoss