Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with JBoss/PostgreSQL XADatasource Error

8 views
Skip to first unread message

tom

unread,
Sep 17, 2001, 10:16:43 AM9/17/01
to
I have been successfully working with Struts/Tomcat/Apache. I'm
trying to add in JBoss and PostgreSQL. When I start JBoss the
following error appears in server.log:

[XADataSourceLoader] Starting
[Test] XA Connection pool Test bound to java:/Test
[XADataSourceLoader] Stopped
java.lang.NullPointerException
at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:178)
at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:407)
at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:107)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:836)
at $Proxy0.start(Unknown Source)
at org.jboss.util.ServiceControl.start(ServiceControl.java:81)
at java.lang.reflect.Method.invoke(Native Method)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
at org.jboss.Main.<init>(Main.java:210)
at org.jboss.Main$1.run(Main.java:116)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.Main.main(Main.java:112)

I'm using JBoss 2.4.1, PostgreSQL 7.1.3, Tomcat 3.2.3, Apache 1.3.20,
Struts 1.0, JDK 1.3.1. If anybody has any ideas on this I'd love to
hear them.

Nils O. Selåsdal

unread,
Sep 17, 2001, 10:20:31 AM9/17/01
to
On 17 Sep 2001 07:16:43 -0700, tom wrote:
> I have been successfully working with Struts/Tomcat/Apache. I'm
> trying to add in JBoss and PostgreSQL. When I start JBoss the
> following error appears in server.log:
>
> [XADataSourceLoader] Starting
> [Test] XA Connection pool Test bound to java:/Test
> [XADataSourceLoader] Stopped
> java.lang.NullPointerException
> at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:178)
> I'm using JBoss 2.4.1, PostgreSQL 7.1.3, Tomcat 3.2.3, Apache 1.3.20,
> Struts 1.0, JDK 1.3.1. If anybody has any ideas on this I'd love to
> hear them.
Could you perhaps post the configuration of the 'Test' datasource ?

Marshall Spight

unread,
Sep 17, 2001, 1:45:15 PM9/17/01
to
"tom" <tom.mar...@Popmanager.com> wrote in message
news:31c4e117.01091...@posting.google.com...

> I have been successfully working with Struts/Tomcat/Apache. I'm
> trying to add in JBoss and PostgreSQL. When I start JBoss the
> following error appears in server.log:
>
> [XADataSourceLoader] Starting
> [Test] XA Connection pool Test bound to java:/Test

You're in luck, dude; I was working on this just yesterday.

If you configure jboss.jcml for Postgres as per the directions in the
documentation,
you're hosed.

To make it work, I found I needed to set up Postgres as the default
datasource.
("DefaultDS") If you use the data source class given in the documentation,
it won't work; use the below instead.

Be sure that the URL is set correctly. It should be
jdbc:posthresql://xxx/yyy

where xxx is the hostname, and yyy is the database name.

Be sure to create the database first.

Also, you must alter the JDBCUser and Password approriately.
(The ones I included here are made-up; not what I really use.)

<mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
<attribute name="Drivers">org.postgresql.Driver</attribute>
</mbean>

<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=DefaultDS">
<attribute
name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attr
ibute>
<attribute name="PoolName">DefaultDS</attribute>
<attribute name="URL">jdbc:postgresql://dbserver/jboss</attribute>
<attribute name="JDBCUser">happyboy</attribute>
<attribute name="Password">securesecret</attribute>
</mbean>

Chris Smith

unread,
Sep 17, 2001, 1:52:15 PM9/17/01
to
Marshall Spight wrote ...

> Be sure that the URL is set correctly. It should be
> jdbc:posthresql://xxx/yyy

Just to avoid confusion, that ought to be "postgresql", not "posthresql"

Chris Smith

Marshall Spight

unread,
Sep 17, 2001, 2:01:12 PM9/17/01
to
"Chris Smith" <cds...@twu.net> wrote in message
news:MPG.160fe63d2...@news.altopia.com...

