You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Gus Heck <gu...@olin.edu> on 2004/02/02 20:17:01 UTC

Progress on MetaDataManager bug?

I'm curious if there has been any progress on this bug: It is currently 
forcing me to put passwords in my code which I don't really like to do.

http://www.mail-archive.com/ojb-user@db.apache.org/msg06331.html

- Gus


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Progress on MetaDataManager bug?

Posted by Gus Heck <gu...@olin.edu>.
I appologize. Clearly I was unclear :). That code is not in OJB. It is 
my code. and to me it doesn't matter if I use

JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new 
PBKey("myCon", "foo", "bar"));

or

JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new 
PBKey("myCon"));
descriptor.setUserName("foo");
descriptor.setPassWord("bar");

Both are undesireable; "foo" and "bar" have to be coded in somewhere or 
passed in as sysproperties or whatnot when this information is already 
defined elswhere. In my code this connection is the ONLY place I break 
the JDO api and grab a real database connection. I do it at program load 
time to take advantage of the commons-sql alter code in setting up the 
database. So the issue is I would like to be able to get a connection 
without duplicating the username and password information in the code, 
or in sysprops etc. OJB already has the username and password, because 
JDO works just fine without any of the code above if the database tables 
are done by hand or by Ant. So my problem is that OJB has the user name 
and password, but I can't seem to get them, or a connection that already 
knows them. This is really about the DRY principal :).

I half suspect that I am simply going about this wrong and the solution 
exists elswhere...

-Gus


Armin Waibel wrote:

> Hi Gus,
>
> Gus Heck wrote:
>
>> I didn't actually get an NPE. It was Andy who suggested the 
>> possibility of an NPE. The problem on my end was that the null or 
>> whatever was interpreted as nobody@draco.research.olin.edu with no 
>> password... when of course I need a specific password and user.
>>
>> The code that causes this looks like this...
>>
>>        JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new 
>> PBKey("myCon"));
>>        //descriptor.setUserName("foo");
>>        //descriptor.setPassWord("bar");
>>              Connection existing;
>>        try {
>>            existing = cf.lookupConnection(descriptor);
>>        } catch (LookupException le) {
>>            throw new RuntimeException("Failed looking up connection 
>> from descriptor.");
>>        }
>>
>
> think I don't understand your problem :-(
> Where in OJB is this code used, or why do you need this code?
>
> Why you don't use
> JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new
> new PBKey("myCon", "foo", "bar"));
> ...
> Should work if a jdbc-connection-descriptor is defined with "myCon" 
> jcdAlias (without user/password).
>
> Or do you setup a JdbcConnectionDescriptor from scratch?
>
> >>> I'm curious if there has been any progress on this bug: It is
> >>> currently forcing me to put passwords in my code which I don't really
> >>> like to do.
>
> Does this mean that user/password defined in 
> jdbc-connection-descriptor was ignored?
>
> Sorry, I'm confused.
>
> regards,
> Armin
>
>> if I uncomment line 2 and 3 (with the actual username and password, 
>> not these) it works fine.
>>
>> -Gus
>>
>>
>> [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] 
>> ERROR: Error getting Connection from DriverManager with url 
>> (jdbc:mysql://localhost:3306/fdbjunit) and driver 
>> (com.mysql.jdbc.Driver)
>> Invalid authorization specification,  message from server: "Access 
>> denied for user: 'nobody@draco.research.olin.edu' (Using password: NO)"
>> java.sql.SQLException: Invalid authorization specification,  message 
>> from server: "Access denied for user: 
>> 'nobody@draco.research.olin.edu' (Using password: NO)"
>>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
>>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1752)
>>        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:833)
>>        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1734)
>>        at com.mysql.jdbc.Connection.<init>(Connection.java:562)
>>        at 
>> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:361) 
>>
>>        at java.sql.DriverManager.getConnection(DriverManager.java:512)
>>        at java.sql.DriverManager.getConnection(DriverManager.java:193)
>>        at 
>> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectionFromDriverManager(ConnectionFactoryAbstractImpl.java:234) 
>>
>>        at 
>> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConPoolFactory.makeObject(ConnectionFactoryPooledImpl.java:215) 
>>
>>        at 
>> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown 
>> Source)
>>        at 
>> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionFromPool(ConnectionFactoryPooledImpl.java:66) 
>>
>>        at 
>> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnection(ConnectionFactoryAbstractImpl.java:101) 
>>
>>        at 
>> org.cs101.fdb.impl.jdo.TorqueBugMain.main(TorqueBugMain.java:115)
>> Exception in thread "main" java.lang.RuntimeException: Failed looking 
>> up connection from descriptor.
>>        at 
>> org.cs101.fdb.impl.jdo.TorqueBugMain.main(TorqueBugMain.java:117)
>>
>>
>> Armin Waibel wrote:
>>
>>> Hi Gus,
>>>
>>> did you tried latest version from CVS HEAD (not 1.0_branch)?
>>> I thought if have fixed it. If you still get NPE, please send me the 
>>> stack trace.
>>>
>>> regards,
>>> Armin
>>>
>>> Gus Heck wrote:
>>>
>>>> I'm curious if there has been any progress on this bug: It is 
>>>> currently forcing me to put passwords in my code which I don't 
>>>> really like to do.
>>>>
>>>> http://www.mail-archive.com/ojb-user@db.apache.org/msg06331.html
>>>>
>>>> - Gus
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Progress on MetaDataManager bug?

