Subject: | Java Object not properly created |
First a disclaimer:
I am new to Inline::Java and the JDBC module, and do not know Java.
This may be a bug in Inline::Java but but I thought I would log the
bug here since I can not even make a connection to a database via
JDBC. I will also log the bug in JDBC but I think its a issue with
Inline::Java.
Environment:
Solaris 5.8 Generic_108528-18 sun4u sparc SUNW,Ultra-80
perl v5.8.6
Inline::Java v0.51
JDBC v0.01
The Runtime Error:
09-15-2006 11:04:44 INFO: Started : ovaa_alarmdef_exception
09-15-2006 11:04:44 INFO: Version : 1.0
09-15-2006 11:04:44 INFO: Pid : 2825
09-15-2006 11:04:44 INFO: Loglevel : 4
09-15-2006 11:04:44 INFO: Cmd Line :
09-15-2006 11:04:44 INFO: Loading driver . . .
09-15-2006 11:04:44 INFO: Successfully loaded daffodil driver!!
09-15-2006 11:04:44 INFO: Connecting to daffodil . . .
09-15-2006 11:04:44 FATAL: Wrong number of arguments at /opt/gsperl-
5.8.6_1/lib/site_perl/5.8.6/sun4-solaris-thread-
multi/Inline/Java/Object.pm line 107
09-15-2006 11:04:44 FATAL: Processing aborted!
The Code:
use JDBC;
sub connect_to_daffodil {
$_log->info('Loading driver . . . ');
JDBC->load_driver('in.co.daffodil.db.rmi.RmiDaffodilDBDriver');
$_log->info('Successfully loaded daffodil driver!!');
my $url = 'jdbc:daffodilDB://localhost:3456/ovaa';
my $user = 'DAFFODIL';
my $pass = 'daff0d1l';
$_log->info('Connecting to daffodil . . . ');
my $con = JDBC->getConnection($url, $user, $pass);
$_log->info('Successfully connected to daffodil!!');
return $con;
}
Notes:
As you can see, I am just trying to make a basic connection to a
Daffodil database via JDBC. The code seem identical to the example in
the POD. Maybe there has been a change in Inline::Java that broke
JDBC?
Dubugging:
I hope that soem of thsi debugging may help in find the solution.
After looking into Inline::Java::Object the problem is apparently a
problem with the $args variable when
Inline::Java::Class::CastArguments is called. While digging a little
further I see that it has to do with $args and the $protos->key-
Show quoted text
>signature in this method do not have the same number of elements
(args has 3 was the signature of the first proto only has 1).
args:$VAR1 = [
'jdbc:daffodilDB://localhost:3456/ovaa',
'DAFFODIL',
'daff0d1l'
];
protos:$VAR1 = {
'java.lang.String' => {
'STATIC' => 1,
'IDX' => 568,
'SIGNATURE' => [
'java.lang.String'
]
},
'java.lang.String, java.lang.String, java.lang.String' => {
'
STATIC' => 1,
'
IDX' => 569,
'
SIGNATURE' => [
'java.lang.String',
'java.lang.String',
'java.lang.String'
]
},
'java.lang.String, java.util.Properties' => {
'STATIC' => 1,
'IDX' => 567,
'SIGNATURE' =>
[
'java.lang.String',
'java.util.Properties'
]
}
};
I then traced this back to the bind_method in Java.pm where the
__validate_protype mehtod is called. But this is where I am currently
stuck. I understand the code but following it at this point is tricky.