D'oh!

Thanks, Chris.


Marshall

tom

unread,
Sep 17, 2001, 3:07:56 PM9/17/01
to
nose...@frisurf.no (Nils O. Selåsdal wrote in message news:<PEnp7.18697$1T5.2...@news1.oke.nextra.no>...

Here's what I have in jboss.jcml:

<mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">

<attribute nmae="Drivers">org.postgresql.Driver</attribute>
</mbean>

<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=PostgreSQL">
<attribute name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attribute>
<attribute name="PoolName">Test</attribute>
<attribute name="URL">jdbc:postgresql:test</attribute>
<attribute name="JDBCUser">postgres</attribute>
<attribute name="Password">postgres</attribute>
</mbean>

Thanks

Marshall Spight

unread,
Sep 17, 2001, 3:48:30 PM9/17/01
to
"tom" <tom.mar...@Popmanager.com> wrote in message
news:31c4e117.01091...@posting.google.com...
> Here's what I have in jboss.jcml:
>
> <mbean code="org.jboss.jdbc.JdbcProvider"
> name="DefaultDomain:service=JdbcProvider">
> <attribute nmae="Drivers">org.postgresql.Driver</attribute>
> </mbean>

That's cool.


> <mbean code="org.jboss.jdbc.XADataSourceLoader"
> name="DefaultDomain:service=XADataSource,name=PostgreSQL">
> <attribute
name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attr
ibute>
> <attribute name="PoolName">Test</attribute>
> <attribute name="URL">jdbc:postgresql:test</attribute>
> <attribute name="JDBCUser">postgres</attribute>
> <attribute name="Password">postgres</attribute>
> </mbean>

For one thing, you URL is malformed. It should be of the form

jdbc:postgresql://servername/database

Where "servername" is replaced with the name of the database server,
and "database" is replaced with the name of the database.

I also set the "name" attribute to be "defaultDS" which I would assume
makes this the default datasource. Without this it seemed to acknowledge
my datasource, but still be configured to use hypersonic or some such
for CMP, etc.


Marshall

Chris Smith

unread,
Sep 17, 2001, 5:00:12 PM9/17/01
to
Marshall Spight wrote ...

> "tom" <tom.mar...@Popmanager.com> wrote in message
> news:31c4e117.01091...@posting.google.com...
> > Here's what I have in jboss.jcml:
> >
> > <mbean code="org.jboss.jdbc.JdbcProvider"
> > name="DefaultDomain:service=JdbcProvider">
> > <attribute nmae="Drivers">org.postgresql.Driver</attribute>
> > </mbean>
>
> That's cool.

Aside from the type: nmae instead of name... this is definitely a concern
if the code here is cut-and-paste directly from the original (which it
should be).

> For one thing, you URL is malformed. It should be of the form
>
> jdbc:postgresql://servername/database
>
> Where "servername" is replaced with the name of the database server,
> and "database" is replaced with the name of the database.

The PostgreSQL drivers allow you to omit that part if the database is
running on the default port (configurable at build) on localhost. The
URL jdbc:postgresql:test refers to the test database on localhost.

> I also set the "name" attribute to be "defaultDS" which I would assume
> makes this the default datasource. Without this it seemed to acknowledge
> my datasource, but still be configured to use hypersonic or some such
> for CMP, etc.

This could definitely be it.

Chris Smith

tom

unread,
Sep 18, 2001, 10:19:20 AM9/18/01
to
"Marshall Spight" <msp...@dnai.com> wrote in message news:<ITqp7.17039$L%5.138...@news1.rdc1.sfba.home.com>...


Let me first say thanks for all your input. I have applied all of your
suggestions above and still get the same result. Talk about
frustrating. Anymore ideas? Anyone?

tom

unread,
Sep 18, 2001, 10:32:34 AM9/18/01
to
"Marshall Spight" <msp...@dnai.com> wrote in message news:<ITqp7.17039$L%5.138...@news1.rdc1.sfba.home.com>...

Ok gang, give me the dufus award of the week. It really helps when
you remember the -i option when running postmaster. Now if I could
only remember what I really wanted to do before this I wasted 3 days
trying to figure this out. Again thanks for the assist.

Alex K.

unread,
Sep 20, 2001, 2:47:25 AM9/20/01
to
Hello,

I get the following error when i try to instantiate postgres pool
[DefaultDS] XA Connection pool DefaultDS bound to java:/DefaultDS

[XADataSourceLoader] Stopped

java.lang.NullPointerException

at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(XAPoolDataSource.java:178)

at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:407)

