You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Dain Sundstrom <da...@iq80.com> on 2007/12/23 01:47:39 UTC

Connector element in openejb.xml not working?

While hacking on an example, I ran into this weird case... I cloned  
the current data source declarations in the openejb.xml file and  
modified them as follows:

<Connector id="DainDataSource" type="DataSource">
   JdbcDriver org.hsqldb.jdbcDriver
   JdbcUrl jdbc:hsqldb:file:hsqldb
   UserName sa
   Password
   JtaManaged true
</Connector>

<Connector id="NonJtaDainDataSource" type="DataSource">
   JdbcDriver org.hsqldb.jdbcDriver
   JdbcUrl jdbc:hsqldb:file:hsqldb
   UserName sa
   Password
   JtaManaged false
</Connector>

I assume this should give me a managed DainDataSource and an  
unmanaged NonJtaDainDataSource.  When I deploy I get this exception:

2007-12-22 18:20:13,144 - ERROR - FATAL ERROR: Unknown error in  
Assembler.  Please send the following stack trace and this message to  
user@openejb.org :
  java.lang.NullPointerException
         at org.apache.openejb.config.ConfigurationFactory 
$DefaultService.access$000(ConfigurationFactory.java:434)
         at  
org.apache.openejb.config.ConfigurationFactory.getDefaultService 
(ConfigurationFactory.java:481)
         at  
org.apache.openejb.config.ConfigurationFactory.resolveServiceProvider 
(ConfigurationFactory.java:555)
         at  
org.apache.openejb.config.ConfigurationFactory.configureService 
(ConfigurationFactory.java:496)
         at  
org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration 
(ConfigurationFactory.java:267)
         at org.apache.openejb.assembler.classic.Assembler.build 
(Assembler.java:242)
         at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:149)
         at org.apache.openejb.OpenEJB.init(OpenEJB.java:293)
         at org.apache.openejb.tomcat.TomcatLoader.init 
(TomcatLoader.java:115)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.openejb.loader.Embedder.init(Embedder.java:60)
         at org.apache.openejb.loader.OpenEJBListener.init 
(OpenEJBListener.java:87)
         at org.apache.openejb.loader.OpenEJBListener.lifecycleEvent 
(OpenEJBListener.java:62)
         at  
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent 
(LifecycleSupport.java:117)
         at org.apache.catalina.core.StandardServer.initialize 
(StandardServer.java:767)
         at org.apache.catalina.startup.Catalina.load(Catalina.java:518)
         at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java: 
260)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 
412)


Once that exception happens, nothing else works.  Then I realized the  
elements should be named "Resource" instead of "Connector", and when  
I made that change it started working?  Anyone have an idea on why  
the legacy name "Connector" would cause an exception?  Also, should  
we update all openejb.xml files in out tree to not use the  
"Connector" element?

-dain


Re: Connector element in openejb.xml not working?

Posted by David Blevins <da...@visi.com>.
On Dec 25, 2007, at 12:13 PM, Dain Sundstrom wrote:

> On Dec 22, 2007, at 7:56 PM, David Blevins wrote:
>
>> On Dec 22, 2007, at 4:47 PM, Dain Sundstrom wrote:
>>
>>> While hacking on an example, I ran into this weird case... I  
>>> cloned the current data source declarations in the openejb.xml  
>>> file and modified them as follows:
>>>
>>> <Connector id="DainDataSource" type="DataSource">
>>> JdbcDriver org.hsqldb.jdbcDriver
>>> JdbcUrl jdbc:hsqldb:file:hsqldb
>>> UserName sa
>>> Password
>>> JtaManaged true
>>> </Connector>
>>>
>>> <Connector id="NonJtaDainDataSource" type="DataSource">
>>> JdbcDriver org.hsqldb.jdbcDriver
>>> JdbcUrl jdbc:hsqldb:file:hsqldb
>>> UserName sa
>>> Password
>>> JtaManaged false
>>> </Connector>
>>>
>>> <snip/>
>>
>> It should be fine.  We simply convert the Connector element to a  
>> Resource element, right around line 254 of ConfigurationFactory.
>>
>> I moved the code into the Openejb jaxb object using your lazy  
>> conversion/private getter trick.
>>
>> Connector should work, but I updated our default.openejb.conf to  
>> use the Resource tag, which is the one we want people to use.
>
> Did you try the example above?

No.  I did and found that we weren't converting the type attribute.   
Fixed!

-David


Re: Connector element in openejb.xml not working?

Posted by Dain Sundstrom <da...@iq80.com>.
On Dec 26, 2007, at 1:43 PM, David Blevins wrote:

>
> On Dec 25, 2007, at 11:24 PM, Mohammad Nour El-Din wrote:
>
>> Do we really support the Java Connector Architecture (JCA) specs,  
>> or this is
>> an OpenEJB specific kind of implementation ???
>
> Yes.  We use the Geronimo connector jar for everything but  
> DataSources, for those we use commons-dbcp.  You can configure your  
> JCA connector via the <Resource> or <Connector> tag (as opposed to  
> deploying it as a rar file) which is OpenEJB specific.  Note use fo  
> the <Resource> tag is not limited to connectors.  Just about  
> anything you can depend on via @Resource you can configure via  
> <Resource>.

