NullPointerException while getting the ConnectionInfo [message #657108] |
Tue, 01 March 2011 15:52 |
akoeck Messages: 62 Registered: December 2010 |
Member |
|
|
Hi I'm trying to get the ConnectionInfo from a managedConnection but strangely I get a NullPointerException.
This is my code:
private IConnectionProfile getDatabaseConnectionProfile(
IConnectionProfile connectionProfile, String str_database)
{
IManagedConnection managedConnection = connectionProfile.
getManagedConnection("org.eclipse.datatools.connectivity.sqm." +
"core.connection.ConnectionInfo");
if(managedConnection != null){
ConnectionInfo conInfo = (ConnectionInfo) managedConnection.
getConnection().getRawConnection(); // NullPointerExcpetion is happening here
if(conInfo.getDatabaseName().equals(str_database)){
return connectionProfile;
}
}
return null;
}
At the moment I'm just a blockhead. I can't find the failure.
[Updated on: Tue, 01 March 2011 15:53] Report message to a moderator
|
|
|
|
Re: NullPointerException while getting the ConnectionInfo [message #657839 is a reply to message #657758] |
Fri, 04 March 2011 10:04 |
akoeck Messages: 62 Registered: December 2010 |
Member |
|
|
Brian Fitzpatrick wrote on Thu, 03 March 2011 16:44 | Is the connection profile actually connected? I don't believe the managed connection appears until it is.
Have you been able to debug into that code to see where it's failing?
|
That could be the problem. Since I'm using this method to get the right Connection for my Database when I have more then one connection. But I have to look into details if this was causing the problem.
If you have a better way to get the correct connection for a specific Database without connect to each connection, that would be cool.
Edit: I've got an additional question. I'm using DTP in my Plug-In. Everytime I run my Plug-In I get this error right after starting it.
Quote: |
eclipse.buildId=unknown
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Framework arguments: -application org.eclipse.ui.ide.workbench
Command-line arguments: -application org.eclipse.ui.ide.workbench -data C:\Users\Alex\workspace2/../runtime-EclipseApplication -dev file:C:/Users/Alex/workspace2/.metadata/.plugins/org.eclipse .pde.core/Eclipse Application/dev.properties -os win32 -ws win32 -arch x86 -consoleLog
Error
Fri Mar 04 14:30:34 CET 2011
Parsing error: invalid attribute (connectionFactory.profile: null)
|
Is this bad, and how can I solve this?
[Updated on: Fri, 04 March 2011 13:32] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03200 seconds