By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,408 Members | 1,796 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,408 IT Pros & Developers. It's quick & easy.

[TxConnectionManager] Connection error occured

P: 8
Hi,
I'm using hibernate, mysql 5.0.22 and struts 2 in my application.
In struts2, I'm using REST plugin and classes that extends ActionSupport and implements ModelDriven interface (webservice classes). These classes interact with the database.

I'm using external datasource configuration xml which looks like:

<xa-datasource>
<jndi-name>jdbc/MyDS</jndi-name>
<track-connection-by-tx>true</track-connection-by-tx>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSou rce</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:mysql://remote-machine-ip:3306/temp_mydb</xa-datasource-property>
<xa-datasource-property name="DatabaseName">temp_mydb</xa-datasource-property>
<user-name>user</user-name>
<password>pswd</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>3</idle-timeout-minutes>

<exception-sorter-class-name>
com.mysql.jdbc.integration.jboss.ExtendedMysqlExce ptionSorter
</exception-sorter-class-name>
<valid-connection-checker-class-name>
com.mysql.jdbc.integration.jboss.MysqlValidConnect ionChecker
</valid-connection-checker-class-name>


<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</xa-datasource>
--------------------------------------------------------------------------------
Coming to my problem: I can view any entity from the database using the webservice classes but I'm unable to create a record in the database from these classes. I've tried creating records from mysql clients like toad. But using my application it gives me following exception.

-------------------------------------------------------------------------------
WARN [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionM anager$TxConnectionEventListener@17bd154[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedCon nection@97e765 handles=1 lastUse=1268205838466 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossMana gedConnectionPool$OnePool@1d40b0 context=org.jboss.resource.connectionmanager.Inter nalManagedConnectionPool@821522 xaResource=org.jboss.resource.adapter.jdbc.xa.XAMa nagedConnection@97e765 txSync=null]
java.lang.NullPointerException
at org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.setString(WrappedPreparedStatement.java:316 )
at org.hibernate.type.StringType.set(StringType.java: 26)
at org.hibernate.type.NullableType.nullSafeSet(Nullab leType.java:136)
at org.hibernate.type.NullableType.nullSafeSet(Nullab leType.java:107)
at org.hibernate.persister.entity.AbstractEntityPersi ster.dehydrate(AbstractEntityPersister.java:2002)
at org.hibernate.persister.entity.AbstractEntityPersi ster.dehydrate(AbstractEntityPersister.java:1979)
at org.hibernate.persister.entity.AbstractEntityPersi ster$3.bindValues(AbstractEntityPersister.java:215 7)
at org.hibernate.id.insert.AbstractReturningDelegate. performInsert(AbstractReturningDelegate.java:32)
at org.hibernate.persister.entity.AbstractEntityPersi ster.insert(AbstractEntityPersister.java:2163)
at org.hibernate.persister.entity.AbstractEntityPersi ster.insert(AbstractEntityPersister.java:2643)
at org.hibernate.action.EntityIdentityInsertAction.ex ecute(EntityIdentityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:279)
at org.hibernate.event.def.AbstractSaveEventListener. performSaveOrReplicate(AbstractSaveEventListener.j ava:298)
at org.hibernate.event.def.AbstractSaveEventListener. performSave(AbstractSaveEventListener.java:181)
at org.hibernate.event.def.AbstractSaveEventListener. saveWithGeneratedId(AbstractSaveEventListener.java :107)
at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.saveWithGeneratedOrRequestedId(DefaultSaveO rUpdateEventListener.java:187)
at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.entityIsTransient(DefaultSaveOrUpdateEventL istener.java:172)
at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.performSaveOrUpdate(DefaultSaveOrUpdateEven tListener.java:94)
at org.hibernate.event.def.DefaultSaveOrUpdateEventLi stener.onSaveOrUpdate(DefaultSaveOrUpdateEventList ener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(Se ssionImpl.java:507)
at org.hibernate.impl.SessionImpl.saveOrUpdate(Sessio nImpl.java:499)
at org.hibernate.impl.SessionImpl.saveOrUpdate(Sessio nImpl.java:495)
at com.usemgmt.omd.ems.upgrade.MyDao.saveMyModel(MyDa o.java:107)
at com.usemgmt.omd.actions.ems.MyController.update(My Controller.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.struts2.rest.RestActionInvocation.invok eAction(RestActionInvocation.java:100)
at com.opensymphony.xwork2.DefaultActionInvocation.in vokeActionOnly(DefaultActionInvocation.java:279)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:242)
at org.apache.struts2.rest.RestWorkflowInterceptor.do Intercept(RestWorkflowInterceptor.java:228)
at com.opensymphony.xwork2.interceptor.MethodFilterIn terceptor.intercept(MethodFilterInterceptor.java:8 7)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.validator.ValidationInterc eptor.doIntercept(ValidationInterceptor.java:249)
at org.apache.struts2.interceptor.validation.Annotati onValidationInterceptor.doIntercept(AnnotationVali dationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterIn terceptor.intercept(MethodFilterInterceptor.java:8 7)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ConversionErro rInterceptor.intercept(ConversionErrorInterceptor. java:122)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.rest.ContentTypeInterceptor.int ercept(ContentTypeInterceptor.java:67)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInte rceptor.doIntercept(ParametersInterceptor.java:195 )
at com.opensymphony.xwork2.interceptor.MethodFilterIn terceptor.intercept(MethodFilterInterceptor.java:8 7)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.StaticParamete rsInterceptor.intercept(StaticParametersIntercepto r.java:148)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.CheckboxInterceptor .intercept(CheckboxInterceptor.java:93)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.FileUploadIntercept or.intercept(FileUploadInterceptor.java:235)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ModelDrivenInt erceptor.intercept(ModelDrivenInterceptor.java:89)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ScopedModelDri venInterceptor.intercept(ScopedModelDrivenIntercep tor.java:128)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInte rceptor.doIntercept(ParametersInterceptor.java:195 )
at com.opensymphony.xwork2.interceptor.MethodFilterIn terceptor.intercept(MethodFilterInterceptor.java:8 7)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.ProfilingActivation Interceptor.intercept(ProfilingActivationIntercept or.java:104)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.debugging.Debugging Interceptor.intercept(DebuggingInterceptor.java:26 7)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ChainingInterc eptor.intercept(ChainingInterceptor.java:126)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.I18nIntercepto r.intercept(I18nInterceptor.java:148)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.PrepareInterce ptor.doIntercept(PrepareInterceptor.java:138)
at com.opensymphony.xwork2.interceptor.MethodFilterIn terceptor.intercept(MethodFilterInterceptor.java:8 7)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.MessageStoreInterce ptor.intercept(MessageStoreInterceptor.java:204)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.ServletConfigInterc eptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.AliasIntercept or.intercept(AliasInterceptor.java:128)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ExceptionMappi ngInterceptor.intercept(ExceptionMappingIntercepto r.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.in voke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.DefaultActionProxy.execute (DefaultActionProxy.java:129)
at org.apache.struts2.dispatcher.Dispatcher.serviceAc tion(Dispatcher.java:468)
at org.apache.struts2.dispatcher.ng.ExecuteOperations .executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrep areAndExecuteFilter.doFilter(StrutsPrepareAndExecu teFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBas e.invoke(AuthenticatorBase.java:524)
at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve .invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread .run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Unknown Source)

-------------------------------------------------------------------------------

Please help and try to be elaborate about why this is happening.

Thanks a lot
Mar 10 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.