[mule-user] NPE configuring embedded JDBC connector

1 view
Skip to first unread message

erich.oliphant

unread,
Apr 18, 2007, 3:55:23 PM4/18/07
to us...@mule.codehaus.org

Hi, I'm doing some R&D w/ v1.4 and trying to setup a JdbcConnector. I have
the following in my config (mixed spring-mule) file:
...
<connector name="jdbcConnector"
className="org.mule.providers.jdbc.JdbcConnector">
<properties>
<!--
<container-property name="dataSource" reference="dtsDataSource"/>
-->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<spring-property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</spring-property>
<spring-property name="url">
<value>
jdbc:oracle:thin:@192.168.103.69:1521:devl07
</value>
</spring-property>
<spring-property name="username">
<value>--</value>
</spring-property>
<spring-property name="password">
<value>--</value>
</spring-property>
</bean>
</properties>
</connector>
...
and I get the following exception at start up:
---
INFO 2007-04-18 13:19:05,444 [WrapperSimpleAppMain] org.mule.MuleManager:
Creating new MuleManager instance
INFO 2007-04-18 13:19:06,536 [WrapperSimpleAppMain]
org.mule.providers.jdbc.JdbcConnector: Initialising:
JdbcConnector{this=1f01a29
, started=false, initialised=false, name='jdbcConnector', disposed=false,
numberOfConcurrentTransactedReceivers=4, createMultipleTra
nsactedReceivers=true, connected=false, supportedProtocols=[jdbc],
serviceOverrides=null}
ERROR 2007-04-18 13:19:06,566 [WrapperSimpleAppMain] org.mule.MuleServer:
********************************************************************************
Message : Failed to create Jdbc Connector
Type : org.mule.umo.lifecycle.InitialisationException
Code : MULE_ERROR-72065
JavaDoc :
http://mule.mulesource.org/docs/apidocs/org/mule/umo/lifecycle/InitialisationException.html
********************************************************************************
Exception stack is:
1. null (java.lang.NullPointerException)
javax.naming.InitialContext:228
(http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NullPointerException.html)
2. Failed to create Jdbc Connector
(org.mule.umo.lifecycle.InitialisationException)
org.mule.providers.jdbc.JdbcConnector:126
(http://mule.mulesource.org/docs/apidocs/org/mule/umo/lifecycle/InitialisationException.
html)
********************************************************************************
Root Exception stack trace:
java.lang.NullPointerException
at javax.naming.InitialContext.getURLScheme(InitialContext.java:228)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:277)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at
org.mule.providers.jdbc.JdbcConnector.createDataSource(JdbcConnector.java:211)
---

Looks like it's still trying to look something up. Shouldn't this be
skipped as I'm injecting the dataSource ?
--
View this message in context: http://www.nabble.com/NPE-configuring-embedded-JDBC-connector-tf3603010.html#a10065650
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Andrew Perepelytsya

unread,
Apr 18, 2007, 7:54:15 PM4/18/07
to us...@mule.codehaus.org
Erich,

I'm not sure you're injecting it properly. Did the commented out snippet work for you? Next, shouldn't it rather be <property name="dataSource"> with a nested <bean> definition?

Andrew

erich.oliphant

unread,
Apr 19, 2007, 2:25:38 PM4/19/07
to us...@mule.codehaus.org

Hi Andrew,
No the <container-property> didn't work if I put the <bean> definition at
the end of the file per the DTD. That's why I tried the 'embedded' version.
For this I was looking at these examples on the site:
---
<mule-descriptor name="test" implementation="testObject">
<properties>
<bean name="bar" class="org.foo.BarFactory"
factory-method="createBar">
<constructor-arg index="0">
<value>cocktail</value>
</constructor-arg>
</bean>
</properties>
</mule-descriptor>


<connector name="jmsconnector"
className"org.mule.providers.jms.JmsConnector">
<properties>
<!-- defining a spring property directly -->
<spring-property name="jndiContext">
<ref local="myJndicontext"/>
</spring-property>

<!-- you can also just nest bean elements -->
<bean name="connectionFactory"
class="org.foo.jms.provider.ConnectionFactory"/>

<!-- and you can still use normal Mule propery elements -->
<property name=jndiDestinations" value="true"/>
</properties>
</connector>
---

From these examples it looks like the <bean> automagically becomes a
<property>, and the DTD validation is not complaining. So I thought that
this would work. Will try the <property></bean></property>.

I'm looking at the loan-broker-bpm-mule-config.xml from the examples, it
uses a JBPM connector that references a <bean> defined later in the file but
uses the <spring-property><ref/></spring-property> to snag it. I will try
that as well.

But in any case, still wondering if the 'embedded' bean should be working as
is, or I'm missing something or the docs need to be updated.

Thanks!

--
View this message in context: http://www.nabble.com/NPE-configuring-embedded-JDBC-connector-tf3603010.html#a10084089

erich.oliphant

unread,
Apr 19, 2007, 2:54:15 PM4/19/07
to us...@mule.codehaus.org

Well, I know what the problem is, but not how to fix it. I tried using
<spring-property> referencing another bean, got the same error. I tried
nesting within a <property>didn't like that either cause <property>.

We'll for fun I just changed the bean class name to a non-existent class
(just removed the last character), got the same error, no
ClassNotFoundException about the <bean> class. So looks like the <bean> is
never initialized so JdbcConnector.dataSource is in fact null when
doInitialize is called. Now just trying to figure out why.

Any ideas?

--
View this message in context: http://www.nabble.com/NPE-configuring-embedded-JDBC-connector-tf3603010.html#a10084680

erich.oliphant

unread,
Apr 19, 2007, 3:07:50 PM4/19/07
to us...@mule.codehaus.org

Ok, It's solved, sort of. I am testing this from the command-line and
apparently you need to use '-builder spring' as an option, but I'm surprised
that mule didn't complain about the DTD and/or the invalid tags.

Using '-builder spring' works if you use <spring-property> but it still
doesn't seem to work when the <bean> is defined directly in the
<properties>.

Thanks for your help!

--
View this message in context: http://www.nabble.com/NPE-configuring-embedded-JDBC-connector-tf3603010.html#a10084928

Reply all
Reply to author
Forward
0 new messages