We also support rar modules.  I added this while attempting to  
isolate ActiveMQ to a private class loader, but never finished the  
ActiveMQ part :)   Anyway, if you deploy a rar we create a MDB  
container for each inbound connector, bind a connector to global JNDI  
for each outbound, and bind an admin object instance for each  
declared admin object.  Basically, it just works :)

I think with AMQ 5 out, I'm going to need to finish my isolation of  
of AMQ work so we can easily swap between 4 and 5.

-dain

Re: Connector element in openejb.xml not working?

Posted by David Blevins <da...@visi.com>.
On Dec 25, 2007, at 11:24 PM, Mohammad Nour El-Din wrote:

> Do we really support the Java Connector Architecture (JCA) specs, or  
> this is
> an OpenEJB specific kind of implementation ???

Yes.  We use the Geronimo connector jar for everything but  
DataSources, for those we use commons-dbcp.  You can configure your  
JCA connector via the <Resource> or <Connector> tag (as opposed to  
deploying it as a rar file) which is OpenEJB specific.  Note use fo  
the <Resource> tag is not limited to connectors.  Just about anything  
you can depend on via @Resource you can configure via <Resource>.

-David


>
>
> On Dec 25, 2007 3:13 PM, Dain Sundstrom <da...@iq80.com> wrote:
>
>> On Dec 22, 2007, at 7:56 PM, David Blevins wrote:
>>
>>> On Dec 22, 2007, at 4:47 PM, Dain Sundstrom wrote:
>>>
>>>> While hacking on an example, I ran into this weird case... I
>>>> cloned the current data source declarations in the openejb.xml
>>>> file and modified them as follows:
>>>>
>>>> <Connector id="DainDataSource" type="DataSource">
>>>> JdbcDriver org.hsqldb.jdbcDriver
>>>> JdbcUrl jdbc:hsqldb:file:hsqldb
>>>> UserName sa
>>>> Password
>>>> JtaManaged true
>>>> </Connector>
>>>>
>>>> <Connector id="NonJtaDainDataSource" type="DataSource">
>>>> JdbcDriver org.hsqldb.jdbcDriver
>>>> JdbcUrl jdbc:hsqldb:file:hsqldb
>>>> UserName sa
>>>> Password
>>>> JtaManaged false
>>>> </Connector>
>>>>
>>>> <snip/>
>>>
>>> It should be fine.  We simply convert the Connector element to a
>>> Resource element, right around line 254 of ConfigurationFactory.
>>>
>>> I moved the code into the Openejb jaxb object using your lazy
>>> conversion/private getter trick.
>>>
>>> Connector should work, but I updated our default.openejb.conf to
>>> use the Resource tag, which is the one we want people to use.
>>
>> Did you try the example above?  Also, maybe we should log a
>> deprecated warning if someone uses the connector element.
>>
>> -dain
>>
>
>
>
> -- 
> Thanks
> - Mohammad Nour


Re: Connector element in openejb.xml not working?

Posted by Mohammad Nour El-Din <no...@gmail.com>.
Do we really support the Java Connector Architecture (JCA) specs, or this is
an OpenEJB specific kind of implementation ???

On Dec 25, 2007 3:13 PM, Dain Sundstrom <da...@iq80.com> wrote:

> On Dec 22, 2007, at 7:56 PM, David Blevins wrote:
>
> > On Dec 22, 2007, at 4:47 PM, Dain Sundstrom wrote:
> >
> >> While hacking on an example, I ran into this weird case... I
> >> cloned the current data source declarations in the openejb.xml
> >> file and modified them as follows:
> >>
> >> <Connector id="DainDataSource" type="DataSource">
> >>  JdbcDriver org.hsqldb.jdbcDriver
> >>  JdbcUrl jdbc:hsqldb:file:hsqldb
> >>  UserName sa
> >>  Password
> >>  JtaManaged true
> >> </Connector>
> >>
> >> <Connector id="NonJtaDainDataSource" type="DataSource">
> >>  JdbcDriver org.hsqldb.jdbcDriver
> >>  JdbcUrl jdbc:hsqldb:file:hsqldb
> >>  UserName sa
> >>  Password
> >>  JtaManaged false
> >> </Connector>
> >>
> >> <snip/>
> >
> > It should be fine.  We simply convert the Connector element to a
> > Resource element, right around line 254 of ConfigurationFactory.
> >
> > I moved the code into the Openejb jaxb object using your lazy
> > conversion/private getter trick.
> >
> > Connector should work, but I updated our default.openejb.conf to
> > use the Resource tag, which is the one we want people to use.
>
> Did you try the example above?  Also, maybe we should log a
> deprecated warning if someone uses the connector element.
>
> -dain
>



-- 
Thanks
- Mohammad Nour

