[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.
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>
Just to avoid confusion, that ought to be "postgresql", not "posthresql"
Chris Smith
D'oh!
Thanks, Chris.
Marshall
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
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
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
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?
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.
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
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
That worked .... thanks! where did u find that information?
'
alex k.
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