Posted by Armin Waibel <ar...@apache.org>.
Hi Gus,

Gus Heck wrote:

> I didn't actually get an NPE. It was Andy who suggested the possibility 
> of an NPE. The problem on my end was that the null or whatever was 
> interpreted as nobody@draco.research.olin.edu with no password... when 
> of course I need a specific password and user.
>
> The code that causes this looks like this...
> 
>        JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new 
> PBKey("myCon"));
>        //descriptor.setUserName("foo");
>        //descriptor.setPassWord("bar");
>              Connection existing;
>        try {
>            existing = cf.lookupConnection(descriptor);
>        } catch (LookupException le) {
>            throw new RuntimeException("Failed looking up connection from 
> descriptor.");
>        }
>

think I don't understand your problem :-(
Where in OJB is this code used, or why do you need this code?

Why you don't use
JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new
new PBKey("myCon", "foo", "bar"));
...
Should work if a jdbc-connection-descriptor is defined with "myCon" 
jcdAlias (without user/password).

Or do you setup a JdbcConnectionDescriptor from scratch?

 >>> I'm curious if there has been any progress on this bug: It is
 >>> currently forcing me to put passwords in my code which I don't really
 >>> like to do.

Does this mean that user/password defined in jdbc-connection-descriptor 
was ignored?

Sorry, I'm confused.

regards,
Armin

> if I uncomment line 2 and 3 (with the actual username and password, not 
> these) it works fine.
> 
> -Gus
> 
> 
> [org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR: 
> Error getting Connection from DriverManager with url 
> (jdbc:mysql://localhost:3306/fdbjunit) and driver (com.mysql.jdbc.Driver)
> Invalid authorization specification,  message from server: "Access 
> denied for user: 'nobody@draco.research.olin.edu' (Using password: NO)"
> java.sql.SQLException: Invalid authorization specification,  message 
> from server: "Access denied for user: 'nobody@draco.research.olin.edu' 
> (Using password: NO)"
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
>        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1752)
>        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:833)
>        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1734)
>        at com.mysql.jdbc.Connection.<init>(Connection.java:562)
>        at 
> com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:361)
>        at java.sql.DriverManager.getConnection(DriverManager.java:512)
>        at java.sql.DriverManager.getConnection(DriverManager.java:193)
>        at 
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectionFromDriverManager(ConnectionFactoryAbstractImpl.java:234) 
> 
>        at 
> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConPoolFactory.makeObject(ConnectionFactoryPooledImpl.java:215) 
> 
>        at 
> org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
>        at 
> org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionFromPool(ConnectionFactoryPooledImpl.java:66) 
> 
>        at 
> org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnection(ConnectionFactoryAbstractImpl.java:101) 
> 
>        at org.cs101.fdb.impl.jdo.TorqueBugMain.main(TorqueBugMain.java:115)
> Exception in thread "main" java.lang.RuntimeException: Failed looking up 
> connection from descriptor.
>        at org.cs101.fdb.impl.jdo.TorqueBugMain.main(TorqueBugMain.java:117)
> 
> 
> Armin Waibel wrote:
> 
>> Hi Gus,
>>
>> did you tried latest version from CVS HEAD (not 1.0_branch)?
>> I thought if have fixed it. If you still get NPE, please send me the 
>> stack trace.
>>
>> regards,
>> Armin
>>
>> Gus Heck wrote:
>>
>>> I'm curious if there has been any progress on this bug: It is 
>>> currently forcing me to put passwords in my code which I don't really 
>>> like to do.
>>>
>>> http://www.mail-archive.com/ojb-user@db.apache.org/msg06331.html
>>>
>>> - Gus
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Progress on MetaDataManager bug?

