NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
edilmar
Joined: 27 Nov 2009 Posts: 5
|
Posted: Thu Oct 20, 2011 7:31 pm Post subject: Problem with persistence.xml x glassfish-resources.xml |
|
|
Hi,
My env is: NB7.0.1 + GF 3.1 + CDI + JSF2 + RichFaces4 + JPA + Hibernate + Firebird RDBMS.
If I configure persistence.xml like this...
| Code: |
<persistence-unit name="pooweb4PU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>pooweb</jta-data-source>
<!--<jta-data-source>java:app/jdbc/pooweb-ds</jta-data-source>-->
... properties ...
</persistence-unit>
|
then NB/GF arises an exception about this: "java.lang.ClassCastException: org.firebirdsql.jdbc.FBDriver cannot be cast to javax.sql.DataSource". But I created the project and defined the database connection correctly. Looking at GlassFish Admin, I changed the FBDriver that NB put by default to FBDataSource, but the same problem occured.
The other option, that works, is this:
| Code: |
<persistence-unit name="pooweb4PU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!--<jta-data-source>pooweb</jta-data-source>-->
<jta-data-source>java:app/jdbc/pooweb-ds</jta-data-source>
... properties ...
</persistence-unit>
|
but I need to create WEB-INF/glassfish-resources.xml like this:
| Code: |
<jdbc-connection-pool res-type="javax.sql.DataSource" name="java:app/jdbc/pooweb-pool" datasource-classname="org.firebirdsql.jdbc.FBWrappingDataSource">
<property name="serverName" value="localhost" />
<property name="portNumber" value="3050" />
<property name="User" value="SYSDBA" />
<property name="Password" value="masterkey" />
<property name="dataBaseName" value="/sistemas/poowebbd/pooweb.fdb" />
</jdbc-connection-pool>
<jdbc-resource enabled="true" jndi-name="java:app/jdbc/pooweb-ds" object-type="user" pool-name="java:app/jdbc/pooweb-pool"/>
|
However, using this config with 2 files, I always have to deploy the webapp 2 times ("double F6"). The first time I press F6 gives this error and doesn't deploy:
| Code: |
redeploy?name=pooweb4&properties=keepSessions=true:preserveAppScopedResources=true falhou em GlassFish Server 3.1
Erro durante a implementação: Exception while preparing the app : Invalid resource : { ResourceInfo : (jndiName=java:app/jdbc/pooweb-ds__pm), (applicationName=pooweb4) }. Consulte o server.log para obter mais detalhes
/sistemas/pooweb4/nbproject/build-impl.xml:740:
O módulo não foi implementado.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor235.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
FALHA NA CONSTRUÇÃO (tempo total: 1 segundo)
|
Then, I don't change anything in the code or config files, just the second F6, and the app deploys fine:
| Code: |
Informações: WEB0671: Loading application [pooweb4] at [/pooweb4]
Informações: pooweb4 foi implementado com êxito em 4.409 milisegundos.
|
I tried to create a new simple project to this and the same problem occurs. I think this is a bug in NB, right? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|