Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Got Exception While Executing fetch()

    I have a DMI that I use to retrieve records from a from a LUT via JPA and populate a combobox.

    When the built-in fetch command executes, the following error shows up on the server:

    === 2011-12-15 08:55:19,373 [80-4] INFO IDACall - Performing 1 operation(s)
    === 2011-12-15 08:55:19,373 [80-4] DEBUG ServerObject - Couldn't find a public method named: fetch on class: com.sncorp.gs2.ui.server.LogTypeDMI
    === 2011-12-15 08:55:19,374 [80-4] DEBUG DataSourceDMI - DataSourceDMI: no public method name: fetch available on class: com.sncorp.gs2.ui.server.LogTypeDMI - defaulting to builtin operations.
    === 2011-12-15 08:55:19,375 [80-4] DEBUG AppBase - [builtinApplication.logType_fetch] No userTypes defined, allowing anyone access to all operations for this application
    === 2011-12-15 08:55:19,375 [80-4] DEBUG AppBase - [builtinApplication.logType_fetch] No public zero-argument method named '_logType_fetch' found, performing generic datasource operation
    === 2011-12-15 08:55:19,376 [80-4] DEBUG JPADataSource - [builtinApplication.logType_fetch] Creating EntityManager and starting transaction.
    === 2011-12-15 08:55:19,379 [80-4] DEBUG DSRequest - [builtinApplication.logType_fetch] Clobbering existing FreeResourcesHandler of type 'com.isomorphic.jpa.JPA2DataSource' with a 'com.isomorphic.jpa.JPA2DataSource'
    === 2011-12-15 08:55:19,379 [80-4] DEBUG JPADataSource - [builtinApplication.logType_fetch] Executing fetch.
    === 2011-12-15 08:55:19,380 [80-4] DEBUG JPADataSource - [builtinApplication.logType_fetch] Marking transaction for roll back.
    === 2011-12-15 08:55:19,381 [80-4] DEBUG JPADataSource - [builtinApplication.logType_fetch] Got exception while executing. Transaction will be rolled back.
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:604)
    at java.util.ArrayList.get(ArrayList.java:382)
    at com.isomorphic.datasource.DataSource.getPrimaryKey(DataSource.java:773)
    at com.isomorphic.jpa.JPADataSource.executeFetch(JPADataSource.java:523)
    at com.isomorphic.datasource.DataSource.execute(DataSource.java:1287)
    at com.isomorphic.jpa.JPADataSource.execute(JPADataSource.java:439)
    at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
    at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948)
    at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
    at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
    at java.lang.Thread.run(Thread.java:722)
    === 2011-12-15 08:55:19,440 [80-4] WARN RequestContext - dsRequest.execute() failed:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(ArrayList.java:604)
    at java.util.ArrayList.get(ArrayList.java:382)
    at com.isomorphic.datasource.DataSource.getPrimaryKey(DataSource.java:773)
    at com.isomorphic.jpa.JPADataSource.executeFetch(JPADataSource.java:523)
    at com.isomorphic.datasource.DataSource.execute(DataSource.java:1287)
    at com.isomorphic.jpa.JPADataSource.execute(JPADataSource.java:439)
    at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
    at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1948)
    at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
    at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
    at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
    at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)
    at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)
    at java.lang.Thread.run(Thread.java:722)
    === 2011-12-15 08:55:19,500 [80-4] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2011-12-15 08:55:19,501 [80-4] DEBUG JPADataSource - Rolling back current transaction.
    === 2011-12-15 08:55:19,503 [80-4] DEBUG RPCManager - non-DMI response, dropExtraFields: true


    This fetch worked at one point, but now I am not sure what might have changed to cause this. Further, I am positive that there are 4 entries in the database.

    ds.xml:

    Code:
    <DataSource ID="logType" serverConstructor="com.isomorphic.jpa.JPA2DataSource" beanClassName="com.sncorp.gs2.jee.entities.LogType">
        <fields>
            <field name="name" type="text" title="name"/>
            <field name="logtypeId" title="Log Type Id"/>
        </fields>
        <dropExtraFields>true</dropExtraFields>
        <serverObject className="com.sncorp.gs2.ui.server.LogTypeDMI"/>
        <operationBindings>
            <!--<operationBinding operationType="fetch" serverMethod="fetch"/>-->
            <operationBinding operationType="add" serverMethod="add"/>
            <operationBinding operationType="update" serverMethod="update"/>
            <operationBinding operationType="remove" serverMethod="remove"/>
            <operationBinding operationType="custom" operationId="startRawLogThread" serverMethod="startRawLogThread">
                <serverObject lookupStyle="new" methodName="startRawLogThread" className="com.sncorp.gs2.ui.server.LogTypeDMI"/>
            </operationBinding>
            <operationBinding operationType="custom" operationId="startFilteredLogThread" serverMethod="startFilteredLogThread">
                <serverObject lookupStyle="new" methodName="startFilteredLogThread" className="com.sncorp.gs2.ui.server.LogTypeDMI"/>
            </operationBinding>
        </operationBindings>
    </DataSource>
    ComboBoxItem code:

    Code:
    ComboBoxItem cbi = new ComboBoxItem("logType","Log Type");
            try
            {
                cbi.setOptionDataSource(dsLogTypes);
                cbi.setName("cbiLogTypes");
            }
            catch(Exception ex)
            {
                ex.printStackTrace();
            }
            return cbi;

    #2
    Looks like the cause is that your DataSource has no primaryKey field declared.

    Comment

    Working...
    X