Loading big files (more than 30MBs)  as byte arrays

Hello everybody,
I have an application in which I need to load files as byte arrays, but when I load a file with a size of 30MBs (aprox) or more I get this exception:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
The code I'm using to load the files is this:
               byte[] bb = null;
               Security.addProvider(new BouncyCastleProvider());
               try{
                    FileInputStream fis =
                    new FileInputStream(file);
                    bb = new byte[fis.available()];
                    fis.read(bb);
                    fis.close();
               }catch(IOException e){
                    e.printStackTrace();
     any ideas on this issue?'
thanks,
johnny

You really think you need to load the whole shebang
in one chunk of memory? And even if you get 30MB to
fit in, what if your file is 10 times that big - what
then? You need to redesign it so that it scales well.The reason is that I have to digitally sign the file, and the libraries I'm using (BouncyCastle) receive the file as a byte array, so I need to load the file as that to pass it to the libraries :-(
What do you think?

Similar Messages

  • How to load and unload more than one external swf files in different frames?

    I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
    I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
    Thanks

    Look into using the Loader class to load the swf files.  If you want to have it happen in different frames then you can put the code into the different frames.

  • Loading files more than 7 mb

    Hello,
    I know that there is an issue in BPEL loading files more than 7 mb. By increasing the JVM memory (using the mx parameter) we can bypass that (and it works fine). The problem is we loose the execution trace of the BPEL process in the management console. Is there any workaround for that ?
    Thanks for you input / help on that issue.

    By the way, since it is very large XML files with a lot of children nodes, we cannot split the XML file... ;-)
    Message was edited by:
    emarcoux

  • What phones have max jar file more than 300 kB?

    What phones have max jar file more than 300 kB? Model and max jar size, please.

    300k - thats really much.
    I'm pretty sure no phones support such big midlets when installed over-the-air.
    However, heres a link to the mobile database of Nokia:
    http://www.forum.nokia.com/main/0,6566,015-Band-GSM-9,00.html#matrix
    As you can see, it seems the Nokia6600 doen't have a max-midlet size...
    lg Linuxhippy

  • Hang Form Builder 10.1.2.3 for fmb files more than 2MB at Windows VISTA& 7

    Hi
    When i open fmb files more than 2MB with Form Builder (10.1.2.3) at Windows 7 form builder Hange and Close.
    Please help me if have any configuration or patch for forms builder.
    Regards
    Adel

    hi
    i think thats the VGA card problem check for compitible Driver.
    sarah

  • Lync powerpoint presentation error, not able to present ppt file more than 7mb

     Lync powerpoint presention error (either you've lost network connectivity or server is too busy to handle your request...) not able to do ppt file more than 7mb
    Small ppt files are working fine. Is there any settings we are missing?
    Thanks

    Hi Eric/ Edwin,
    I checked the parameters mentioned above every thing set to default.
    MaxContentStorageMb               
    : 500
    MaxUploadFileSizeMb               
    : 500
    MaxMemoryCacheSizeInMB           
    : 75  (This one we changed to 1024 now but still not working)
    CacheSizeInGB                    
    : 15
    PS C:\Users\xyz_lync2013> Get-OfficeWebAppsFarm
    FarmOU                           
    InternalURL                      
    : https://webappint.Int.net/
    ExternalURL                      
    : https://webappext.contoso.com/
    AllowHTTP                        
    : True
    SSLOffloaded                     
    : True
    CertificateName                  
    : web app cert
    EditingEnabled                   
    : False
    LogLocation                      
    : C:\ProgramData\Microsoft\OfficeWebApps\Data\Logs\ULS
    LogRetentionInDays               
    : 7
    LogVerbosity                     
    Proxy                            
    CacheLocation                    
    : C:\ProgramData\Microsoft\OfficeWebApps\Working\d
    MaxMemoryCacheSizeInMB           
    : 75
    DocumentInfoCacheSize            
    : 5000
    CacheSizeInGB                    
    : 15
    ClipartEnabled                   
    : False
    TranslationEnabled               
    : False
    MaxTranslationCharacterCount     
    : 125000
    TranslationServiceAppId          
    TranslationServiceAddress        
    RenderingLocalCacheLocation      
    : C:\ProgramData\Microsoft\OfficeWebApps\Working\waccache
    RecycleActiveProcessCount        
    : 5
    AllowCEIP                        
    : False
    ExcelRequestDurationMax          
    : 300
    ExcelSessionTimeout              
    : 450
    ExcelWorkbookSizeMax             
    : 10
    ExcelPrivateBytesMax             
    : -1
    ExcelConnectionLifetime          
    : 1800
    ExcelExternalDataCacheLifetime   
    : 300
    ExcelAllowExternalData           
    : True
    ExcelWarnOnDataRefresh           
    : True
    OpenFromUrlEnabled               
    : False
    OpenFromUncEnabled               
    : True
    OpenFromUrlThrottlingEnabled     
    : True
    PicturePasteDisabled             
    : True
    RemovePersonalInformationFromLogs : False
    AllowHttpSecureStoreConnections  
    : False
    Machines                         
    : {XYZLYN208, XYZLYN209}
    PS C:\Users\xyz_lync2013> 
    Get-CsConferencingConfiguration
    Identity                          
    : Global
    MaxContentStorageMb               
    : 500
    MaxUploadFileSizeMb               
    : 500
    MaxBandwidthPerAppSharingServiceMb : 375
    ContentGracePeriod                
    : 15.00:00:00
    ClientMediaPortRangeEnabled       
    : True
    ClientMediaPort                   
    : 5350
    ClientMediaPortRange              
    : 40
    ClientAudioPort                   
    : 50000
    ClientAudioPortRange              
    : 499
    ClientVideoPort                   
    : 55000
    ClientVideoPortRange              
    : 2499
    ClientAppSharingPort              
    : 57500
    ClientAppSharingPortRange         
    : 2499
    ClientFileTransferPort            
    : 60000
    ClientFileTransferPortRange       
    : 1000
    ClientSipDynamicPort              
    : 7100
    ClientSipDynamicPortRange         
    : 3

  • Is Photoshop CS6 can't save a file more than 2gegabites?

    Is Photoshop CS6 can't save a file more than 2gegabites?

    It depends on the file format, many formats are limited to 2 or 4 Gigabytes.
    PSB (Large Document Format) is not so limited.

  • .pck file (more than 5gb) not de-compressing to smspkgdriveletter$ on BDP

    SCCM 2007 R2
    .pck file (more than 5gb) not de-compressing to smspkgdriveletter$ on BDP
    .pck file which is distributed to BDP is not decompressing to SMSPKG share folder.
    .pck file is more than 5GB, i hear that this is a known issue but unfortunately i don't know the work around.:(
    Please help!

    The 'traditional' way the 32-bit virtual address space is split is 1 : 3GB (kernel : user). RHEL 3 hugemem kernel has a 4 : 4 GB split, recommended for >16GB RAM machines.
    In the case of Oracle server on RHEL, the 'default' theoretical max is around 1.7GB for SGA, or 2.7GB with hugemem kernel. That is, if you configure things correctly. E.g. have you set the shm kernel parameters?
    What is exactly the problem you run into?

  • Playing a sound file more than once in a row?

    OK, so I got the PlayWavFile code from the Internet, and I've modified it a bit so that it has a play method, but I'm trying to get it to play 5 times in a row. The thing is, I can't seem to get a for loop to work around it. Also, since I've never messed with sound before, I'm wondering: What is a line in reference to sound? I don't understand the comments.
    Here is the code I'm trying to execute (Note: I used skype-ringer.wav as an example, but any wav file will do):
    SSCCE Class
    package sscce;
    public class SSCCE
        public static void main(final String args[])
            final PlayWavFile wavFile = new PlayWavFile("skype-ringer.wav");
            for (int p = 0; p < 5; p++)
                wavFile.play();
    PlayWavFile Class
    package flashcards;
    import java.io.File;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.SourceDataLine;
    public class PlayWavFile
        AudioInputStream audioInputStream = null;
        SourceDataLine auline = null;
        AudioFormat format = null;
        DataLine.Info info = null;
        public PlayWavFile(final String soundFileName)
            final File soundFile = new File(soundFileName);
            if(!soundFile.exists())
                System.err.println("Wave file not found: " + soundFile);
                return;
            try
                audioInputStream = AudioSystem.getAudioInputStream(soundFile);
            catch(final Exception e)
                e.printStackTrace();
                return;
            format = audioInputStream.getFormat();
            info = new DataLine.Info(SourceDataLine.class,format);
            // Describe a desired line
        public void play()
            for (int i = 0; i < 5; i++)
                final int EXTERNAL_BUFFER_SIZE = 524288;
                final byte[] abData = new byte[EXTERNAL_BUFFER_SIZE];
                int nBytesRead = 0;
                try
                    auline = (SourceDataLine)AudioSystem.getLine(info);
                    auline.open(format); // Opens the line with the specified
                                            // format, causing the line to acquire
                                            // any required system resources and
                                            // become operational.
                catch(final Exception e)
                    e.printStackTrace();
                    return;
                auline.start(); // Allows a line to engage in data I/O
                try
                    while (nBytesRead != -1)
                        nBytesRead = audioInputStream.read(abData,0,abData.length);
                        if(nBytesRead >= 0)
                            auline.write(abData,0,nBytesRead); // Writes audio data
                                                                // to the mixer (an
                                                                // audio device with
                                                                // one or more
                                                                // lines) via this
                                                                // source data line
                    Thread.sleep(1000);
                catch(final Exception e)
                    e.printStackTrace();
                    return;
                finally
                    auline.drain(); // Drains queued data from the line by
                                    // continuing data I/O until the data line's
                                    // internal buffer has been emptied
                    auline.close(); // Closes the line, indicating that any system
                                    // resources in use by the line can be released
    }I've tried putting the for loop around the try block in the PlayWavFile.play method, but nothing works so far. What am I supposed to do if I want the file to play multiple times?

    I don't know if this will help. It's old - I haven't looked at it in at least five years - when I used to use hungarian notation
    What might help is using "m_SourceDataLine.isRunning()" in your for loop.
    private     SourceDataLine      m_SourceDataLine    = null;
    private     boolean             m_bOk;
    private     AudioInputStream    m_AudioInputStream     = null;
    private     int                 m_iBytesRead      = 0;
    private     byte []             m_bytesToWrite;
    if ( AudioSystem.isLineSupported( Port.Info.SPEAKER ) )
        String     strFile     = "SOUND528.WAV";
        File f = new File ( strFile );
        if ( f != null  &&  f.isFile() == true )
            m_AudioInputStream = AudioSystem    .getAudioInputStream    ( f );
            if ( m_AudioInputStream != null )
                //     more than enough to hold the complete file.
                m_bytesToWrite           = new byte[ 10000 ];
                //     Read the file and remember how many bytes were actually read.
                m_iBytesRead          = m_AudioInputStream     .read     ( m_bytesToWrite, 0, m_bytesToWrite.length );
                //     Now that you have read the file find out its format.
                AudioFormat          AF     = m_AudioInputStream     .getFormat     ();
                //     Clips don't allow pre-loading.  You must load it and play it at the same time.
                //DataLine.Info     info     = new DataLine               .Info           ( Clip.class, AF );
                //m_Clip                    = (Clip) AudioSystem     .getLine     ( info );                                   
                //m_Clip     .open          ( AIS );
                //     SourceDataLine's allow you to pre-read and play later.
                DataLine.Info     info     = new DataLine          .Info                ( SourceDataLine.class, AF );
                m_SourceDataLine          = (SourceDataLine)     AudioSystem          .getLine     ( info );
                //     The most important improvement is using open with the buffer size to use.
                //     Otherwise, if the buffer is too small the write function will block until
                //     the requested amount of data is written.  This then delays the video.
                m_SourceDataLine          .open     ( AF, m_iBytesRead );
                m_SourceDataLine          .start     ();
                //m_SourceDataLine     .write     ( m_bytesToWrite, 0, m_iBytesRead );
                //m_SourceDataLine     .isRunning()
    }

  • MDB cannot loads enitities if more than 10 concurrent messages are sent tog

    Hello,
    I have seen a weird behavior of the MDB in Jboss or perhaps in transaction management.
    Here is a my scenario
    I have a session bean sb, an entity bean e and a message driven bean mb
    When a request comes to sb , it persists a new entity e and send a message (primary key) to mb
    mb then loads e from the database using one of the findByXX method and does something else.
    If 10 concurrent request comes to sb, 10 different entities are persisted and 10 different messages are sent to mb
    mb are able to load 10 different e from the database
    Everything works fine as long as there are 10 concurrent request. If there are 13 concurrent request, then one or two mb
    cannot load e from the database. It seems that the session bean has persisted the entities but some of them are still unload able from mb. They have been persisted , (I saw in the logs), but mb cannot load them.
    Initially I thought that a transaction mishap might be happening, so instead of persisting the entity and sending the message in one method in sb , I separated these two tasks in two methods a and b, in which both a and b uses RequiresNew transaction attribute. But the problem still remains. Please note if the number of parallel request are less than 10 then everything works fine. Is there something I am missing or is Jboss doing something buggy?
    The above situation is reproducible .
    Here is some more information about the problem along with some code snapshots. Note that the code is trimmed for clarity purposes.
    Request is a simple entity (e as mentioned in the problem before) that is persisted in session bean . Here is a trimmed snapshot
    Request.java
    package gov.fnal.ms.dm.entity;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    @Entity
    @NamedQueries({@NamedQuery(name = "Request.findById", query = "SELECT r FROM Request r WHERE r.id = :id"),
    @NamedQuery(name = "Request.findAll", query = "SELECT r FROM Request r"),
    @Table(name = "cms_dbs_migration.Request")
    @SequenceGenerator(name="seq", sequenceName="cms_dbs_migration.SEQ_REQUEST")
    public class Request implements Serializable {
    private String detail;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="seq")
    @Column(nullable = false)
    private Long id;
    private String notify;
    .....The session bean is MSSessionEJBBean.
    MSSessionEJBBean.java
    @Stateless(name="MSSessionEJB")
    @WebService(endpointInterface = "gov.fnal.ms.dm.session.MSSessionEJBWS")
    public class MSSessionEJBBean implements MSSessionEJB, MSSessionEJBLocal, MSSessionEJBWS {
    @PersistenceContext(unitName="dm")
    private EntityManager em;
    .......    The methods that is called concurrently in this bean is
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public Request addRequest(String srcUrl, String dstUrl, String path,
    String dn, String withParents, String withForce, String notify) throws
    Exception {
    Request r = addRequestUnit(srcUrl, dstUrl, path, dn, withParents, withForce, notify);
    if (r != null) sendToQueue(r.getId());
    return r;
    }    It first adds the request entity and then sends a message to the queue in separate methods each using TransactionAttributeType.REQUIRES_NEW (I don't think this TransactionAttributeType is needed . I was just playing to see if this resolves the problem)
    Here is the method that actually persist the entity
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public Request addRequestUnit(String srcUrl, String dstUrl, String path,
    String dn, String withParents, String withForce, String notify) throws
    Exception {
    ....// Does something before persisting
    Request r = new Request();
    r.setNotify(notify);
    r.setPath(path);
    r.setPerson(p);
    r.setWithForce(withForce);
    r.setWithParents(withParents);
    r.setProgress(new Integer(0));
    r.setStatus("Queued");
    r.setDetail("Waiting to be Picked up");
    em.persist(r);
    System.out.println("Request Entity persisted");
    System.out.println("ID is " + r.getId());
    return r;
    }I can see that the log files has messages
    *{color:#800000}"Request Entity persisted" "ID is " 12 (or some other number){color}*
    . So it is safe to assume that the request entity is persisted properly before the message is sent to the queue. Here is how the message is sent to the queue
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    private void sendToQueue(long rId) throws Exception {
    QueueSession session = null;
    QueueConnection conn = null;
    try {
    conn = factory.createQueueConnection();
    session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
    MapMessage mapMsg = session.createMapMessage();
    mapMsg.setLong("request", rId);
    session.createSender(queueRequest).send(mapMsg);
    } finally {
    if (session != null) session.close();
    if(conn != null) try {
    conn.close();
    }catch(Exception e) {e.printStackTrace();}
    System.out.println("Message sent to queue");
    }I can see the message
    {color:#800000}*"Message sent to queue"*{color}
    in the log file right after I see the
    *{color:#800000}
    "Request Entity persisted"{color}*
    message. So it correct to assume that the message is infact sent to the queue.
    Here is the md bean that gets the message from the queue and process it
    @MessageDriven(activationConfig =
    @ActivationConfigProperty(propertyName="destinationType",
    propertyValue="javax.jms.Queue"),
    @ActivationConfigProperty(propertyName="destination",
    propertyValue="queue/requestmdb")
    public class RequestMessageDrivenBean implements MessageListener {
    @EJB
    private MSSessionEJBLocal ejbObj;
    public void onMessage(Message message) {
    try{
    System.out.println("Message recived ");
    if(message instanceof MapMessage) {
    System.out.println("This is a instance of MapMessage");
    MapMessage mMsg = (MapMessage) message;
    long rId = mMsg.getLong("request");
    List<Request> rList = ejbObj.getRequestById(new Long(rId));
    System.out.println("rList size is " +  rList.size());
    for(Request r: rList) {
    //Does something and print something in logs
    System.out.println("Finsihed onMessage");
    }catch(Exception e) {
    System.out.println(e.getMessage());
    }    One thing to note here is that getRequestById is another method in the same session bean MSSessionEJB. Can that be the reason for not loading the request from the database when many concurrent request are present? Here is what it does
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public List<Request> getRequestById(Long id) throws Exception {
    System.out.println("Inside getRequestById id is " + id);
    return em.createNamedQuery("Request.findById")
    .setParameter("id", id)
    .getResultList();
    }    In the logs I do see
    {color:#800000}*"This is a instance of MapMessage"*{color}
    and I do see the correct Rid that was persisted before in the log
    *{color:#800000}
    "inside getRequestById id is 12"{color}*
    . Finally I do see
    *{color:#800000}
    "Finsihed onMessage"{color}*
    for all the request no matter how many are sent concurrently.
    *{color:#ff0000}Here is where the problem is . rList size is 1 for most of the cases but it returns 0 when the number of concurrent message exceeds 10.*
    *{color}*
    So you see there is no exception per se, just that entity does not get loaded from the database. I would like to mention this again, it does work properly when the number of concurrent request are less than 10. All the invocation of onMessage in MB are able to load the entity properly in that case. Its only when the number of concurrent request increases more than 10, the onMessage is unable to load the entity and the rList is 0.
    FYI I am using jboss-4.2.2.GA on RedHat enterprise linux 4 with jdk1.6.0_04
    Please let me know if there is more information required on this.
    Thank you

    Hello,
    I have seen a weird behavior of the MDB in Jboss or perhaps in transaction management.
    Here is a my scenario
    I have a session bean sb, an entity bean e and a message driven bean mb
    When a request comes to sb , it persists a new entity e and send a message (primary key) to mb
    mb then loads e from the database using one of the findByXX method and does something else.
    If 10 concurrent request comes to sb, 10 different entities are persisted and 10 different messages are sent to mb
    mb are able to load 10 different e from the database
    Everything works fine as long as there are 10 concurrent request. If there are 13 concurrent request, then one or two mb
    cannot load e from the database. It seems that the session bean has persisted the entities but some of them are still unload able from mb. They have been persisted , (I saw in the logs), but mb cannot load them.
    Initially I thought that a transaction mishap might be happening, so instead of persisting the entity and sending the message in one method in sb , I separated these two tasks in two methods a and b, in which both a and b uses RequiresNew transaction attribute. But the problem still remains. Please note if the number of parallel request are less than 10 then everything works fine. Is there something I am missing or is Jboss doing something buggy?
    The above situation is reproducible .
    Here is some more information about the problem along with some code snapshots. Note that the code is trimmed for clarity purposes.
    Request is a simple entity (e as mentioned in the problem before) that is persisted in session bean . Here is a trimmed snapshot
    Request.java
    package gov.fnal.ms.dm.entity;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    @Entity
    @NamedQueries({@NamedQuery(name = "Request.findById", query = "SELECT r FROM Request r WHERE r.id = :id"),
    @NamedQuery(name = "Request.findAll", query = "SELECT r FROM Request r"),
    @Table(name = "cms_dbs_migration.Request")
    @SequenceGenerator(name="seq", sequenceName="cms_dbs_migration.SEQ_REQUEST")
    public class Request implements Serializable {
    private String detail;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="seq")
    @Column(nullable = false)
    private Long id;
    private String notify;
    .....The session bean is MSSessionEJBBean.
    MSSessionEJBBean.java
    @Stateless(name="MSSessionEJB")
    @WebService(endpointInterface = "gov.fnal.ms.dm.session.MSSessionEJBWS")
    public class MSSessionEJBBean implements MSSessionEJB, MSSessionEJBLocal, MSSessionEJBWS {
    @PersistenceContext(unitName="dm")
    private EntityManager em;
    .......    The methods that is called concurrently in this bean is
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public Request addRequest(String srcUrl, String dstUrl, String path,
    String dn, String withParents, String withForce, String notify) throws
    Exception {
    Request r = addRequestUnit(srcUrl, dstUrl, path, dn, withParents, withForce, notify);
    if (r != null) sendToQueue(r.getId());
    return r;
    }    It first adds the request entity and then sends a message to the queue in separate methods each using TransactionAttributeType.REQUIRES_NEW (I don't think this TransactionAttributeType is needed . I was just playing to see if this resolves the problem)
    Here is the method that actually persist the entity
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public Request addRequestUnit(String srcUrl, String dstUrl, String path,
    String dn, String withParents, String withForce, String notify) throws
    Exception {
    ....// Does something before persisting
    Request r = new Request();
    r.setNotify(notify);
    r.setPath(path);
    r.setPerson(p);
    r.setWithForce(withForce);
    r.setWithParents(withParents);
    r.setProgress(new Integer(0));
    r.setStatus("Queued");
    r.setDetail("Waiting to be Picked up");
    em.persist(r);
    System.out.println("Request Entity persisted");
    System.out.println("ID is " + r.getId());
    return r;
    }I can see that the log files has messages
    *{color:#800000}"Request Entity persisted" "ID is " 12 (or some other number){color}*
    . So it is safe to assume that the request entity is persisted properly before the message is sent to the queue. Here is how the message is sent to the queue
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    private void sendToQueue(long rId) throws Exception {
    QueueSession session = null;
    QueueConnection conn = null;
    try {
    conn = factory.createQueueConnection();
    session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
    MapMessage mapMsg = session.createMapMessage();
    mapMsg.setLong("request", rId);
    session.createSender(queueRequest).send(mapMsg);
    } finally {
    if (session != null) session.close();
    if(conn != null) try {
    conn.close();
    }catch(Exception e) {e.printStackTrace();}
    System.out.println("Message sent to queue");
    }I can see the message
    {color:#800000}*"Message sent to queue"*{color}
    in the log file right after I see the
    *{color:#800000}
    "Request Entity persisted"{color}*
    message. So it correct to assume that the message is infact sent to the queue.
    Here is the md bean that gets the message from the queue and process it
    @MessageDriven(activationConfig =
    @ActivationConfigProperty(propertyName="destinationType",
    propertyValue="javax.jms.Queue"),
    @ActivationConfigProperty(propertyName="destination",
    propertyValue="queue/requestmdb")
    public class RequestMessageDrivenBean implements MessageListener {
    @EJB
    private MSSessionEJBLocal ejbObj;
    public void onMessage(Message message) {
    try{
    System.out.println("Message recived ");
    if(message instanceof MapMessage) {
    System.out.println("This is a instance of MapMessage");
    MapMessage mMsg = (MapMessage) message;
    long rId = mMsg.getLong("request");
    List<Request> rList = ejbObj.getRequestById(new Long(rId));
    System.out.println("rList size is " +  rList.size());
    for(Request r: rList) {
    //Does something and print something in logs
    System.out.println("Finsihed onMessage");
    }catch(Exception e) {
    System.out.println(e.getMessage());
    }    One thing to note here is that getRequestById is another method in the same session bean MSSessionEJB. Can that be the reason for not loading the request from the database when many concurrent request are present? Here is what it does
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public List<Request> getRequestById(Long id) throws Exception {
    System.out.println("Inside getRequestById id is " + id);
    return em.createNamedQuery("Request.findById")
    .setParameter("id", id)
    .getResultList();
    }    In the logs I do see
    {color:#800000}*"This is a instance of MapMessage"*{color}
    and I do see the correct Rid that was persisted before in the log
    *{color:#800000}
    "inside getRequestById id is 12"{color}*
    . Finally I do see
    *{color:#800000}
    "Finsihed onMessage"{color}*
    for all the request no matter how many are sent concurrently.
    *{color:#ff0000}Here is where the problem is . rList size is 1 for most of the cases but it returns 0 when the number of concurrent message exceeds 10.*
    *{color}*
    So you see there is no exception per se, just that entity does not get loaded from the database. I would like to mention this again, it does work properly when the number of concurrent request are less than 10. All the invocation of onMessage in MB are able to load the entity properly in that case. Its only when the number of concurrent request increases more than 10, the onMessage is unable to load the entity and the rList is 0.
    FYI I am using jboss-4.2.2.GA on RedHat enterprise linux 4 with jdk1.6.0_04
    Please let me know if there is more information required on this.
    Thank you

  • Error in loading big file

    Hi All,
    I have an application on WL8.1 with sp3, the database is SQL Server 2000. I have code below to load local file into database. The data type in database is image.
    PreparedStatement pStatement = null;
    InputStreammyStream myStream = new InputStream();
    myStream.setEmbeddedStream( is );
    pStatement.setBinaryStream( 1, myStream, -1 );
    pStatement.executeUpdate();
    pStatement.close();
    pStatement = null;
    is is InputStream from a local file and the sql statement is
    insert into file_content(content) values(?)
    This workes fine for the files with size less than 150M, but for those big files (>150M), it doesn't work and I got error message as below:
    <Feb 11, 2005 12:00:41 PM PST> <Notice> <EJB> <BEA-010014> <Error occurred while attempting to rollback transaction: javax.transaction.SystemException: Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver]Object has been closed.))
    javax.transaction.SystemException: Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver]Object has been closed.))
    at weblogic.transaction.internal.ServerTransactionImpl.internalRollback(ServerTransactionImpl.java:396)
    at weblogic.transaction.internal.ServerTransactionImpl.rollback(ServerTransactionImpl.java:362)
    Any body can help? Thanks in advance.

    Fred Wang wrote:
    Hi All,
    I have an application on WL8.1 with sp3, the database is SQL Server 2000. I have code below to load local file into database. The data type in database is image.
    PreparedStatement pStatement = null;
    InputStreammyStream myStream = new InputStream();
    myStream.setEmbeddedStream( is );
    pStatement.setBinaryStream( 1, myStream, -1 );
    pStatement.executeUpdate();
    pStatement.close();
    pStatement = null;
    is is InputStream from a local file and the sql statement is
    insert into file_content(content) values(?)
    This workes fine for the files with size less than 150M, but for those big files (>150M), it doesn't work and I got error message as below:
    <Feb 11, 2005 12:00:41 PM PST> <Notice> <EJB> <BEA-010014> <Error occurred while attempting to rollback transaction: javax.transaction.SystemException: Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver]Object has been closed.))
    javax.transaction.SystemException: Heuristic hazard: (weblogic.jdbc.wrapper.JTSXAResourceImpl, HeuristicHazard, (javax.transaction.xa.XAException: [BEA][SQLServer JDBC Driver]Object has been closed.))
    at weblogic.transaction.internal.ServerTransactionImpl.internalRollback(ServerTransactionImpl.java:396)
    at weblogic.transaction.internal.ServerTransactionImpl.rollback(ServerTransactionImpl.java:362)
    Any body can help? Thanks in advance.I already answered this as to the cause, in the ms newsgroups... It's the DBMS choking so
    bad on the size of your image file that it actually kills the connection. Note that the DBMS
    has to save the whole image to log as well as to the DBMS table. The fundamental response is
    to get DBA help to configure the DBMS to be able to do what you want. If you want and can,
    you could split your image column into multiple image columns, and split your data into
    100meg chunks, and then enter an empty row and then update it column by column, and then
    concatenate the data again in the cleint when you get it out, etc, but much better to post
    to the MS server newsgroups for ideas.
    Joe

  • Not able to delete app icons that are in loading stage and more than 20mb, so cant be loaded completely.

    I am not able to delete the app icon (loading) of more than 20MB file app.
    I have downloaded them to my itunes but they just dont go away even after syncronising.
    just to mention i have 3G network but no wifi at present.

    Try resetting the iPad. Hold down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple logo appears and see if the loading icon is still there.
    If that doesn't work, try deleting the app from the iPad and then sync it again. Delete the app by syncing with iTunes and deselect the app.
    While your iPad is connected to your computer and iTunes is running, select your iPad on the left side bar, click on the apps tab in the iTunes window on the right, Uncheck the box next to the name of the app and then sync (click on apply) to remove the app from the iPad. Restart the iPad - hold down on the sleep button until the red slider appears, then slide to shut down, hold the sleep button until the Apple logo appears to start up.
    Then connect the iPad to the computer again and go through the same process except this time select the app and click on apply to put it back onto the iPad.
    See if that doesn't remove the loading icon.

  • Loading long text more than 60 maximum of 240 characters into cube

    hi experts,
    I am loading from  flat file some time the description field have more than 60 characters  below then 240, so kindly advise me how to load onto the description field in cube. How to split the description fields.

    Hi Rajesh,
    Please check the below SDN blog for Long Texts in SAP BW.
    Long texts in SAP BW: Modeling
    Also go through the below thread.
    Flat File Datasource
    Hope it helps.
    Regards,
    Raghu

  • Creating SQL-Loader script for more than one table at a time

    Hi,
    I am using OMWB 2.0.2.0.0 with Oracle 8.1.7 and Sybase 11.9.
    It looks like I can create SQL-Loader scripts for all the tables
    or for one table at a time. If I want to create SQL-Loader
    scripts for 5-6 tables, I have to either create script for all
    the tables and then delete the unwanted tables or create the
    scripts for one table at a time and then merge them.
    Is there a simple way to create migration scripts for more than
    one but not all tables at a time?
    Thanks,
    Prashant Rane

    No there is no multi-select for creating SQL-Loader scripts.
    You can either create them separately or create them all and
    then discard the one you do not need.

  • Unable to upload file more than 2 MB

    Hi I am trying to uplaod a file to Oracle DB using struts . The file is being stored as a blob datatype . When the file-size is more than 2 MB the file does not get uplaoded . The property mapped to the form attribute returns null . IBelow is part of the jsp code
    <html:form styleId="sponsorBio" action='<%=response.encodeURL("/sponsorBioUpdate.do")%>' method="POST" enctype="multipart/form-data" >
    <TR>
    <TD valign="top" class="txt_12_dblue">Attach Biography Document</TD>
    <TD valign="top" class="txt_12_dblue">:</TD>
    <TD><html:file name="biographyForm" property="biography.formFile" /></TD>
    </TR>
    The property biography.formFile is coming as null in the backend
    Can anyone pls help .

    2 megabytes or 2 gigabytes? I could see a limitation with the former (as this is the size of the absolute value of the max of a signed int). But 2mb seems more like some configuration option is fouling your upload. What and how are you using to parse the multi-part?
    - Saish

Maybe you are looking for

  • X100E clean install of Windows 7

    I got an X100E nearly a year ago and have never been happy with all the extra 'junk' software that came pre-installed with it.  Sure there are a few useful items, but like many business users, I'd much prefer a clean installation of Windows so I coul

  • Maximum package size for data packages was exceeded?

    Hi Experts, I am facing this problem "Maximum package size for data packages was exceeded". When I am trying to laod. I even tried to reduce data packet and change DTP settings in EXtraction to Get All New Data Request by Request but still same error

  • Sorting and deleting in SQ01..plz reply soon

    Hi all, i am developing ABAP query through transactions SQ01, SQ02 and SQ03. first i went to SQ03 then to SQ02 and then to SQ01. When i am going to SQ01, i want to sort the output based on one field. It shown there that if you want to sort on the bas

  • HT3281 anyone know how to delete podcasts off the new itunes please

    Hi Does anyone know how you delete podcasts of the new I-Tunes please Thank you 

  • Dreamweaver cs4

    I have just upgraded my pc and I am looking for the download for the dreamweaver cs4 I purchased. I have the activation key, just need the location for the download. can you help please? Thanks