[JNDI/Naming/Network] - Re: java.naming.provider.url parsing problem?
by csturtz
I've run into another exception that doesn't provide much information. Line 881 of the following code is causing the error. Atleast i'm now getting past the lookup method!
| 879 InitialContext initialContext = new InitialContext();
| 880 javax.sql.DataSource ds = (javax.sql.DataSource) initialContext.lookup("OracleDS");
| 881 Connection connection = ds.getConnection();
anonymous wrote : org.apache.maven.surefire.booter.SurefireExecutionException: com.gestalt.gccsa.fp.adhoc.db.objectmanager.ws.SqlQueryManagerTest; nested excepti
| org.apache.maven.surefire.testset.TestSetFailedException: com.gestalt.gccsa.fp.adhoc.db.objectmanager.ws.SqlQueryManagerTest; nested exception
| java.lang.ExceptionInInitializerError
| 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 junit.framework.TestSuite.createTest(TestSuite.java:56)
| at junit.framework.TestSuite.addTestMethod(TestSuite.java:279)
| at junit.framework.TestSuite.(TestSuite.java:142)
| 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 org.apache.maven.surefire.junit.JUnitTestSet.constructTestObject(JUnitTestSet.java:148)
| at org.apache.maven.surefire.junit.JUnitTestSet.getTestCount(JUnitTestSet.java:244)
| at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSets(AbstractDirectoryTestSuite.java:101)
| at org.apache.maven.surefire.Surefire.createSuiteFromDefinition(Surefire.java:147)
| at org.apache.maven.surefire.Surefire.run(Surefire.java:108)
| 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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
| at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
| Caused by: java.lang.reflect.UndeclaredThrowableException
| at $Proxy1.getConnection(Unknown Source)
| at com.gestalt.gccsa.fp.adhoc.db.objectmanager.ws.FunctGroupObjectManager.getConnection(FunctGroupObjectManager.java:881)
| at com.gestalt.gccsa.fp.adhoc.db.objectmanager.ws.FunctGroupObjectManager.saveFunctGroupVersionObject(FunctGroupObjectManager.java:308)
| at com.gestalt.gccsa.fp.adhoc.db.objectmanager.ws.SqlQueryManagerTest.(SqlQueryManagerTest.java:34)
| ... 22 more
| Caused by: java.rmi.MarshalException: error marshalling arguments; nested exception is:
| java.net.SocketException: Software caused connection abort: socket write error
| at sun.rmi.server.UnicastRef.invoke(Unknown Source)
| at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
| at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:133)
| at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:331)
| at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:194)
| at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:74)
| at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:100)
| ... 26 more
| Caused by: java.net.SocketException: Software caused connection abort: socket write error
| at java.net.SocketOutputStream.socketWrite0(Native Method)
| at java.net.SocketOutputStream.socketWrite(Unknown Source)
| at java.net.SocketOutputStream.write(Unknown Source)
| at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
| at java.io.BufferedOutputStream.write(Unknown Source)
| at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source)
| at java.io.ObjectOutputStream$BlockDataOutputStream.writeByte(Unknown Source)
| at java.io.ObjectOutputStream.writeFatalException(Unknown Source)
| at java.io.ObjectOutputStream.writeObject(Unknown Source)
| at sun.rmi.server.UnicastRef.marshalValue(Unknown Source)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968238#3968238
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968238
19 years, 7 months
[Persistence, JBoss/CMP, Hibernate, Database] - Session.Save work fine, Session.update Unknown entity ?!?!?!
by gaquino
Hi ,
I have work using Hibernate 3 with MBean in Jboss 4.0.4. and ans increrible thinks happend.. in same code, same mapping.. i use session.save to create a registry this work fine, but if i use session.update or session.saveOrUpdate to update one registry im receive the error:
- nested throwable: (org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=BCO-SIST-002/169, BranchQual=, localId=169] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.MappingException: Unknown entity: br.com.bvsistemas.servicoteste.data.VUsuario))
Some one can help me about this ???
Thx
hibernate-service.xml
<server>
| <mbean code="org.jboss.hibernate.jmx.Hibernate"
| name="jboss.adminguide:name=BVServicoTesteFactory">
| <attribute name="DatasourceName">java:MysqlTeste</attribute>
| <attribute name="Dialect">
| org.hibernate.dialect.MySQLDialect
| </attribute>
| <attribute name="SessionFactoryName">
| java:/hibernate/BVServicoTesteFactory
| </attribute>
| <attribute name="CacheProviderClass">
| org.hibernate.cache.HashtableCacheProvider
| </attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
| <attribute name="DefaultSchema">dbteste</attribute>
| <attribute name="MaxFetchDepth">8</attribute>
| <attribute name="JdbcBatchSize">1000</attribute>
| <attribute name="JdbcFetchSize">5000</attribute>
| <attribute name="ReflectionOptimizationEnabled">true</attribute>
| <attribute name="QueryCacheEnabled">true</attribute>
| <attribute name="SessionFactoryInterceptor">br.com.bvsistemas.framework.interceptor.AuditHibernateInterceptor</attribute>
| </mbean>
| </server>
|
VUsuario.hbm.xml
<?xml version="1.0"?>
| <!DOCTYPE hibernate-mapping PUBLIC
| "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
| "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
|
| <hibernate-mapping>
| <!--
| Created by the Middlegen Hibernate plugin 2.2
|
| http://boss.bekk.no/boss/middlegen/
| http://www.hibernate.org/
| -->
|
| <class
| name="br.com.bvsistemas.servicoteste.data.VUsuario"
| table="tbusuario"
| lazy="false"
| schema="dbteste"
| >
|
| <id
| name="cdUsuario"
| type="java.lang.Integer"
| column="CdUsuario"
| >
|
| <generator class="increment" />
| </id>
|
| <property
| name="nmUsuario"
| type="java.lang.String"
| column="NmUsuario"
| length="100"
| />
|
| <!-- Associations -->
|
|
| </class>
| </hibernate-mapping>
VUsuario.java
public class VUsuario extends BaseVUsuario implements IVUsuario,IAuditar{
|
|
| /**
| *
| */
| private static final long serialVersionUID = 8354978809242555880L;
|
|
| /*[CONSTRUCTOR MARKER BEGIN]*/
| public VUsuario () {
| super();
| }
|
| /**
| * Constructor for primary key
| */
| public VUsuario (java.lang.Integer cdUsuario) {
| super(cdUsuario);
| }
|
| /*[CONSTRUCTOR MARKER END]*/
|
| /* (non-Javadoc)
| * @see br.com.bvsistemas.framework.auditoria.IAuditar#getId()
| */
| public String getId() {
| return super.getCdUsuario().toString();
| }
| }
BaseVUsuario.java
| public abstract class BaseVUsuario implements Comparable, Serializable {
|
| public static String REF = "VUsuario";
| public static String PROP_NM_USUARIO = "nmUsuario";
| public static String PROP_CD_USUARIO = "cdUsuario";
|
|
| // constructors
| public BaseVUsuario () {
| initialize();
| }
|
| /**
| * Constructor for primary key
| */
| public BaseVUsuario (java.lang.Integer cdUsuario) {
| this.setCdUsuario(cdUsuario);
| initialize();
| }
|
| protected void initialize () {}
|
|
|
| private int hashCode = Integer.MIN_VALUE;
|
| // primary key
| private java.lang.Integer cdUsuario;
|
| // fields
| private java.lang.String nmUsuario;
|
|
|
| /**
| * Return the unique identifier of this class
| * @hibernate.id
| * generator-class="increment"
| * column="CdUsuario"
| */
| public java.lang.Integer getCdUsuario () {
| return cdUsuario;
| }
|
| /**
| * Set the unique identifier of this class
| * @param cdUsuario the new ID
| */
| public void setCdUsuario (java.lang.Integer cdUsuario) {
| this.cdUsuario = cdUsuario;
| this.hashCode = Integer.MIN_VALUE;
| }
|
|
|
|
| /**
| * Return the value associated with the column: NmUsuario
| */
| public java.lang.String getNmUsuario () {
| return nmUsuario;
| }
|
| /**
| * Set the value related to the column: NmUsuario
| * @param nmUsuario the NmUsuario value
| */
| public void setNmUsuario (java.lang.String nmUsuario) {
| this.nmUsuario = nmUsuario;
| }
|
|
|
|
|
| public boolean equals (Object obj) {
| if (null == obj) return false;
| if (!(obj instanceof br.com.bvsistemas.servicoteste.data.VUsuario)) return false;
| else {
| br.com.bvsistemas.servicoteste.data.VUsuario vUsuario = (br.com.bvsistemas.servicoteste.data.VUsuario) obj;
| if (null == this.getCdUsuario() || null == vUsuario.getCdUsuario()) return false;
| else return (this.getCdUsuario().equals(vUsuario.getCdUsuario()));
| }
| }
|
| public int hashCode () {
| if (Integer.MIN_VALUE == this.hashCode) {
| if (null == this.getCdUsuario()) return super.hashCode();
| else {
| String hashStr = this.getClass().getName() + ":" + this.getCdUsuario().hashCode();
| this.hashCode = hashStr.hashCode();
| }
| }
| return this.hashCode;
| }
|
| public int compareTo (Object obj) {
| if (obj.hashCode() > hashCode()) return 1;
| else if (obj.hashCode() < hashCode()) return -1;
| else return 0;
| }
|
| public String toString () {
| return super.toString();
| }
|
|
| }
The Code test Save/Update
| // The entity populate
| VUsuario usuarioDTO = new VUsuario();
| usuarioDTO.setCdUsuario(3389);
| usuarioDTO.setNmUsuario("Nina");
|
| // Get the session
| final InitialContext ctx = new InitialContext();
| final SessionFactory factory = (SessionFactory) ctx.lookup("java:/hibernate/BVServicoTesteFactory");
| Session sessao = factory.openSession();
|
| sessao.save(usuarioDTO)
|
| // Change the value to update other registry
| usuarioDTO.setCdUsuario(3380);
| usuarioDTO.setNmUsuario("Gustavo");
| sessao.update(usuarioDTO);
|
| sessao.flush();
| sessao.close();
|
This is the error:
org.jboss.tm.JBossTransactionRolledbackLocalException: - nested throwable: (org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=BCO-SIST-002/169, BranchQual=, localId=169] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.MappingException: Unknown entity: br.com.bvsistemas.servicoteste.data.VUsuario))
at org.jboss.ejb.plugins.TxInterceptorCMT.throwJBossException(TxInterceptorCMT.java:565)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:506)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:411)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
at org.jboss.ejb.Container.invoke(Container.java:954)
at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430)
at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:103)
at $Proxy66.atualizarUsuario(Unknown Source)
... 48 more
Caused by: org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=BCO-SIST-002/169, BranchQual=, localId=169] status=STATUS_NO_TRANSACTION; - nested throwable: (org.hibernate.MappingException: Unknown entity: br.com.bvsistemas.servicoteste.data.VUsuario)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
... 58 more
Caused by: org.hibernate.MappingException: Unknown entity: br.com.bvsistemas.servicoteste.data.VUsuario
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:547)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:65)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:871)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:801)
at br.com.bvsistemas.framework.interceptor.AuditHibernateInterceptor.onFlushDirty(AuditHibernateInterceptor.java:108)
at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:325)
at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:301)
at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:241)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:121)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59)
at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1491)
at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1110)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:324)
... 59 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968235#3968235
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968235
19 years, 7 months