Announcement Announcement Module
Collapse
No announcement yet.
HttpInvoker + Ibatis Crash Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HttpInvoker + Ibatis Crash

    Hi all,
    I've a serious problem whit spring 1.2.6 and ibatis 1.2.7.
    As spring's examples, i've create a web service (Server + client), and seems to work well.
    Seems!
    When i call an Ibatis sqlmap, ibatis executes it, but cannot post the data to the web service client!
    The problem seems the lazyLoadingEnabled="true" into the sqlMap config file.
    If i set the Lazyloading to false, i lost all performance!!!
    Any idea????
    My configuration:
    #########Ibatis sqlMap config#########

    <sqlMapConfig>

    <settings
    enhancementEnabled="true"
    lazyLoadingEnabled="true"
    useStatementNamespaces="true" />

    <sqlMap resource="ibatis/User.xml"/>

    </sqlMapConfig>

    ##########ApplicationContext##########
    <beans>
    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>java:comp/env/jdbc/axiosWebServiceServer</value>
    </property>
    </bean>

    <!-- Transaction manager for iBATIS DAOs -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSou rceTransactionManager">
    <property name="dataSource"><ref bean="dataSource"/></property>
    <property name="nestedTransactionAllowed">
    <value>true</value>
    </property>
    </bean>
    <!-- SqlMap setup for iBATIS Database Layer -->
    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClient FactoryBean" >
    <property name="configLocation">
    <value>classpath:/ibatis/config/SqlMapConfig.xml</value>
    </property>
    <property name="dataSource"><ref bean="dataSource"/></property>
    <!--property name="useTransactionAwareDataSource">
    <value>true</value>
    </property-->
    </bean>

    <bean id="userDAO" class="it.axiosinformatica.axiosWebServiceServer.d atabase.implementations.UserSqlMapDao">
    <property name="sqlMapClient"><ref bean="sqlMapClient"/></property>
    </bean>

    <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean"
    abstract="true">
    <property name="transactionManager" ref="transactionManager"/>
    <property name="transactionAttributes">
    <props>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="delete*">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
    </props>
    </property>
    </bean>


    <bean id="userManager" parent="baseTransactionProxy">
    <property name="target">
    <bean class="it.axiosinformatica.axiosWebServiceServer.m anager.impl.UserManagerImpl">
    <property name="userDAO"><ref bean="userDAO"/></property>
    <!--Other managers not listed-->>>
    </bean>
    </property>
    <property name="transactionAttributes">
    <props>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>


    </beans>


    #################Remoting-Servlet#####

    <bean name="/userManager" class="org.springframework.remoting.httpinvoker.Ht tpInvokerServiceExporter">
    <property name="service" ref="userManager"/>
    <property name="serviceInterface" value="it.axiosinformatica.axiosWebServiceServer.m anager.UserManager"/>
    </bean>

    ####################ApplicationContext Client#############

    <bean id="userManager" class="org.springframework.remoting.httpinvoker.Ht tpInvokerProxyFactoryBean">
    <property name="serviceUrl"><value>http://192.168.1.221:8084/axiosWebServiceServer/remoting/userManager</value>
    </property>
    <property name="serviceInterface"><value>it.axiosinformatica .webward.manager.UserManager</value>
    </property>
    </bean>

    ###################################

    So, the log.........

    10:51:24,916 INFO LoginAction:55 - Login Request from 127.0.0.1
    10:51:24,917 DEBUG SimpleHttpInvokerRequestExecutor:66 - Sending HTTP invoker request for service at [http://192.168.1.221:8084/axiosWebServiceServer/remoting/userManager], with size 361
    10:51:24,934 DEBUG DispatcherServlet:633 - DispatcherServlet with name 'remoting' received request for [/axiosWebServiceServer/remoting/userManager]
    10:51:24,935 DEBUG DispatcherServlet:844 - Testing handler map [org.springframework.web.servlet.handler.BeanNameUr lHandlerMapping@114d18f] in DispatcherServlet with name 'remoting'
    10:51:24,936 DEBUG BeanNameUrlHandlerMapping:134 - Looking up handler for [/userManager]
    10:51:24,940 DEBUG DispatcherServlet:883 - Testing handler adapter [org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter@1ca1a68]
    10:51:24,945 DEBUG HttpInvokerServiceExporter:73 - Applying RemoteInvocation: methodName='getUserListByLogin', parameterTypes=[class java.lang.String]
    10:51:24,946 DEBUG RemoteInvocationTraceInterceptor:64 - Incoming HttpInvokerServiceExporter remote call: it.axiosinformatica.axiosWebServiceServer.manager. UserManager.getUserListByLogin
    10:51:24,947 DEBUG TransactionInterceptor:221 - Getting transaction for it.axiosinformatica.axiosWebServiceServer.manager. UserManager.getUserListByLogin
    10:51:24,949 DEBUG DataSourceTransactionManager:253 - Using transaction object
    <!--open connection-->
    10:51:24,974 DEBUG Connection:23 - {conn-100006} Connection
    10:51:24,983 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.jdbc.datasource.ConnectionHold er@257b34] for key [org.apache.tomcat.dbcp.dbcp.BasicDataSource@12e4cd] bound to thread [http-8084-Processor22]
    10:51:24,985 DEBUG PreparedStatement:23 - {pstm-100007} PreparedStatement: SELECT * FROM PERSONALE WHERE SPER_LOGIN = ?
    10:51:24,989 DEBUG PreparedStatement:23 - {pstm-100007} Parameters: [administrator]
    10:51:24,997 DEBUG PreparedStatement:23 - {pstm-100007} Types: [java.lang.String]
    10:51:25,003 DEBUG ResultSet:23 - {rset-100008} ResultSet
    10:51:25,059 DEBUG ResultSet:23 - {rset-100008} Header: [PER_ID, PER_MATRICOLA, PER_COGNOME, PER_NOME, PER_NUMTESSERA, PER_PASSWORD, IPERFLAGPW, IPROFID, SPER_LOGIN, DPERLASTLOGIN, DPERLASTCHANGEPASSWORD, IPERNUMGIOSCAD, IPERNUMGIODISATT, IPROFID, PER_ID]
    10:51:25,067 DEBUG ResultSet:23 - {rset-100008} Result: [2, 99999, ADMIN , ADMIN , 99999, axios123, 1, 1, administrator, 2006-01-26 00:00:00.0, null, 0, 0, 1, 2]
    <!--Closing transaction-->
    processing of HttpInvokerServiceExporter remote call: it.axiosinformatica.axiosWebServiceServer.manager. UserManager.getUserListByLogin
    10:51:25,180 ERROR DispatcherServlet:412 - Could not complete request
    java.io.NotSerializableException: com.ibatis.sqlmap.engine.mapping.result.loader.Laz yResultLoader
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1075)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1369)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1341)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1284)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1073)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1369)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1341)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1284)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1073)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1369)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1341)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1284)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1073)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:291)
    at java.util.ArrayList.writeObject(ArrayList.java:569 )
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at java.io.ObjectStreamClass.invokeWriteObject(Object StreamClass.java:890)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1333)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1284)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1073)
    at java.io.ObjectOutputStream.defaultWriteFields(Obje ctOutputStream.java:1369)
    at java.io.ObjectOutputStream.writeSerialData(ObjectO utputStream.java:1341)
    at java.io.ObjectOutputStream.writeOrdinaryObject(Obj ectOutputStream.java:1284)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutp utStream.java:1073)
    at java.io.ObjectOutputStream.writeObject(ObjectOutpu tStream.java:291)
    at org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter.doWriteRemoteInvocationResult(Ht tpInvokerServiceExporter.java:270)
    at org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter.writeRemoteInvocationResult(Http InvokerServiceExporter.java:221)
    at org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter.writeRemoteInvocationResult(Http InvokerServiceExporter.java:197)
    at org.springframework.remoting.httpinvoker.HttpInvok erServiceExporter.handleRequest(HttpInvokerService Exporter.java:83)

    <!--More and more--->


    Anyone can help me???????????????????????????


    Thanks,
    Agharta

  • #2
    Getting this to work (lazy-loading in combination with a web services that requires serializable objects) is impossible, unless ibatis would be changed to include serializable lazy loaders.

    The only thing I'd see as a solution would be to create a web service that uses XML or something else you're creating manually to send it over the wire.

    regards,
    Alef Arendsen

    Comment


    • #3
      Originally posted by Alef Arendsen
      Getting this to work (lazy-loading in combination with a web services that requires serializable objects) is impossible, unless ibatis would be changed to include serializable lazy loaders.

      The only thing I'd see as a solution would be to create a web service that uses XML or something else you're creating manually to send it over the wire.

      regards,
      Alef Arendsen

      Thanks for reply, Alef.

      Your idea is great! I don't have think it(i'm a newbie). What you suggest??
      Rmi, Hessian, burlap, jaxrpc? I need the lazy loading and max compatibility with other web services clients (like delphi, .net and other).

      Any idea?

      Thanks in advance,

      Agharta

      Comment


      • #4
        Hi,
        I'll try to use Burlap, but i get the following exception:



        16:16:51,771 DEBUG DataSourceUtils:276 - Returning JDBC Connection to DataSource
        16:16:51,772 DEBUG RemoteInvocationTraceInterceptor:70 - Finished processing of BurlapServiceExporter remote call: it.axiosinformatica.axiosWebServiceServer.manager. UserManager.getUserListByLogin
        AbandonedObjectPool is used (org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool@1 46ad8b)
        java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Construc tor.java:494)
        at com.caucho.burlap.io.JavaDeserializer.instantiate( JavaDeserializer.java:168)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:111)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:774)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:134)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:113)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:774)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:134)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:113)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.MapDeserializer.readMap(MapDe serializer.java:93)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.MapDeserializer.readMap(MapDe serializer.java:93)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.MapDeserializer.readMap(MapDe serializer.java:93)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.MapDeserializer.readMap(MapDe serializer.java:93)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.MapDeserializer.readMap(MapDe serializer.java:93)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:138)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:113)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:778)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:134)
        at com.caucho.burlap.io.JavaDeserializer.readMap(Java Deserializer.java:113)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:913)
        at com.caucho.burlap.io.CollectionDeserializer.readLi st(CollectionDeserializer.java:97)
        at com.caucho.burlap.io.BurlapInput.readObject(Burlap Input.java:794)
        at com.caucho.burlap.io.BurlapInput.readReply(BurlapI nput.java:268)
        at com.caucho.burlap.client.BurlapProxy.invoke(Burlap Proxy.java:179)
        at $Proxy92.getUserListByLogin(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.remoting.caucho.BurlapClientIn terceptor.invoke(BurlapClientInterceptor.java:115)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :170)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:176)
        at $Proxy93.getUserListByLogin(Unknown Source)
        at it.axiosinformatica.webward.web.actions.login.Logi nAction.execute(LoginAction.java:67)
        at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:419)
        at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:224)
        at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1194)
        at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:432)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
        at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
        at org.displaytag.filter.ResponseOverrideFilter.doFil ter(ResponseOverrideFilter.java:125)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
        at it.axiosinformatica.webward.filter.SessionInactive Filter.doFilter(SessionInactiveFilter.java:103)
        at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
        at org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:362)
        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.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
        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:856)
        at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:744)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)
        Caused by: java.lang.NullPointerException
        at org.apache.tomcat.dbcp.dbcp.AbandonedObjectPool.<i nit>(AbandonedObjectPool.java:54)
        ... 72 more
        16:16:51,950 ERROR DispatcherServlet:412 - Could not complete request
        ClientAbortException: java.net.SocketException: Connection reset
        at org.apache.catalina.connector.OutputBuffer.realWri teBytes(OutputBuffer.java:366)
        AND MORE AND MORE

        Any idea?

        Comment


        • #5
          Burlap and Hessian both use the same serialization mechanism. Instead of using the normal Java serialization mechanism Hessian and Burlap both 'inspect' the objects and generate their own 'messages' they send over the wire.

          Using Burlap and Hessian are both tecniques that will work poorly in combination with lazy loading.

          I think the option you have is creating a SOAP web service with for example JAX-RPC in combination with Axis.

          regards,
          Alef

          Comment

          Working...
          X