LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 07-05-2005, 01:08 PM   #1
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Rep: Reputation: 31
java.lang.InstantiationException: java.sql.Connection


hello:

I have a code in Java, using a mysql connection. While I used it as an standalone, it was ok, as usual, create the connection:

Class.forName(Variables.SQL_DRIVER).newInstance();
connector = DriverManager.getConnection("jdbc:mysql://" + url + "?user=" + usr + "&password=" + pass);

but now I've translated it into a web service, using this library "GLUE", and I get the following error:

electric.util.WrappedException: java.rmi.UnmarshalException: java.io.IOException
: no argument constructor is missing. java.lang.InstantiationException: com.mysql.jdbc.Connection
at electric.proxy.handler.Proxy.getCompatibleException(Unknown Source)
at electric.proxy.handler.Proxy.invoke(Unknown Source)
at $Proxy0.getLoginAuthenticationService(Unknown Source)
at Test.main(Test.java:27)

It sounds funny to me because Connection is an Interface... how come it wants to become "instantiated", is there a way around?

Thanks a lot.

Poeta.

Drop a visit to my site?
 
Old 07-06-2005, 03:15 PM   #2
vladmihaisima
Member
 
Registered: Oct 2002
Location: Delft, Netherlands
Distribution: Gentoo
Posts: 196

Rep: Reputation: 33
I don't know the library you talk about, but from what I see in the exception, this library executes code through Java RMI (with RMI you can call methods of an object on a different machine). You can do this also for objects created from classes that are not in the classpath on 'your machine'. But this means that RMI must marshal/unmarshal classes over the network.

I don't remember right now the details, but in your stack trace RMI is complaining.

Maybe if you would explained a little what you clasess/methods are, and how are you calling them, somebody could help more.
 
Old 07-06-2005, 08:26 PM   #3
poeta_boy
Member
 
Registered: Oct 2003
Location: Mexico
Distribution: Ubuntu
Posts: 223

Original Poster
Rep: Reputation: 31
hello:

I was trying to encapsulate database access in a web service.... I recently (1 hour ago) solved it by ... err.... forcing "no connection instantiation" haha well I just declared the thing static and it worked..... not what I'd like, or an example of good patterns but hey it worked.

Thanks a lot!

Poeta
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java exception: java.lang.NoClassDefFoundError kath Programming 12 05-11-2006 04:37 AM
java.lang.NoSuchMethodException: rulirahm Linux - Networking 2 05-02-2005 01:30 AM
java.lang.UnsatisfiedLinkError bjyostna Programming 1 02-16-2005 10:08 AM
Azureus: java.lang.OutOfMemoryError wearetheborg Linux - Software 3 12-01-2004 02:00 AM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 03:47 AM


All times are GMT -5. The time now is 04:43 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration