Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Re: SQLException: No suitable driver found for jdbc:derby:test; create=true

Hi Tom,

i debugged all once more and my assumption that the derby driver is on
my classpath seems to be wrong. what i has done was adding the derby
plugin as dependency to my plugin and (just in order to ensure) as buddy
to org.eclipse.persistence.core/jpa, javax.persistence.

To ensure that JPA is able to find the EmbeddedDriver class i provided
my plugin classLoader as PersistentUnitProperty:

Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PersistenceUnitProperties.CLASSLOADER, this.getClass()
				.getClassLoader());
EntityManagerFactory emf = new PersistenceProvider()
	.createEntityManagerFactory("net.ludeke.test.eclipselink",
						properties);
EntityManager em = emf.createEntityManager();

But when i debug the DriverManager the the Classloader for the
org.eclipse.persistence.core Plugin is used and not the one i provided
via the PersistenUnitProperty.

Is that the expected behavior?

I hope that these details could help you a little bit.

Best Regards

Andreas


On Wed, 2008-12-17 at 10:57 -0500, Tom Ware wrote:
> Hi Andreas,
> 
>    Is the Derby JDBC jar specifically on your classpath, or are you using an 
> OSGi or RCP configuration?
> 
> -Tom
> 
> Andreas Lüdeke wrote:
> > Hi,
> > 
> > one more comment on this: the EmbeddedDriver is in the classpath and the 
> > class could be resolved. It seems that the exception is thrown when the 
> > url (jdbc:derby:test;create=true) is been parsed. I didnt't know why 
> > this could happen, also using the ClientDriver and an corresponding url 
> > has not worked (i got the same exception) for me.
> > 
> > I am using the current eclipse plugin from the derby home page.
> > 
> > hopefully one of you could give me an hint what i do wrong.
> > 
> > Best regards
> > 
> > Andreas
> > 
> > On Wed, Dec 17, 2008 at 8:28 AM, Andreas Lüdeke <andreas@xxxxxxxxxx 
> > <mailto:andreas@xxxxxxxxxx>> wrote:
> > 
> >     Hi,
> > 
> >     i currently try tu run an first example with eclipselink in eclipse
> >     rcp. I already had a look at your default example in svn and used
> >     this as starting point. So my peristence.xml looks like this:
> > 
> >     <?xml version="1.0" encoding="UTF-8"?>
> >     <persistence version="1.0"
> >         xmlns="http://java.sun.com/xml/ns/persistence";
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> >     http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";>
> >         <persistence-unit name="net.ludeke.test.eclipselink">
> >             <class>net.ludeke.test.eclipselink.Test
> >             </class>
> >             <properties>
> >                 <property name="eclipselink.target-database"
> >     value="Derby" />
> >                 <property name="eclipselink.jdbc.driver"
> >     value="org.apache.derby.jdbc.EmbeddedDriver" />
> >                 <property name="eclipselink.jdbc.url"
> >     value="jdbc:derby:test;create=true" />
> >                 <property name="eclipselink.jdbc.user" value="" />
> >                 <property name="eclipselink.jdbc.password" value="" />
> > 
> >                 <!-- Logging -->
> >                 <property name="eclipselink.logging.level" value="FINEST" />
> >             </properties>
> >         </persistence-unit>
> >     </persistence>
> > 
> >     But when i try to initialize my EntityManager i got the following Error:
> > 
> >     [EL Info]: 2008.12.17
> >     08:24:45.498--ServerSession(28987414)--Thread(Thread[main,6,main])--EclipseLink,
> >     version: Eclipse Persistence Services - 1.0.2 (Build 20081024)
> >     [EL Config]: 2008.12.17
> >     08:24:45.511--ServerSession(28987414)--Connection(7417577)--Thread(Thread[main,6,main])--connecting(DatabaseLogin(
> >         platform=>DerbyPlatform
> >         user name=> ""
> >         datasource URL=> "jdbc:derby:test;create=true"
> >     ))
> >     [EL Warning]: 2008.12.17
> >     08:24:45.714--ServerSession(28987414)--Thread(Thread[main,6,main])--java.sql.SQLException:
> >     No suitable driver found for jdbc:derby:test;create=true
> >         at java.sql.DriverManager.getConnection(Unknown Source)
> >         at java.sql.DriverManager.getConnection(Unknown Source)
> >         at
> >     org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:97)
> >         at
> >     org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:164)
> >         at
> >     org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:324)
> >         at
> >     org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:264)
> >         at
> >     org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:407)
> >         at
> >     org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:130)
> >         at
> >     org.eclipse.persistence.sessions.server.ConnectionPool.startUp(ConnectionPool.java:367)
> >         at
> >     org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:500)
> >         at
> >     org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:606)
> >         at
> >     org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:211)
> >         at
> >     org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:246)
> >         at
> >     org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:69)
> >         at
> >     org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:118)
> >         at
> >     org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:112)
> >         at
> >     org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:100)
> >         at
> >     net.ludeke.test.eclipselink.NavigationView.<init>(NavigationView.java:34)
> >         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> >     Method)
> >         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> >     Source)
> >         at
> >     sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> >     Source)
> >         at java.lang.reflect.Constructor.newInstance(Unknown Source)
> >         at java.lang.Class.newInstance0(Unknown Source)
> >         at java.lang.Class.newInstance(Unknown Source)
> >         at
> >     org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:170)
> >         at
> >     org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:867)
> >         at
> >     org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
> >         at
> >     org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:51)
> >         at
> >     org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:259)
> >         at
> >     org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:63)
> >         at
> >     org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:328)
> >         at
> >     org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:230)
> >         at
> >     org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:594)
> >         at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:306)
> >         at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:531)
> >         at
> >     org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
> >         at
> >     org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
> >         at
> >     org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
> >         at
> >     org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
> >         at
> >     org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
> >         at
> >     org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
> >         at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
> >         at
> >     org.eclipse.ui.internal.PartStack.createControl(PartStack.java:649)
> >         at
> >     org.eclipse.ui.internal.PartStack.createControl(PartStack.java:576)
> >         at
> >     org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:568)
> >         at
> >     org.eclipse.ui.internal.PerspectiveHelper.activate(PerspectiveHelper.java:271)
> >         at
> >     org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:964)
> >         at
> >     org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:2593)
> >         at
> >     org.eclipse.ui.internal.WorkbenchWindow$25.run(WorkbenchWindow.java:2873)
> >         at
> >     org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> >         at
> >     org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:2854)
> >         at
> >     org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(WorkbenchWindow.java:759)
> >         at
> >     org.eclipse.ui.internal.Workbench$21.runWithException(Workbench.java:1027)
> >         at
> >     org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
> >         at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> >         at
> >     org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
> >         at
> >     org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
> >         at
> >     org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
> >         at
> >     org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
> >         at
> >     org.eclipse.ui.internal.Workbench$27.runWithException(Workbench.java:1361)
> >         at
> >     org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
> >         at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> >         at
> >     org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
> >         at
> >     org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
> >         at
> >     org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
> >         at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2293)
> >         at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
> >         at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
> >         at
> >     org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
> >         at
> >     org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
> >         at
> >     org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> >         at
> >     net.ludeke.test.eclipselink.Application.start(Application.java:20)
> >         at
> >     org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
> >         at
> >     org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> >         at
> >     org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> >         at
> >     org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
> >         at
> >     org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> >         at java.lang.reflect.Method.invoke(Unknown Source)
> >         at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
> >         at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
> >         at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
> >         at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
> > 
> >     Could somebody explain why this doesn't work?
> > 
> >     Best regards
> > 
> >     Andreas
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > _______________________________________________
> > eclipselink-users mailing list
> > eclipselink-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top