Re: Connector element in openejb.xml not working?

Posted by Dain Sundstrom <da...@iq80.com>.
On Dec 22, 2007, at 7:56 PM, David Blevins wrote:

> On Dec 22, 2007, at 4:47 PM, Dain Sundstrom wrote:
>
>> While hacking on an example, I ran into this weird case... I  
>> cloned the current data source declarations in the openejb.xml  
>> file and modified them as follows:
>>
>> <Connector id="DainDataSource" type="DataSource">
>>  JdbcDriver org.hsqldb.jdbcDriver
>>  JdbcUrl jdbc:hsqldb:file:hsqldb
>>  UserName sa
>>  Password
>>  JtaManaged true
>> </Connector>
>>
>> <Connector id="NonJtaDainDataSource" type="DataSource">
>>  JdbcDriver org.hsqldb.jdbcDriver
>>  JdbcUrl jdbc:hsqldb:file:hsqldb
>>  UserName sa
>>  Password
>>  JtaManaged false
>> </Connector>
>>
>> <snip/>
>
> It should be fine.  We simply convert the Connector element to a  
> Resource element, right around line 254 of ConfigurationFactory.
>
> I moved the code into the Openejb jaxb object using your lazy  
> conversion/private getter trick.
>
> Connector should work, but I updated our default.openejb.conf to  
> use the Resource tag, which is the one we want people to use.

Did you try the example above?  Also, maybe we should log a  
deprecated warning if someone uses the connector element.

-dain

Re: Connector element in openejb.xml not working?

Posted by David Blevins <da...@visi.com>.
On Dec 22, 2007, at 4:47 PM, Dain Sundstrom wrote:

> While hacking on an example, I ran into this weird case... I cloned  
> the current data source declarations in the openejb.xml file and  
> modified them as follows:
>
> <Connector id="DainDataSource" type="DataSource">
>  JdbcDriver org.hsqldb.jdbcDriver
>  JdbcUrl jdbc:hsqldb:file:hsqldb
>  UserName sa
>  Password
>  JtaManaged true
> </Connector>
>
> <Connector id="NonJtaDainDataSource" type="DataSource">
>  JdbcDriver org.hsqldb.jdbcDriver
>  JdbcUrl jdbc:hsqldb:file:hsqldb
>  UserName sa
>  Password
>  JtaManaged false
> </Connector>
>
> I assume this should give me a managed DainDataSource and an  
> unmanaged NonJtaDainDataSource.  When I deploy I get this exception:
>
> 2007-12-22 18:20:13,144 - ERROR - FATAL ERROR: Unknown error in  
> Assembler.  Please send the following stack trace and this message  
> to user@openejb.org :
> java.lang.NullPointerException
>        at org.apache.openejb.config.ConfigurationFactory 
> $DefaultService.access$000(ConfigurationFactory.java:434)
>        at  
> org 
> .apache 
> .openejb 
> .config 
> .ConfigurationFactory.getDefaultService(ConfigurationFactory.java:481)
>        at  
> org 
> .apache 
> .openejb 
> .config 
> .ConfigurationFactory 
> .resolveServiceProvider(ConfigurationFactory.java:555)
>        at  
> org 
> .apache 
> .openejb 
> .config 
> .ConfigurationFactory.configureService(ConfigurationFactory.java:496)
>        at  
> org 
> .apache 
> .openejb 
> .config 
> .ConfigurationFactory 
> .getOpenEjbConfiguration(ConfigurationFactory.java:267)
>        at  
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java: 
> 242)
>        at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:149)
>        at org.apache.openejb.OpenEJB.init(OpenEJB.java:293)
>        at  
> org.apache.openejb.tomcat.TomcatLoader.init(TomcatLoader.java:115)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.apache.openejb.loader.Embedder.init(Embedder.java:60)
>        at  
> org.apache.openejb.loader.OpenEJBListener.init(OpenEJBListener.java: 
> 87)
>        at  
> org 
> .apache 
> .openejb.loader.OpenEJBListener.lifecycleEvent(OpenEJBListener.java: 
> 62)
>        at  
> org 
> .apache 
> .catalina 
> .util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
>        at  
> org 
> .apache.catalina.core.StandardServer.initialize(StandardServer.java: 
> 767)
>        at org.apache.catalina.startup.Catalina.load(Catalina.java:518)
>        at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java: 
> 260)
>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java: 
> 412)
>
>
> Once that exception happens, nothing else works.  Then I realized  
> the elements should be named "Resource" instead of "Connector", and  
> when I made that change it started working?  Anyone have an idea on  
> why the legacy name "Connector" would cause an exception?  Also,  
> should we update all openejb.xml files in out tree to not use the  
> "Connector" element?


It should be fine.  We simply convert the Connector element to a  
Resource element, right around line 254 of ConfigurationFactory.

I moved the code into the Openejb jaxb object using your lazy  
conversion/private getter trick.

Connector should work, but I updated our default.openejb.conf to use  
the Resource tag, which is the one we want people to use.

-David