Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
How to configure postgres driver on a osgi enviornment? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to configure postgres driver on a osgi enviornment?

    hi all
    i have a query like this:
    Code:
    public List<Pais> findAllPais(){
    		return find("select p from Pais p");
    	}
    but when she's executed, it throws a error like this:
    Code:
    [EL Severe]: 2011-02-15 10:32:32.421--ServerSession(2572110)--Thread(Thread[main,6,main])--Local Exception Stack: 
    Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:postgresql://192.168.0.10:5432/ti_fiscal
    Error Code: 0
    	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:309)
    	at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:138)
    	at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:94)
    	at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    	at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:327)
    	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:291)
    	at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:415)
    	at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:155)
    	at org.eclipse.persistence.sessions.server.ExternalConnectionPool.startUp(ExternalConnectionPool.java:118)
    	at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:495)
    	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:627)
    	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:230)
    	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:389)
    	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:164)
    	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:221)
    	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:209)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423)
    	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485)
    	at $Proxy8.createEntityManager(Unknown Source)
    	at org.springframework.orm.jpa.EntityManagerFactoryAccessor.createEntityManager(EntityManagerFactoryAccessor.java:116)
    	at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:176)
    	at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:146)
    	at org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:306)
    	at org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:302)
    	at br.com.germantech.repo.JPADao.findAllPais(JPADao.java:16)
    	at br.com.germantech.repo.JPADao$$FastClassByCGLIB$$dcf8016c.invoke(<generated>)
    	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
    	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:617)
    	at br.com.germantech.repo.JPADao$$EnhancerByCGLIB$$9ccc57c9.findAllPais(<generated>)
    	at br.com.germantech.commands.AbrirEditorTeste.execute(AbrirEditorTeste.java:21)
    	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
    	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
    	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
    	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
    	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
    	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:820)
    	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:806)
    	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:796)
    	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
    	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
    	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
    	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    	at br.com.germantech.application.Application.start(Application.java:20)
    	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    	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:369)
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
    	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
    and yes, i DO HAVE postgres driver added as a dependecie from my bundle

    here's all the stack trace:
    http://pastie.org/1566055
    as you can see here:
    Code:
    [EL Config]: 2011-02-15 10:32:32.421--ServerSession(2572110)--Connection(1349553)--Thread(Thread[main,6,main])--connecting(DatabaseLogin(
      platform=>PostgreSQLPlatform
      user name=> "postgres"
      connector=>JNDIConnector datasource name=>null
    ))
    [EL Severe]: 2011-02-15 10:32:32.421--ServerSession(2572110)--Thread(Thread[main,6,main])--Local Exception Stack: 
    Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:postgresql://192.168.0.10:5432/ti_fiscal
    spring tries to instantiate a datasource, which i don't use, i never used at all

    my config files:
    appContext.xml
    http://pastie.org/1566048

    persistence.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence 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_2_0.xsd" version="2.0">
    	<persistence-unit name="Fiscal" transaction-type="RESOURCE_LOCAL">
    	
    		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    		
    		<class>br.com.germantech.modelos.GrupoAcesso</class>
    		<class>br.com.germantech.modelos.GrupoUsuario</class>
    		<class>br.com.germantech.modelos.Usuario</class>
    		<class>br.com.germantech.modelos.Estado</class>
    		<class>br.com.germantech.modelos.GrupoTelefone</class>
    		<class>br.com.germantech.modelos.Municipio</class>
    		<class>br.com.germantech.modelos.Pais</class>
    		<class>br.com.germantech.modelos.Telefone</class>
    		<class>br.com.germantech.modelos.TipoLogradouro</class>
    		<class>br.com.germantech.modelos.ClienteFornecedor</class>
    		<class>br.com.germantech.modelos.Contabilista</class>
    		<class>br.com.germantech.modelos.Departamento</class>
    		<class>br.com.germantech.modelos.Empresa</class>
    		<class>br.com.germantech.modelos.EmpresasEndereco</class>
    		<class>br.com.germantech.modelos.EmpresasResponsavel</class>
    		<class>br.com.germantech.modelos.EmpresasSocio</class>
    		<class>br.com.germantech.modelos.Escritorio</class>
    		<class>br.com.germantech.modelos.GrupoResponsavel</class>
    		<class>br.com.germantech.modelos.InscricaoSubstituicao</class>
    		<class>br.com.germantech.modelos.Nacionalidade</class>
    		<class>br.com.germantech.modelos.NaturezaJuridica</class>
    		<class>br.com.germantech.modelos.Responsavel</class>
    		<class>br.com.germantech.modelos.Sindicato</class>
    		<class>br.com.germantech.modelos.SituacaoEspecial</class>
    		<class>br.com.germantech.modelos.TipoSocio</class>
    		
    		<exclude-unlisted-classes>false</exclude-unlisted-classes>
    		
    		<properties>
    			<property name="eclipselink.target-database" value="PostgreSQL" />
    			<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
    			<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.0.10:5432/ti_fiscal" />
    			<property name="javax.persistence.jdbc.user" value="postgres" />
    			<property name="javax.persistence.jdbc.password" value="admin" />
    		</properties>
    	</persistence-unit>
    </persistence>
    what am i missing?
    thanks in advice
Working...
X