5 Replies Latest reply on Feb 29, 2016 2:59 PM by Steven Hawkins

    TEIID40113 Unhandled exception, aborting operation: java.io.IOException

    Rebeca Barros Newbie

      Hello,

       

      I built a VDB and everything works fine, I'm able to query any data and so on. But I'm trying to access the database through jdbc in a Maven Project and I get the following error when try to run my java application:

       

      21:28:16,342 WARN  [org.teiid.TRANSPORT] (New I/O worker #12) null TEIID40113 Unhandled exception, aborting operation: java.io.IOException: Foi forçado o cancelamento de uma conexão existente pelo host remoto
          at sun.nio.ch.SocketDispatcher.write0(Native Method) [rt.jar:1.8.0_65]
          at sun.nio.ch.SocketDispatcher.write(Unknown Source) [rt.jar:1.8.0_65]
          at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source) [rt.jar:1.8.0_65]
          at sun.nio.ch.IOUtil.write(Unknown Source) [rt.jar:1.8.0_65]
          at sun.nio.ch.SocketChannelImpl.write(Unknown Source) [rt.jar:1.8.0_65]
          at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$UnpooledSendBuffer.transferTo(SocketSendBufferPool.java:203) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.write0(AbstractNioWorker.java:202) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromUserCode(AbstractNioWorker.java:147) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:99) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.handler.stream.ChunkedWriteHandler.flush(ChunkedWriteHandler.java:280) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleDownstream(ChunkedWriteHandler.java:121) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.Channels.write(Channels.java:725) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.teiid.transport.ObjectEncoder.handleDownstream(ObjectEncoder.java:140) [teiid-runtime-8.11.5.jar:8.11.5]
          at org.jboss.netty.channel.Channels.write(Channels.java:704) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.Channels.write(Channels.java:671) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.teiid.transport.SSLAwareChannelHandler$ObjectChannelImpl.write(SSLAwareChannelHandler.java:93) [teiid-runtime-8.11.5.jar:8.11.5]
          at org.teiid.transport.SocketClientInstance.exceptionOccurred(SocketClientInstance.java:118) [teiid-runtime-8.11.5.jar:8.11.5]
          at org.teiid.transport.SSLAwareChannelHandler.exceptionCaught(SSLAwareChannelHandler.java:200) [teiid-runtime-8.11.5.jar:8.11.5]
          at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:74) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:328) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_65]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_65]
          at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_65]
      
      21:28:16,351 WARN  [org.teiid.TRANSPORT] (New I/O worker #12) null TEIID40113 Unhandled exception, aborting operation: java.io.IOException: Foi forçado o cancelamento de uma conexão existente pelo host remoto
          at sun.nio.ch.SocketDispatcher.read0(Native Method) [rt.jar:1.8.0_65]
          at sun.nio.ch.SocketDispatcher.read(Unknown Source) [rt.jar:1.8.0_65]
          at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source) [rt.jar:1.8.0_65]
          at sun.nio.ch.IOUtil.read(Unknown Source) [rt.jar:1.8.0_65]
          at sun.nio.ch.SocketChannelImpl.read(Unknown Source) [rt.jar:1.8.0_65]
          at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:64) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:328) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) [netty-3.6.10.Final-redhat-1.jar:3.6.10.Final-redhat-1]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_65]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_65]
          at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_65]
      
      

       

      My settings are:

      JBOSS EAP 6.4

      Teiid runtime (8.11.5)

      Teiid Designer: 9.2.0

      IDE: Eclipse Luna

      Java 1.8

       

      I'm really a begginner in Java EE development and Maven, I tried to put the Teiid dependences in pom.xml but it was getting a error so I set my local jar for the Teiid jdbc like this:

       

      <dependency>
                  <groupId>sample</groupId>
                  <artifactId>com.sample</artifactId>
                  <version>1.0</version>
                     <scope>system</scope>
                  <systemPath>${project.basedir}/src/main/resources/teiid-8.11.5-jdbc.jar</systemPath>
      </dependency>
      
      

       

      Thanks in advance and sorry for any misunderstood.

        • 1. Re: TEIID40113 Unhandled exception, aborting operation: java.io.IOException
          Ramesh Reddy Master

          Translation from Google says "It was forced to cancel an existing connection from the remote host"


          Rebecca,


          what operation are you doing when you saw this exception?


          Also a sample client is here teiid-quickstarts/pom.xml at master · teiid/teiid-quickstarts · GitHub, but the way you are doing also works.


          Ramesh..

          • 2. Re: TEIID40113 Unhandled exception, aborting operation: java.io.IOException
            Rebeca Barros Newbie

            Ramesh,

             

            I'm dealing with ontologies and access database trough it using a tool called Ontop. I trying to make the same java code found here -> https://github.com/ontop/ontop/wiki/attachments/EasyTutorialEclipse/eclipse_files.zip work with a Teiid VDB.

            And I'm following this tutorial here -> https://github.com/ontop/ontop/wiki/Easy-Tutorial%3A-Using-Ontop-API-from-Eclipse

            The only difference in my case is the files .owl and .obda and the database connection.

             

            In the .obda file we have to set up the database connection, so I set up:

             

            connectionUrl jdbc:teiid:dic@mm://localhost:31000
            username user
            password password
            driverClass org.teiid.jdbc.TeiidDriver
            

             

            The same code works just fine If I use a regular database connection (like MySQL), for instance. And I know that this jdbc connection for Teiid is right because I can use the same configuration to access the VDB trought Protégé (a ontology editor).

             

            Not sure if you can help me but thanks for answering it.

            • 3. Re: TEIID40113 Unhandled exception, aborting operation: java.io.IOException
              Steven Hawkins Master

              Rebeca,

               

              The exception is from the server log and in general we have an issue with our IO framework Netty, which means that some "normal" exceptions related to client disconnection are logged at a higher level than we'd like.  What behavior / exceptions are you seeing on the client side?

              • 4. Re: TEIID40113 Unhandled exception, aborting operation: java.io.IOException
                Rebeca Barros Newbie

                Steven,

                 

                Here is my app code:

                 

                 

                import it.unibz.krdb.obda.io.ModelIOManager;
                import it.unibz.krdb.obda.model.OBDADataFactory;
                import it.unibz.krdb.obda.model.OBDAModel;
                import it.unibz.krdb.obda.model.impl.OBDADataFactoryImpl;
                import it.unibz.krdb.obda.owlrefplatform.core.QuestConstants;
                import it.unibz.krdb.obda.owlrefplatform.core.QuestPreferences;
                import it.unibz.krdb.obda.owlrefplatform.owlapi3.QuestOWL;
                import it.unibz.krdb.obda.owlrefplatform.owlapi3.QuestOWLConnection;
                import it.unibz.krdb.obda.owlrefplatform.owlapi3.QuestOWLFactory;
                import it.unibz.krdb.obda.owlrefplatform.owlapi3.QuestOWLResultSet;
                import it.unibz.krdb.obda.owlrefplatform.owlapi3.QuestOWLStatement;
                
                import java.io.File;
                
                import org.semanticweb.owlapi.apibinding.OWLManager;
                import org.semanticweb.owlapi.model.OWLObject;
                import org.semanticweb.owlapi.model.OWLOntology;
                import org.semanticweb.owlapi.model.OWLOntologyManager;
                import org.semanticweb.owlapi.reasoner.SimpleConfiguration;
                
                public class QuestOWLExample {
                    
                    /*
                     * Use the sample database using H2 from
                     * https://github.com/ontop/ontop/wiki/InstallingTutorialDatabases
                     * 
                     * Please use the pre-bundled H2 server from the above link
                     * 
                     */
                    final String owlfile = "src/main/resources/example/file_name.owl";
                    final String obdafile = "src/main/resources/example/file_name.obda";
                
                    public void runQuery() throws Exception {
                
                        /*
                         * Load the ontology from an external .owl file.
                         */
                        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
                        OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(owlfile));
                
                        /*
                         * Load the OBDA model from an external .obda file
                         */
                        OBDADataFactory fac = OBDADataFactoryImpl.getInstance();
                        OBDAModel obdaModel = fac.getOBDAModel();
                        ModelIOManager ioManager = new ModelIOManager(obdaModel);
                        ioManager.load(obdafile);
                
                        /*
                         * Prepare the configuration for the Quest instance. The example below shows the setup for
                         * "Virtual ABox" mode
                         */
                        QuestPreferences preference = new QuestPreferences();
                        preference.setCurrentValueOf(QuestPreferences.ABOX_MODE, QuestConstants.VIRTUAL);
                
                        /*
                         * Create the instance of Quest OWL reasoner.
                         */
                        QuestOWLFactory factory = new QuestOWLFactory();
                        factory.setOBDAController(obdaModel);
                        factory.setPreferenceHolder(preference);
                        QuestOWL reasoner = (QuestOWL) factory.createReasoner(ontology, new SimpleConfiguration());
                
                        /*
                         * Prepare the data connection for querying.
                         */
                        QuestOWLConnection conn = reasoner.getConnection();
                        QuestOWLStatement st = conn.createStatement();
                
                        /*
                         * Get the book information that is stored in the database
                         */
                        String sparqlQuery = 
                                "PREFIX : <http://example.com/ontologies/file_name.owl#> \n" +
                                "PREFIX cap: <http://example.com/ontologies/file_name.owl#>" +
                                "SELECT ?incident \n" +
                                "WHERE { ?incident :hasIncidentType cap:Fire }" ;
                        
                        try {
                            QuestOWLResultSet rs = st.executeTuple(sparqlQuery);
                            int columnSize = rs.getColumnCount();
                            while (rs.nextRow()) {
                                for (int idx = 1; idx <= columnSize; idx++) {
                                    OWLObject binding = rs.getOWLObject(idx);
                                    System.out.print(binding.toString() + ", ");
                                }
                                System.out.print("\n");
                            }
                            rs.close();
                
                            /*
                             * Print the query summary
                             */
                            QuestOWLStatement qst = (QuestOWLStatement) st;
                            String sqlQuery = qst.getUnfolding(sparqlQuery);
                
                            System.out.println();
                            System.out.println("The input SPARQL query:");
                            System.out.println("=======================");
                            System.out.println(sparqlQuery);
                            System.out.println();
                            
                            System.out.println("The output SQL query:");
                            System.out.println("=====================");
                            System.out.println(sqlQuery);
                            
                        } finally {
                            
                            /*
                             * Close connection and resources
                             */
                            if (st != null && !st.isClosed()) {
                                st.close();
                            }
                            if (conn != null && !conn.isClosed()) {
                                conn.close();
                            }
                            reasoner.dispose();
                        }
                    }
                
                    /**
                     * Main client program
                     */
                    public static void main(String[] args) {
                        try {
                            QuestOWLExample example = new QuestOWLExample();
                            example.runQuery();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                

                 

                I noticed that after I change some dependencies in POM regarding to the OBDA framework that I'm using, when a run as Java Application I can see the results in Console but it disappears showing than the same error of this topic.

                • 5. Re: TEIID40113 Unhandled exception, aborting operation: java.io.IOException
                  Steven Hawkins Master

                  > when a run as Java Application I can see the results in Console but it disappears showing than the same error of this topic.


                  Are you getting any client side exceptions, seeing fewer results than expected, etc.?  If the client side behavior seems normal, then this is simply overly aggressive logging on the part of the server due to how we close exceptions from Netty.