GetOutputStream() has already been called for this response

I have a problem with my servlet,
i compiled my code,it works normally but there is an error occured when it works.
The error is :
java.lang.IllegalStateException: getOutputStream() has already been called for this response
*     at org.apache.catalina.connector.Response.getWriter(Response.java:607)*
*     at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:196)*
*     at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)*
*     at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)*
*     at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:179)*
*     at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:116)*
*     at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:76)*
*     at org.apache.jsp.KaptchaExample_jsp._jspService(KaptchaExample_jsp.java:209)*
*     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)*
*     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
*     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)*
*     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)*
*     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)*
*     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
*     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)*
*     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)*
*     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)*
*     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)*
*     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)*
*     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)*
*     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)*
*     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)*
*     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)*
*     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)*
*     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)*
*     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)*
*     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)*
*     at java.lang.Thread.run(Thread.java:534)*
here is my code :
Iterator iter = ImageIO.getImageWritersByFormatName(imageFormat);
*          if( iter.hasNext() ) {*
*          ImageWriter writer = (ImageWriter)iter.next();*
*          ImageWriteParam iwp = writer.getDefaultWriteParam();*
*          if ( imageFormat.equalsIgnoreCase("jpg") || imageFormat.equalsIgnoreCase("jpeg") ) {*
*          iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);*
*          iwp.setCompressionQuality(imageQuality);*
*          //writer.setOutput(ImageIO.createImageOutputStream(response.getWriter()));*
*          IIOImage imageIO = new IIOImage(bufferedImage, null, null);*
*          writer.write(null, imageIO, iwp);*
*          response.flushBuffer();*
please help me,would u give me a solutions for my problem..i really appreciate if you want to give a solution.
Regards,
Dany Fauzi

Actually the stack trace indicates the the error is happening in KaptchaExample.jsp, not in a Servlet. I'm guessing that the code you've presented is in a scriptlet (i.e. inside the JSP in <% %> brackets). This is altogether the wrong place for it. JSPs are purely for generating HTML and to try and generate image responses in one is doomed to failure. Write a servlet class to generate your image file. If you want to embed a dynamically generated image in an HTML page, then you need to generate HTML which accesses the Servlet through the <img src=... tag, i.e. the browser retrieves the image data as a separate transaction.
The immediate source of the crash is that the JSP already opened the output stream in order to write HTML output, so it's too late to try and open it for the writing of image data.

Similar Messages

  • ERROR: getOutputStream() has already been called for this response

    <font size="2"><p align="left">I am trying to export a pdf from a jsp page using the crystal report viewer. The jsp is deployed in a .war archive on JBoss 4.0.4. The PDF comes up fine, but each time I make the request I get the error listed below from the JBOSS console. Can anyone explain what is going wrong? How do I make thie message go away?</p><p align="left">&#160;</p><p align="left">16:33:50,966 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception</p></font><u><font size="2" color="#000080">java.lang.IllegalStateException</font></u><font size="2">: getOutputStream() has already been called for this response</font><font size="2"> <p align="left">at org.apache.catalina.connector.Response.getWriter(<u><font size="2" color="#000080">Response.java:599</font></u><font size="2">)at org.apache.catalina.connector.ResponseFacade.getWriter(</font></p></font><u><font size="2" color="#000080">ResponseFacade.java:195</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.jasper.runtime.JspWriterImpl.initOut(<u><font size="2" color="#000080">JspWriterImpl.java:124</font></u><font size="2">)at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(</font></p></font><u><font size="2" color="#000080">JspWriterImpl.java:117</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.jasper.runtime.PageContextImpl.release(<u><font size="2" color="#000080">PageContextImpl.java:191</font></u><font size="2">)at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(</font></p></font><u><font size="2" color="#000080">JspFactoryImpl.java:115</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(<u><font size="2" color="#000080">JspFactoryImpl.java:75</font></u><font size="2">)at org.apache.jsp.rptFBATAG_002dviewer_jsp._jspService(</font></p></font><u><font size="2" color="#000080">rptFBATAG_002dviewer_jsp.java:164</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.jasper.runtime.HttpJspBase.service(<u><font size="2" color="#000080">HttpJspBase.java:97</font></u><font size="2">)at javax.servlet.http.HttpServlet.service(</font></p></font><u><font size="2" color="#000080">HttpServlet.java:810</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.jasper.servlet.JspServletWrapper.service(<u><font size="2" color="#000080">JspServletWrapper.java:332</font></u><font size="2">)at org.apache.jasper.servlet.JspServlet.serviceJspFile(</font></p></font><u><font size="2" color="#000080">JspServlet.java:314</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.jasper.servlet.JspServlet.service(<u><font size="2" color="#000080">JspServlet.java:264</font></u><font size="2">)at javax.servlet.http.HttpServlet.service(</font></p></font><u><font size="2" color="#000080">HttpServlet.java:810</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(<u><font size="2" color="#000080">ApplicationFilterChain.java:252</font></u><font size="2">)at org.apache.catalina.core.ApplicationFilterChain.doFilter(</font></p></font><u><font size="2" color="#000080">ApplicationFilterChain.java:173</font></u><font size="2">)</font><font size="2"> <p align="left">at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(<u><font size="2" color="#000080">ReplyHeaderFilter.java:96</font></u><font size="2">)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(</font></p></font><u><font size="2" color="#000080">ApplicationFilterChain.java:202</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.catalina.core.ApplicationFilterChain.doFilter(<u><font size="2" color="#000080">ApplicationFilterChain.java:173</font></u><font size="2">)at org.apache.catalina.core.StandardWrapperValve.invoke(</font></p></font><u><font size="2" color="#000080">StandardWrapperValve.java:213</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.catalina.core.StandardContextValve.invoke(<u><font size="2" color="#000080">StandardContextValve.java:178</font></u><font size="2">)at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(</font></p></font><u><font size="2" color="#000080">SecurityAssociationValve.java:175</font></u><font size="2">)</font><font size="2"> <p align="left">at org.jboss.web.tomcat.security.JaccContextValve.invoke(<u><font size="2" color="#000080">JaccContextValve.java:74</font></u><font size="2">)at org.apache.catalina.core.StandardHostValve.invoke(</font></p></font><u><font size="2" color="#000080">StandardHostValve.java:126</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.catalina.valves.ErrorReportValve.invoke(<u><font size="2" color="#000080">ErrorReportValve.java:105</font></u><font size="2">)at org.apache.catalina.core.StandardEngineValve.invoke(</font></p></font><u><font size="2" color="#000080">StandardEngineValve.java:107</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.catalina.connector.CoyoteAdapter.service(<u><font size="2" color="#000080">CoyoteAdapter.java:148</font></u><font size="2">)at org.apache.coyote.http11.Http11Processor.process(</font></p></font><u><font size="2" color="#000080">Http11Processor.java:869</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(<u><font size="2" color="#000080">Http11BaseProtocol.java:664</font></u><font size="2">)at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(</font></p></font><u><font size="2" color="#000080">PoolTcpEndpoint.java:527</font></u><font size="2">)</font><font size="2"> <p align="left">at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(<u><font size="2" color="#000080">MasterSlaveWorkerThread.java:112</font></u><font size="2">)<p>at java.lang.Thread.run(<u><font size="2" color="#000080">Thread.java:595</font></u><font size="2">)</font></p></font></p></font>

    <p>Hi there,</p><p>     This issue is the same as the one in the following thread:</p><p><u><strong><a href="/node/711">http://diamond.businessobjects.com/node/711</a>  </strong></u></p><p>There are a few ideas in that thread to use as a work-around. </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) </p>

  • IllegalStateException: getOutputStream() has already been called

    Hi guys,
    I am writing JSP to retrieve data from database and export to the user as csv or zip file. It has to be binary. I would like to a download dialog to show up and allow users to choose where to save the exported file.
    Funcitonally, it works fine althrough I get an error page saying nothing to display. But it always complains that IllegalStateException: getOutputStream() has already been called for this session. I have done much research and testing, but....in vain.
    Hope somebody could help me with this. so frustrated that I am about to explode.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="application/octet-stream">
            <title>Load Page</title>
        </head>
        <body >
            <% OutputStream outRes = response.getOutputStream( ); %><%@page contentType="application/octet-stream"%><%
            %><%@page pageEncoding="UTF-8" import="java.sql.*,java.io.*,java.util.*,java.util.zip.*,java.math.BigDecimal;"%><%
            %><%
            try {
                Class.forName(ResourceBundle.getBundle("map").getString("driver"));
            } catch (ClassNotFoundException ex) {
               //ex.printStackTrace();
               return;
            String EXPORT_DIR = ResourceBundle.getBundle("map").getString("SUBMITTAL_EXPORT_DIR");
            String EXPORT_NAME = ResourceBundle.getBundle("map").getString("SUBMITTAL_NAME");
            String EXPORT_ZIP_NAME = ResourceBundle.getBundle("map").getString("SUBMITTAL_ZIP_NAME"); 
            String sqlQuery = "SELECT EMP_ID, EMP_NAME FROM EMP";
            Connection conn = null;
            Statement stmt = null;
            ResultSet rs = null;
            OutputStream expStream = null;
            boolean success = false;
            try {
                //out.println("<p>Connecting to the source database ...");
                // establish database connection
                conn = DriverManager.getConnection(
                        ResourceBundle.getBundle("map").getString("sqlurl"),
                        ResourceBundle.getBundle("map").getString("ORACLE_DBUSER"),
                        ResourceBundle.getBundle("map").getString("ORACLE_DBPASSWORD") );
                stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
                rs = stmt.executeQuery(sqlQuery);
                //out.println("Done</p>");
                // open a file to write
                File exportFile = new File(EXPORT_DIR + File.separatorChar + EXPORT_NAME);
                if (exportFile.exists())  exportFile.delete();
                exportFile.createNewFile();
                expStream = new BufferedOutputStream(new FileOutputStream(exportFile));
                // iterate all records to save them to the file
                //out.print("<p>Exporting the table data ...");
                while(rs.next()) {
                    String recordString = "";
                    ResultSetMetaData metaData = rs.getMetaData() ;
                    int colCount = metaData.getColumnCount();
                    for(int i=1; i<=colCount; i++) {
                        int colType = metaData.getColumnType(i);
                        switch(colType) {
                            case Types.CHAR: {
                                String sValue = rs.getString(i);
                                if (rs.wasNull())
                                    recordString += ("'',");
                                else
                                    recordString += ("'"+ sValue + "',");
                                break;
                            case Types.VARCHAR: {
                                String sValue = rs.getString(i);
                                if (rs.wasNull())
                                    recordString += ("'',");
                                else
                                    recordString += ("'"+ sValue + "',");
                                break;
                            case Types.FLOAT: {
                                float fValue = rs.getFloat(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (fValue + ",");
                                break;
                            case Types.DOUBLE: {
                                double dbValue = rs.getDouble(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (dbValue + ",");
                                break;
                            case Types.INTEGER: {
                                int iValue = rs.getInt(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (iValue + ",");
                                break;
                            case Types.NUMERIC: {
                                BigDecimal bdValue = rs.getBigDecimal(i);
                                if (rs.wasNull())
                                    recordString += (",");
                                else
                                    recordString += (bdValue + ",");
                                break;
                            default:
                                out.println("<p><font color=#ff0000> Unidentified Column Type "
                                        + metaData.getColumnTypeName(i) + "</font></p>"); */
                                success = false;
                                return;
                    recordString = recordString.substring(0, recordString.length()-1);
                    expStream.write(recordString.getBytes());
                    expStream.write((new String("\n")).getBytes());
                expStream.flush();
                //out.println("Done</p>");
                //out.println("<p>Data have been exported to " + filepath + "</p>");
                success = true;
            } catch (SQLException ex) {
               //out.println(ex.getStackTrace());
            } catch (IOException ex) {
               //out.println(ex.getStackTrace());
            } finally {
                if (expStream != null) {
                    try {
                        expStream.close();
                    } catch (IOException ex) {
                       // out.println(ex.getStackTrace());
                if (rs != null) {
                    try {
                        rs.close();
                    } catch(SQLException ex) {
                        //out.println(ex.getStackTrace());
                if (stmt != null) {
                    try {
                        stmt.close();
                    } catch(SQLException ex) {
                       // out.println(ex.getStackTrace());
                if(conn != null) {
                    try {
                        conn.close();
                    } catch(SQLException ex) {
                       // out.println(ex.getStackTrace());
            if (!success) return;
             * compress the exported CSV file if necessary
            int DATA_BLOCK_SIZE = 1024;
            if (request.getParameter("zip")!=null && request.getParameter("zip").equalsIgnoreCase("true")) {
                success = false;
                BufferedInputStream sourceStream = null;
                ZipOutputStream targetStream = null;
                try {
                    File zipFile = new File(EXPORT_DIR + File.separatorChar + EXPORT_ZIP_NAME);
                    if (zipFile.exists())  zipFile.delete();
                    zipFile.createNewFile();
                    FileOutputStream fos = new FileOutputStream ( zipFile );
                    targetStream = new ZipOutputStream ( fos );
                    targetStream.setMethod ( ZipOutputStream.DEFLATED );
                    targetStream.setLevel ( 9 );
                     * Now that the target zip output stream is created, open the source data file.
                    FileInputStream fis = new FileInputStream ( EXPORT_DIR + File.separatorChar + EXPORT_NAME );
                    sourceStream = new BufferedInputStream ( fis );
                    /* Need to create a zip entry for each data file that is read. */
                    ZipEntry theEntry = new ZipEntry ( EXPORT_DIR + File.separatorChar + EXPORT_NAME );
                     * Before writing information to the zip output stream, put the zip entry object
                    targetStream.putNextEntry ( theEntry );
                    /* Add comment to zip archive. */
                    //targetStream.setComment( "comment" );
                    /* Read the source file and write the data. */
                    byte[] buf = new byte[DATA_BLOCK_SIZE];
                    int len;
                    while ( ( len = sourceStream.read ( buf, 0, DATA_BLOCK_SIZE ) ) >= 0 ) {
                        targetStream.write ( buf, 0, len );
                     * The ZipEntry object is updated with the compressed file size,
                     * uncompressed file size and other file related information when closed.
                    targetStream.closeEntry ();
                    targetStream.flush ();
                    success = true;
                } catch ( FileNotFoundException e ) {
                    //e.printStackTrace ();
                } catch ( IOException e ) {
                    //e.printStackTrace ();
                } finally {
                    try {
                        if (sourceStream != null)
                            sourceStream.close ();
                        if (targetStream != null)
                            targetStream.close ();
                    } catch(IOException ex) {
                        //ex.printStackTrace();
                if (!success) return;
             * prompt the user to download the file
            //response.setContentType("text/plain");
            //response.setContentType( "application/octet-stream" );
            InputStream inStream = null;
            //OutputStream outRes = null;
            try {
                if (request.getParameter("zip")!=null && request.getParameter("zip").equalsIgnoreCase("true")) {
                    response.setHeader("Content-Disposition", "attachment;filename=" + EXPORT_ZIP_NAME);
                    inStream = new BufferedInputStream(new FileInputStream(EXPORT_DIR + File.separatorChar + EXPORT_ZIP_NAME));
                else {
                    response.setHeader("Content-Disposition", "attachment;filename=" + EXPORT_NAME);
                    inStream = new BufferedInputStream(new FileInputStream(EXPORT_DIR + File.separatorChar + EXPORT_NAME));
                out.clearBuffer();
                //outRes = response.getOutputStream(  );
                byte[] buf = new byte[4 * DATA_BLOCK_SIZE];  // 4K buffer
                int bytesRead;
                while ((bytesRead = inStream.read(buf)) != -1) {
                    outRes.write(buf, 0, bytesRead);
                outRes.flush();
                int byteBuf;
                while ( (byteBuf = inStream.read()) != -1 ) {
                    out.write(byteBuf);
                out.flush();
            } catch (IOException ex) {
                //ex.printStackTrace();
            finally {
                try {
                    if (inStream != null)
                        inStream.close();
                    if (outRes != null)
                        outRes.close();
                } catch(IOException ex) {
                    //ex.printStackTrace();
          %>
        </body>
    </html>

    So I went to the API: http://java.sun.com/j2ee/1.4/docs/api/
    Looked up ServletResponse, then looked for the getOutputStream() method. It says:
    "Throws:
    IllegalStateException - if the getWriter method has been called on this response"
    You can call only one of the getWriter or getOutputStream methods, not both. You are calling both. When you use a JSP, a variable called 'out' is generated (a PrintWriter) from the the Writer you get when response.getWriter() is called. This is done before your code gets executed as one of the functions that occur when a JSP is translated to a Servlet. You then write to that out variable when you print the HTML in the JSP code.
    This is best done in a Servlet, not a JSP, since there is no display and you require control over the servlet response.

  • Tomcat3.3, JSP, getOutputStream() has already been called

    In Tomcat 3.3a, I get an IllegalStateException....
    getOutputStream() has already been called... error
    when running a JSP page that renders an image.
    <img src="image.jsp?image=name.gif">
    I want to use JSP to keep everything JSP...and it works fine in Tomcat3.1. (actually, both Tomcat version work...
    just that 3.3a gives the exception)
    (Of course the servlet solution works fine in Tomcat3.3 ...which is my backup solution). The JSP code is.....
    FileInputStream inputStream = new FileInputStream(path+img);
    //System.out.println("inputStream.available()="+inputStream.available());
    byte x[] = new byte[inputStream.available()];
    inputStream.read(x);
    inputStream.close();
    response.setContentType("image/"+imgtype);
    ServletOutputStream outs = response.getOutputStream();
    outs.write(x);
    outs.flush();
    outs.close();
    Any ideas???
    PS.. I can't figure out how to change my old profile...
    My proper email address is [email protected]

    Not sure why this doesn't work - obviously the outputStream has already been used in the JSP. You could look at the generated servlet code to determine where this occurs. Another idea is to reset the buffer before opening the stream.
    Good Luck.

  • Connection has already been created in this tx ctxt for pool named cgPool

    Hi,
    I am getting the below error when I try to call a DB Control( pointing to DB2) when I run my Process in Weblogic WorkShop( BEA WeblogicWorkShop8.1.4)
    <b>Caused by: java.sql.SQLException: Connection has already been created in this tx context for pool named cgPool. Illegal attempt to create connection from another pool: Mypool</b>
    I even tried changing MyPool as XA- Connection Pool.
    I set the cgPool to Emulate 2phaseCommit- non XA.
    Still the error is occuring. I am not able to call any of my methods of the DB Control.
    MyPool is pointing to a DB2 Server.
    If Any of you guys have got a solution . Please post the solution on how to solve this problem!!
    Waiting for the Response
    Regards
    Ravi Upasi:O

    Hi,
    WebLogic Workshop uses a built-in connection pool, cgPool, to track conversation state. If you create a Database control that uses a data source created on a different connection pool, you may get an error that stating that you already have a transactional context created in the first pool (the one that Workshop is using to track state), and you cannot use data sources from two different connection pools within the same transaction. You can solve this problem by using a transactional (XA) driver.
    Solution: Please use a XA driver for your application pool and the error should go away.
    Thanks
    Vimala

  • APP-FND-01929: This responsibility has already been assigned to this user

    Dear All,
    While adding a new responsibility in the User Screen, I am getting the following Error:
    APP-FND-01929: This responsibility has already been assigned to this user. Please eneter a different responsibility.
    But in the list of responsibilities this particular responsibility is not added before..
    What will be the cause of this problem..
    How can I overcome this situation.. Please update...
    Many Thanks in advance.....

    Hi,
    As per your other thread, I believe you have restored couple of tables from your backup and this is not supported. In order to have everything running properly, then a full database restore should be done.
    Unable to login to application..
    Unable to login to application..
    Regards,
    Hussein

  • Java.sql.SQLException: Connection has already been created in this tx context for pool named adrxSYBDEV07

    I keep getting the following error when I try to use 2 different java.sql.Connections
    from 2 different database connection pools in my message ejb. The message ejb
    uses container managed transaction. The 2 connection pools point to different
    Sybase Servers.
    Any help will be much appreciated !!!
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named adrxSYBDEV07. Illegal attempt to create connection from another
    pool: Sybbev07Pool JDBCUtil > getConnection()

    Hi Eddie,
    "Eddie Baue" <[email protected]> wrote in message
    news:3ddbf74f$[email protected]..
    I keep getting the following error when I try to use 2 differentjava.sql.Connections
    from 2 different database connection pools in my message ejb. The messageejb
    uses container managed transaction. The 2 connection pools point todifferent
    Sybase Servers.In order to access more then one database base within
    a TX you need to have TXDataSources backed by XA
    connection pools...
    Regards,
    Slava Imeshev

  • SQLException: Connection has already been created in this tx context for...

    I get this Exception when i try to do persistance in one Oracle database after i received data from another Oracle database
    2010-08-24 10:41:44,185 2497 [[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR com.btick.ejb.db.MauSqlMapClient - excepcion al intentar ejecutar statement [CLIENTS.RegistrarMovimientos]
    java.sql.SQLException: Connection has already been created in this tx context for pool named ConnPoolClient. Illegal attempt to create connection from another pool: ConnPoolStore
         at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:608)
         at weblogic.jdbc.jts.Driver.connect(Driver.java:127)
         at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:339)
         at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
         at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
         at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject(GeneralStatement.java:104)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
         at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:541)
         at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
         at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:83)
         at com.btick.ejb.db.EntelSqlMapClient.queryForObject(MauSqlMapClient.java:150)
         at com.btick.ejb.archivos.SyniverseBean.persistData(SynBean.java:127)
         at com.btick.ejb.archivos.SyniverseBean.persist(SynBean.java:121)
    Can u help me how to solve this?
    I tried using differents drivers.
    Thanx in advance!

    Hi Mgaldames,
    Please refer to : http://weblogic-wonders.com/weblogic/forums/ejb-webservices-dev/#comment-1620
    Thanks
    Jay SenSharma

  • Connection has already been created in this tx context for pool named cgPoo

    Hi all,
    First of all apologies, as I know there have been multiple posts on the above issue but I have not as yet been able to resolve the issue.
    I am using weblogic 8.1 sp3 to develop a portal. As you are aware on the domain creation a connection pool cg pool is created. I am using an oracle driver (oraclei 8.1.7 thin ).
    I have to create another jdbc ( clin_live )connection pool, which I also use the oracle 8 (oraclei 8.1.7 thin) and when I create the data source ( clinPool) for this I check the "emulate 2 phase commit".
    The connection pool and the data source both deploy ok but when I use the clinPool datasource I get the following error.
    Failure=java.sql.SQLException: Connection has already been created in this tx context for pool named cgPool. Illegal attempt to create connection from another pool: clin_live [ServiceException]>
    From the previous posts I understand that weblogic will let you have only one non-xa connection pool and cgPool must be non-xa.
    In trying to resolve this I have created the pool using the oracle thin XA driver without much luck.
    If any one has a solution I would be very grateful.
    Many thanks,
    Niambh

    Niambh,
    you can have only one non-xa datasource participating in a transaction. Emulating or faking XA means only that WLS does first all the operations for the XA resources, then the one non xa, and based on the result of this either commit or rollback.
    So obviously only one resource can "emulate 2PC).
    But there can be as many non XA db connections as you want, as long as they are not participating in the transaction.
    Check your datasources.
    I think the reason to use non-XA driver and "emulate 2PC" for Oracle is mainly the poor performance of the XA driver prior to 10g.
    Check also, if your Oracle database is XA enabled at all. I have seen some issues with customers, where the necessary PL/SQL packages have not been installed and therefore the thin XA driver did not work.
    -Kai

  • Connection has already been created in this tx context for pool

    Hello
              I can´t use WLS 6.0 I must use WLS 5.1. So I can´t to use distributed
              transactions.
              So that, Can I to simulate this situation???
              Client code:
              method
              UserTransaction.begin
              class1.create
              class2.updateDatabaseOracle1
              this.comit();
              Exception
              this.rollback();
              method commit
              class1.commit();
              class2.commit();
              UserTransaction.commit
              methdo rollback
              class1.rollback;
              class2.rollback;
              UserTransaction.rollback
              class1
              create
              EJBCreate
              commit
              EJB.putData
              rollback
              EJB.remove
              I get this Error:
              "Connection has already been created in this tx context for pool
              named pool1. Illegal attempt to create connection from another
              pool: pool2"
              Please Help How can I do it?
              Miguel Lopez Montero
              Soluziona Servicios Internet,Spain
              

    Niambh,
    you can have only one non-xa datasource participating in a transaction. Emulating or faking XA means only that WLS does first all the operations for the XA resources, then the one non xa, and based on the result of this either commit or rollback.
    So obviously only one resource can "emulate 2PC).
    But there can be as many non XA db connections as you want, as long as they are not participating in the transaction.
    Check your datasources.
    I think the reason to use non-XA driver and "emulate 2PC" for Oracle is mainly the poor performance of the XA driver prior to 10g.
    Check also, if your Oracle database is XA enabled at all. I have seen some issues with customers, where the necessary PL/SQL packages have not been installed and therefore the thin XA driver did not work.
    -Kai

  • Connection has already been created in this tx context

    Hi All,
    I am experiencing this problem and I am not able to find the solution for this.
    Please help.
    I have stateless EJB ('REQUIRED') and within that I have many EJB's using 'SUPPORTS'
    as transaction and in the flow I am also calling DAO object which invokes JDBC
    ( using TXDataSource) call from different Datasource from the one above EJB.
    I get SQL EXception as
    "SQLException while getting DB connection : Connection has already been created
    in this tx context for pool named oraclePool. Illegal attempt to create connection
    from another pool: sybPool "
    I am not able to figure out why this error is coming. Any help will be appreciated!
    Regards
    SH

    Hi all,
    I am facing this same problem
    i am using database for weblogic integrator
    Pointbase
    and oracle for my system.
    I didn't get the what u meant by XA driver
    Regards,
    Cleophus Pereira
    "Slava Imeshev" <[email protected]> wrote:
    Hi Sanjeev,
    Slava
    "Sanjeev" <[email protected]> wrote in message
    news:3d6f55bd$[email protected]..
    Hi All,
    I am experiencing this problem and I am not able to find the solutionfor this.
    Please help.
    I have stateless EJB ('REQUIRED') and within that I have many EJB'susing
    'SUPPORTS'
    as transaction and in the flow I am also calling DAO object which invokesJDBC
    ( using TXDataSource) call from different Datasource from the one aboveEJB.
    I get SQL EXception as
    "SQLException while getting DB connection : Connection has alreadybeen
    created
    in this tx context for pool named oraclePool. Illegal attempt to createconnection
    from another pool: sybPool "
    I am not able to figure out why this error is coming. Any help willbe
    appreciated!
    Regards
    SH

  • PDF has not been configured for this web server linux 11.1.2

    Hi,
    We installed 11.1.2 Hyperion WorkforcePlanning on Linux 32 bit OS.
    When the user opens the workspace and tries to see the "Profit and Loss" and selects
    "File --> Open In --> PDF format" , it just flicks for a sec and gives following message :
    " PDF has not been configured for this web server"
    Can somebody suggest me what to do ?
    Appreciate your response.
    Edited by: user536857 on Mar 22, 2011 3:07 PM

    Check your print server service on your foundation server, sometimes I have had that just stop for whatever reason.

  • Simple Entity Bean JWS fails: Connection has already been created in this tx context

    I am new to Weblogic Workshop 8.1, and trying to create an EntityBean from a pre-existing
    database table.
    I get an error that indicates the JWS is using the default cgPool rather then
    my new pool for some transaction.
    I added my database (DB2) pool and data source, and then created an entity bean
    using "New Entity Bean from database table.
    I then wrapped this Entity Bean in a control and generated a JWS.
    When I run the JWS and execute FindByPrimaryKey, I get the following error:
    Submitted at Friday, April 2, 2004 11:07:30 AM CST
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Couldn't get connection:
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:410)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:141)

    I am new to Weblogic Workshop 8.1, and trying to create an EntityBean from a pre-existing
    database table.
    I get an error that indicates the JWS is using the default cgPool rather then
    my new pool for some transaction.
    I added my database (DB2) pool and data source, and then created an entity bean
    using "New Entity Bean from database table.
    I then wrapped this Entity Bean in a control and generated a JWS.
    When I run the JWS and execute FindByPrimaryKey, I get the following error:
    Submitted at Friday, April 2, 2004 11:07:30 AM CST
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Couldn't get connection:
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    java.sql.SQLException: Connection has already been created in this tx context
    for pool named cgPool. Illegal attempt to create connection from another pool:
    ATGW_POOL
    at weblogic.jdbc.jts.Driver.getExistingConnection(Driver.java:410)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:141)

  • Error occurred in deployment step 'Add Solution': A feature with ID '' has already been installed in this farm. Use the force attribute to explicitly re-install the feature.

    Hi I am getting the error
    Error occurred in deployment step 'Add Solution': A feature with ID 10495515-2482-41fd-98eb-3c87f739f54b has already been installed in this farm.  Use the force attribute to explicitly re-install the feature.
    when trying to deploy web parts
    question 1 - how do i use the force attribute when deploying from visual studio
    question 2 - am i deplying it to the right place, if i deply it to the
    url:port that points to my central admin tool it deploys but i cant seem to see it in any of my webs in my site collection, if i deploy it to the
    url:port that points to my site collection I get this error.
    im new to all this by the way :)
    thanks in advance

    If you are deploying from Visual Studio then please follow this post:
    http://sharepointfordeveloper.blogspot.com/2014/03/solved-visual-studio-issue-error.html
    Open the visual Studio and navigate to the feature XML file and add the bellow attribute.
    AlwaysForceInstall="TRUE"
    The <FeatureName>.Template.Xml output would be some think link this.
    <?xml
    version="1.0"
    encoding="utf-8"
    ?><Feature
    xmlns="http://schemas.microsoft.com/sharepoint/"
    AlwaysForceInstall="TRUE"></Feature>

  • Error message:this version of itunes has not been localized for this language. please run the english version

    Error message received when trying to open Itunes. This version of Itunes has not been localized for this language. Please run the english version.

    Let's try a repair install of iTunes.
    Restart the PC first.
    If you're using Vista or 7, now head into your Uninstall a program control panel, select "iTunes" and then click "Repair".
    If you're using XP, head into your Add or Remove Programs control panel, select "iTunes", and click "Change". Select "Repair" and click "Next" as per the following screenshot:
    Can you launch your iTunes now?

Maybe you are looking for