at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:107)

at java.lang.reflect.Method.invoke(Native Method)

at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)

at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)

at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:836)

at $Proxy0.start(Unknown Source)

at org.jboss.util.ServiceControl.start(ServiceControl.java:81)

at java.lang.reflect.Method.invoke(Native Method)

at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)

at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)

at org.jboss.Main.<init>(Main.java:210)

at org.jboss.Main$1.run(Main.java:116)

at java.security.AccessController.doPrivileged(Native Method)

at org.jboss.Main.main(Main.java:112)

Bellow is jboss.jcml part:

<mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">

<attribute name="Drivers">org.postgresql.Driver</attribute>
</mbean>

<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=DefaultDS">


<attribute name="DataSourceClass">org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl</attribute>

<attribute name="PoolName">DefaultDS</attribute>
<attribute name="URL">jdbc:postgresql://localhost:5432/db</attribute>
<attribute name="JDBCUser">user</attribute>
<attribute name="Password"></attribute>
<attribute name="MinSize">3</attribute>

</mbean>

the interesting thing is that when i connect manually, i.e. i wrote a
test client to make sure that i could connect, it connects fine. i can
see in the postgres logs that something is connecting. but i don't see
that jboss even tries to connect.

I started ipc-daemon.exe and my postmaster with postmaster -i option.

any ideas?
I looked at this discussion, followed all of the suggestions, but
still no luck:
http://groups.google.com/groups?hl=en&threadm=31c4e117.0109170616.2a83987b%40posting.google.com&rnum=1&prev=/groups%3Fq%3Dorg.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection%26hl%3Den%26rnum%3D1%26selm%3D31c4e117.0109170616.2a83987b%2540posting.google.com

Marshall Spight

unread,
Sep 20, 2001, 3:32:26 AM9/20/01
to
"Alex K." <kor...@zdnetmail.com> wrote in message
news:99fb7937.01091...@posting.google.com...

> Hello,
>
> I get the following error when i try to instantiate postgres pool
> [DefaultDS] XA Connection pool DefaultDS bound to java:/DefaultDS
>

The problem is that you have not supplied a password. You have
to supply a password.

I know it sounds like I'm daft here, but you really do have to have
some text in here: <attribute name="Password"></attribute> won't
work with postgres under any circumstances.

If postgres is configured for "trust" from this address, you
can put whatever you want.

<attribute name="Password">foo</attribute>


As I say, it sounds ridiculous. Try it.


Marshall

Alex K.

unread,
Sep 20, 2001, 8:47:59 AM9/20/01
to
Hey Marshall,

That worked .... thanks! where did u find that information?
'
alex k.

Marshall Spight

unread,
Sep 20, 2001, 12:33:31 PM9/20/01
to
"Alex K." <kor...@zdnetmail.com> wrote in message
news:99fb7937.01092...@posting.google.com...

> Hey Marshall,
>
> That worked .... thanks! where did u find that information?


http://www.jboss.org/documentation/HTML/ch04s11.html

Good luck!

One gripe about their docs: tiny fonts specified in their
stylesheets. What I did was scarf the whole documentation
website, and edit their .css file to remove all font
size specifications. Worked like a charm!


Marshall

0 new messages