Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Can't use other bundle (Caused by: java.lang.ClassNotFoundException: )
Can't use other bundle [message #737803] Sat, 15 October 2011 09:21 Go to previous message
Bertin Kiekebosch is currently offline Bertin Kiekebosch
Messages: 223
Registered: August 2011
Senior Member
Hi,

I created a bundle that contains the jdbc driver. Because I could not get it up and running I created a RCP Client application that uses this bundle and it works well. See the example below.

public class DBConnection {
	public static Connection getConnection() {
		Connection connection = null;
		try {
			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
		}
		catch (java.lang.ClassNotFoundException e) {
			System.err.print("ClassNotFoundException: ");
			System.err.println(e.getMessage());
		}
		catch (InstantiationException e) {
			System.err.print("InstantiationException: ");
			e.printStackTrace();
		}
		catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		try {
			String connectionUrl = "jdbc:sqlserver://localhost:1433;database=MY_DB;";		
			connection = DriverManager.getConnection(connectionUrl, "user", "password");			
		}
		catch (SQLException ex) {
			System.err.println("SQLException: " + ex.getMessage());
		}
		return connection;
	}
}


When I add the same bundle to a Scout Server and configure the SQL Service (see below) it cannot find the class.

(First it could not able to find the bundle but solved that with the help of ivan.motsch)


public class MsSqlService extends AbstractSqlService implements IService {
  @Override
  protected String getConfiguredJdbcDriverName() {
    return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
  }

  @Override
  protected String getConfiguredJdbcMappingName() {
    return "jdbc:sqlserver://localhost:1433";
  }

  @Override
  protected String getConfiguredJdbcProperties() {
    return "database=MY_DB";
  }

  @Override
  protected String getConfiguredPassword() {
    return "password";
  }

  @Override
  protected String getConfiguredUsername() {
    return "user";
  }


So the question is, what is different in Scout that this does not work. Is it something with different class loaders ? or do I have to make some more configurations to make it work?

Regards Bertin
 
Read Message
Read Message
Read Message
Read Message
Read Message icon7.gif
Previous Topic:Best practice for large BO's
Next Topic:Eclipse Scout RC4: MySql support?
Goto Forum:
  


Current Time: Sun May 19 08:32:42 EDT 2013

Powered by FUDForum. Page generated in 0.01672 seconds