Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2006
    Posts
    2

    Unanswered: Problem with storing SYBASE "IMAGE" DATA TYPE in jboss using entity bean

    Problem with storing SYBASE "IMAGE" DATA TYPE in jboss using entity bean

    We are using JBoss-4.0.4.GA, Entity Bean 2.x (CMP), Sybase 12.5
    File Name :- jconn2.jar
    File Version :- 1.4.2_04
    File Size :- 876 kb

    When we try to insert an object in to column of data type "IMAGE" in Sybase by using EJB 2.x we get the fallowing exception

    2006-11-24 13:31:58,328 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.parentTraceEnabled= true
    2006-11-24 13:31:58,359 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.nestedTraceEnabled= false
    2006-11-24 13:31:58,359 DEBUG [org.jboss.util.NestedThrowable] org.jboss.util.NestedThrowable.detectDuplicateNest ing=true
    2006-11-24 13:31:58,218 WARN [org.jboss.resource.connectionmanager.JBossManagedC onnectionPool] Exception destroying ManagedConnection org.jboss.resource.connectionmanager.TxConnectionM anager$TxConnectionEventListener@a97cec[state=DESTROYED mc=org.jboss.resource.adapter.jdbc.local.LocalMana gedConnection@1f71b53 handles=0 lastUse=1164355312640 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossMana gedConnectionPool$OnePool@22f376 context=org.jboss.resource.connectionmanager.Inter nalManagedConnectionPool@9ddfa3]
    org.jboss.resource.JBossResourceException: SQLException; - nested throwable: (java.sql.SQLException: JZ0C0: Connection is already closed.)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManaged Connection.checkException(BaseWrapperManagedConnec tion.java:541)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManaged Connection.destroy(BaseWrapperManagedConnection.ja va:255)
    at org.jboss.resource.connectionmanager.InternalManag edConnectionPool.doDestroy(InternalManagedConnecti onPool.java:539)
    at org.jboss.resource.connectionmanager.InternalManag edConnectionPool.returnConnection(InternalManagedC onnectionPool.java:329)
    at org.jboss.resource.connectionmanager.JBossManagedC onnectionPool$BasePool.returnConnection(JBossManag edConnectionPool.java:552)
    at org.jboss.resource.connectionmanager.BaseConnectio nManager2.returnManagedConnection(BaseConnectionMa nager2.java:407)
    at org.jboss.resource.connectionmanager.BaseConnectio nManager2$BaseConnectionEventListener.connectionEr rorOccurred(BaseConnectionManager2.java:768)
    at org.jboss.resource.connectionmanager.TxConnectionM anager$TxConnectionEventListener.connectionErrorOc curred(TxConnectionManager.java:550)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManaged Connection.broadcastConnectionError(BaseWrapperMan agedConnection.java:327)
    at org.jboss.resource.adapter.jdbc.BaseWrapperManaged Connection.connectionError(BaseWrapperManagedConne ction.java:313)
    at org.jboss.resource.adapter.jdbc.WrappedConnection. checkException(WrappedConnection.java:757)
    at org.jboss.resource.adapter.jdbc.WrappedStatement.c heckException(WrappedStatement.java:768)
    at org.jboss.resource.adapter.jdbc.WrappedPreparedSta tement.executeUpdate(WrappedPreparedStatement.java :320)

    __________________________________________________ __________________________________________________ _
    Here is the code for the bean



    /**
    * RecoverLogBean is an EntityBean. This EJBean illustrates:
    *
    * Container-managed JDBC persistence and transactions;
    * the code in this file never directly accesses the data storage.
    * Application-defined exceptions.
    * Use of EJB 2.0 relationships.
    * Use of EJB-QL in query methods.
    *
    * The javadoc comments in this document are critical and should be changed with consideration.
    * The EJBGen tool reads these comments and creates corresponding
    * EJB2.0 XML files as well as Home and Remote interfaces
    *
    * This bean uses EJBGen tags.
    *
    * @ejb.bean description="RecoverLog"
    * name="RecoverLog"
    * local-jndi-name="abs.RecoverLog"
    * type="CMP"
    * primkey-field = "id"
    * view-type="local"
    * cmp-version = "2.x"
    *
    * @jboss.persistence
    * table-name = "recoverLog"
    *
    * @ejb.pk class = "java.lang.Integer"
    *
    * @jboss.unknown-pk
    * column-name = "id"
    * jdbc-type = "INTEGER"
    * sql-type = "INTEGER"
    * class = "java.lang.Integer"
    *
    *
    */
    abstract public class RecoverLogBean implements EntityBean
    {
    // ----------------------------------------------------------- Constants
    // JNDI name of the EJB home object
    // NOTE: Any changes here should also be reflected in the deployment descriptor.
    public final static String JNDI_NAME = "abs.RecoverLog";
    public final static String TYPE_CANCEL_BET = "Bet Cancel";
    public final static String TYPE_PERSIST_BET = "Bet Persist";
    public final static String TYPE_ACCOUNT_BALANCE = "Account Balance";
    public final static String STATUS_PENDING = "Pending";
    public final static String STATUS_RESOLVED = "Resolved";
    public final static String STATUS_INPROGRESS = "InProgress";
    // Added for CR 4311 - status for reaching the max attempt with failures
    public static final String STATUS_DISCARDED = "Discarded";

    // ----------------------------------------------------------- Member Variables
    /**
    * The container assigned reference to the entity
    */
    private EntityContext context;

    // ----------------------------------------------------------- Constructors
    public RecoverLogBean() { /* do nothing */ }

    // ----------------------------------------------------------- Public EJB Methods
    public void setEntityContext(EntityContext ec) { context = ec; }

    public void unsetEntityContext() { this.context = null; }
    public void ejbActivate() { /* do nothing */ }

    public void ejbPassivate() { /* do nothing */ }

    public void ejbLoad() { /* do nothing */ }

    public void ejbStore() { /* do nothing */ }

    public void ejbRemove() throws javax.ejb.RemoveException { /* do nothing */ }

    /**
    * @ejb.create-method view-type = "local"
    *
    * @param info RecoverLogInfo
    * @return Integer pk
    * @throws CreateException
    */
    public Integer ejbCreate(RecoverLogInfo info) throws CreateException
    {
    //this.setId(new Long(new Date().getTime()));
    setAttemptCount(info.getAttemptCount());
    if(info.getStatus()==null)
    setStatus(STATUS_PENDING);
    else
    setStatus(info.getStatus());
    Object o = info.getObject();
    if(o instanceof BetPersistLogObject)
    this.setType(TYPE_PERSIST_BET);
    else if(o instanceof BetCancelLogObject)
    this.setType(TYPE_CANCEL_BET);
    else if(o instanceof BalanceLogObject) // Added for CR#3274 dt:5aug04
    this.setType(TYPE_ACCOUNT_BALANCE);
    this.setReferenceName(info.getReferenceName());
    setObject(o);
    setTimeEntered(info.getTimeEntered());
    setTimeUpdated(info.getTimeUpdated());
    return null;
    }

    /**
    * @param info RecoverLogInfo
    * @throws CreateException
    */
    public void ejbPostCreate(RecoverLogInfo info) throws CreateException
    {
    // do nothing
    }

    // ----------------------------------------------------------- Public Business Methods



    __________________________________________________ __________________________________________________ _
    Here is the data sourse file for sybase ie. sybaseDataSource-ds.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
    <local-tx-datasource>
    <jndi-name>sybaseDataSource</jndi-name>
    <connection-url>jdbc:sybase:Tds:system-name:5000/abs_dev?JCONNECT_VERSION=6</connection-url>
    <driver-class>com.sybase.jdbc2.jdbc.SybDriver</driver-class>
    <user-name>abs_dev</user-name>
    <password>abs_dev</password>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>5</max-pool-size>
    <track-statements/>true<track-statements/>
    <new-connection-sql><![CDATA[SELECT COUNT(*) FROM SYSTEMPROPERTY]]></new-connection-sql>
    <check-valid-connection-sql><![CDATA[SELECT COUNT(*) FROM SYSTEMPROPERTY]]></check-valid-connection-sql>
    <no-tx-separate-pools/>
    <track-connection-by-tx/>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.Sybase ExceptionSorter</exception-sorter-class-name>
    <metadata>
    <type-mapping>Sybase</type-mapping>
    </metadata>
    </local-tx-datasource>
    </datasources>

    __________________________________________________ ____________________________

    The Script which create the table is as fallows


    create table recoverLog1 (
    id numeric(8,0) identity ,
    status varchar(30) not null ,
    type varchar(30) not null ,
    referenceName varchar(60) not null ,
    object varchar(260) not null ,
    attemptCount numeric(2,0) not null ,
    timeEntered datetime not null ,
    timeUpdated datetime null ,

    constraint PK_recoverlog1 PRIMARY KEY CLUSTERED ( id )
    ) with identity_gap = 50 on 'default'
    go
    __________________________________________________ _______________________________________
    The fallowing things were observed
    1) No call to callback method ie. ejbPostCreate, ejbStore

  2. #2
    Join Date
    Feb 2002
    Location
    Willy is on vacation
    Posts
    1,208
    this is a bug in 5.5 use jconn3 or higher

  3. #3
    Join Date
    Dec 2006
    Posts
    2
    Quote Originally Posted by willy_and_the_ci
    this is a bug in 5.5 use jconn3 or higher
    I tried this but still it is not working

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •