Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

eclipse + postgreSQL + JBoss  RSS feed

Pragati Ogal
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Amit Ghai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!