Posted by Gus Heck <gu...@olin.edu>.
I didn't actually get an NPE. It was Andy who suggested the possibility 
of an NPE. The problem on my end was that the null or whatever was 
interpreted as nobody@draco.research.olin.edu with no password... when 
of course I need a specific password and user.

The code that causes this looks like this...

        JdbcConnectionDescriptor descriptor = cRepos.getDescriptor(new 
PBKey("myCon"));
        //descriptor.setUserName("foo");
        //descriptor.setPassWord("bar");
       
        Connection existing;
        try {
            existing = cf.lookupConnection(descriptor);
        } catch (LookupException le) {
            throw new RuntimeException("Failed looking up connection 
from descriptor.");
        }

if I uncomment line 2 and 3 (with the actual username and password, not 
these) it works fine.

-Gus


[org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR: 
Error getting Connection from DriverManager with url 
(jdbc:mysql://localhost:3306/fdbjunit) and driver (com.mysql.jdbc.Driver)
Invalid authorization specification,  message from server: "Access 
denied for user: 'nobody@draco.research.olin.edu' (Using password: NO)"
java.sql.SQLException: Invalid authorization specification,  message 
from server: "Access denied for user: 'nobody@draco.research.olin.edu' 
(Using password: NO)"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1752)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:833)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1734)
        at com.mysql.jdbc.Connection.<init>(Connection.java:562)
        at 
com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:361)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnection(DriverManager.java:193)
        at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConnectionFromDriverManager(ConnectionFactoryAbstractImpl.java:234)
        at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl$ConPoolFactory.makeObject(ConnectionFactoryPooledImpl.java:215)
        at 
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown Source)
        at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryPooledImpl.getConnectionFromPool(ConnectionFactoryPooledImpl.java:66)
        at 
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupConnection(ConnectionFactoryAbstractImpl.java:101)
        at org.cs101.fdb.impl.jdo.TorqueBugMain.main(TorqueBugMain.java:115)
Exception in thread "main" java.lang.RuntimeException: Failed looking up 
connection from descriptor.
        at org.cs101.fdb.impl.jdo.TorqueBugMain.main(TorqueBugMain.java:117)


Armin Waibel wrote:

> Hi Gus,
>
> did you tried latest version from CVS HEAD (not 1.0_branch)?
> I thought if have fixed it. If you still get NPE, please send me the 
> stack trace.
>
> regards,
> Armin
>
> Gus Heck wrote:
>
>> I'm curious if there has been any progress on this bug: It is 
>> currently forcing me to put passwords in my code which I don't really 
>> like to do.
>>
>> http://www.mail-archive.com/ojb-user@db.apache.org/msg06331.html
>>
>> - Gus
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Progress on MetaDataManager bug?

Posted by Andy Malakov <an...@transdecisions.com>.
I believe it is fixed even in RC5.

Thanks,
Andy

----- Original Message ----- 
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Developers List" <oj...@db.apache.org>
Sent: Monday, February 02, 2004 2:27 PM
Subject: Re: Progress on MetaDataManager bug?


> Hi Gus,
> 
> did you tried latest version from CVS HEAD (not 1.0_branch)?
> I thought if have fixed it. If you still get NPE, please send me the 
> stack trace.
> 
> regards,
> Armin
> 
> Gus Heck wrote:
> 
> > I'm curious if there has been any progress on this bug: It is currently 
> > forcing me to put passwords in my code which I don't really like to do.
> > 
> > http://www.mail-archive.com/ojb-user@db.apache.org/msg06331.html
> > 
> > - Gus
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-dev-help@db.apache.org
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: Progress on MetaDataManager bug?

Posted by Armin Waibel <ar...@apache.org>.
Hi Gus,

did you tried latest version from CVS HEAD (not 1.0_branch)?
I thought if have fixed it. If you still get NPE, please send me the 
stack trace.

regards,
Armin

Gus Heck wrote:

> I'm curious if there has been any progress on this bug: It is currently 
> forcing me to put passwords in my code which I don't really like to do.
> 
> http://www.mail-archive.com/ojb-user@db.apache.org/msg06331.html
> 
> - Gus
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org