JPA Weird Transaction error ... ?

Hi All,
For this code i am getting a weird exception which follows the code block..
i have started a Transaction but still openjpa gives this exception
  public static void deletePort(String port){
       BcsPort bPort=em.find(BcsPort.class, port);
       try{
               EntityTransaction tx= em.getTransaction();
               tx.begin();
               System.out.println("Active:" +tx.isActive()); //*Prints True*
               em.remove(bPort);
               tx.commit();
       if(em.isOpen())
            em.flush();
       em.clear();
       }catch (Exception e) {
            e.printStackTrace();
Exception Stack Trace
ERROR:  Can only perform operation while a transaction is active.
<openjpa-1.0.0-r420667:568756 nonfatal user error> org.apache.openjpa.persistence.TransactionRequiredException: Can only perform operation while a transaction is active.
     at org.apache.openjpa.kernel.BrokerImpl.assertActiveTransaction(BrokerImpl.java:4301)
     at org.apache.openjpa.kernel.DelegatingBroker.assertActiveTransaction(DelegatingBroker.java:1314)
     at org.apache.openjpa.persistence.EntityManagerImpl.flush(EntityManagerImpl.java:487)
     at com.test.local.EntityManagerTester.deletePort(EntityManagerTester.java:180)
     at test.TestJPA.JPAInit(TestJPA.java:100)
     at test.TestJPA.testMutiple(TestJPA.java:152)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at junit.framework.TestCase.runTest(TestCase.java:168)
     at junit.framework.TestCase.runBare(TestCase.java:134)Help on this please
Thanks..

>
          tx.commit();
     if(em.isOpen())
          em.flush();
     em.clear();
     }catch (Exception e) {
          e.printStackTrace();
sry my bad ... em.flush() is the culprit

Similar Messages

  • Weird Pacman Error! [solved]

    Since last night, I've been getting this weird error when I run 'pacman -Syu' as root. What's going on?
    :: Synchronizing package databases...
    current 71.2K 143.5K/s 00:00:00 [#####################] 100%
    extra is up to date
    community 274.6K 339.7K/s 00:00:01 [#####################] 100%
    :: Starting full system upgrade...
    resolving dependencies... done.
    looking for inter-conflicts... done.
    Targets: gd-2.0.35-1 gstreamer0.10-good-0.10.6-1 gstreamer0.10-flac-0.10.6-1
    gstreamer0.10-gconf-0.10.6-1
    Total Package Size: 0.84 MB
    Proceed with installation? [Y/n]
    :: Retrieving packages from current...
    gd 175.9K 627.3K/s 00:00:00 [#####################] 100%
    checking package integrity... done.
    cleaning up... done.
    (4/4) checking for file conflicts [#####################] 100%
    error: could not prepare transaction
    error: failed to commit transaction (conflicting files)
    gstreamer0.10-good: /usr/lib/gstreamer-0.10/libgstqtdemux.so exists in filesystem
    gstreamer0.10-good: /usr/lib/gstreamer-0.10/libgstvideocrop.so exists in filesystem
    errors occurred, no packages were upgraded.
    Any ideas, anyone?
    Last edited by tony5429 (2007-06-29 22:38:16)

    @ tony5429
    I was running in a semilar problem!
    I forced the update from gstreamer0.10-good with
    pacman -Syf gstreamer0.10-good
    after then I run again
    pacman -Syu
    and all run normal.
    You can also read here in this topic about it
    http://bbs.archlinux.org/viewtopic.php?id=34669
    the arch developmer tomk wrote
    tomk wrote:If you're not in a hurry, wait for the -bad package upgrade. Otherwise, I'd suggest -Syf for the -good package, followed by -Su for everything else.
    cheers
    JaDa

  • ORABPEL-08033: EJB Transaction Error

    Hi
    I have a usecase in which procA(sync Service) calling procB (Async Service) and on completion of execution, ProcB gives a non blocking invoke back to procA. Condition: The either of one should be in running state always.
    However there are fault situation in ProcB hence to not to break the sequence we have put a catchAll block which handles/logs and then gives the non blocking invoke back to procA.
    But when ProcB fails somewhere because of some other partner links, it is safely going into catchAll and handling it well and when it tries to do a non blocking invoke it is resulting in following:
    ORABPEL-08033
    EJB Transaction Error.
    EJB exception happened while invoking the partner. Please verify partner service.
    Can somebody give me some leads in this?
    TIA
    regards
    Joy

    I have setup catch statements, both an catch all in the outermost scope and a catch for remote fault at the scope surrounding the call to the AQ. But that's not the issue. The problem is that BPEL don't get the error. The error stay's at the adapter and the BPEL don't come to a failed state.

  • FU 065:-Document belongs to cross company- code transaction(error massage)

    Hi expert,
    I am going to reverse a document (after resetting through LSMW,useing -F.80 as for mass reversal) and getting a error massage below(this document has been generated after F110)
    FU 065:-Document belongs to cross company- code transaction(error massage)
    Please advise me how can I reverse this document and also advise me what does it mean,
    Will it be done by FBU8? (But when I am using it,showing two documents what does it mean and advise should I select both document for reversal)
    Please advise
    Thanks & Regards

    Hi
    Thanks for your quick advise,
    I am trying to do that through FBU8 but I am getting there two documents numbere inside for reversal (it contained two documents)
    Should I reverse both documents or I should select one one only
    Please advise why it is showing two documents inside
    Thanks & Regards

  • Error (-1200) DBMCconnBase; End Transaction- Error -1 detected, auto rollba

    Que tal!!!
    Pues ahora tengo este problema, este sap nos esta sacando canas verdes!!
    resulta que cuando se esta realizaondo una factura y aparece la ventana donde se ingresa el numero de folio del documento y se da el OK aparece ese error
    (-1200) DBMCconnBase; End Transaction- Error -1 detected, auto rollback flag is off, Throwing exception
    cuando lo aceptamos solo cierra SAP, ingresamos de nuevo yse puede facturar durante el dia se presenta de manera aleatoria!!
    siento que es grave el error.. asi que espero que me puedan ayudar!!

    Mi estimado, ese es un bug segun nota 1401013 de SAP, ocurre cuando dos usuarios estan trabajando simultaneamente.
    Aqui el texto de la misma nota.
    Summary
    Symptom
    You work in localization where folio numbers for documents are used.
    Two users are working simultaneously on SAP Business One (either via SAP Business One application or via an Add-on).
    Both users are creating Invoice (or performing any action when max folio number is retrieved from the numbering table NNM1).
    It may happen that one of the users will encounter deadlocks while working, usually with one of the following error messages:
    '-2038 Internal error'
    'Error (-1200) DBMCconnBase:: EndTransaction - Error -1 detected. auto rollback flag is off. throwing exception'
    'Internal error NNM1 2038'
    The deadlock can appear on NNM1 table and OINV table.
    Other terms
    Lock, Add, Error, Crash, Close, Exit, Operation, Action, Parallel, Same Time
    Reason and Prerequisites
    Application error
    En que parche andas?
    Esto se arreglo con el parche 09 del service pack 01

  • Transaction error message

    I purchased an upgrade for "What's That Sound?" Sound Discrimination for toddlers and children, 500 + additional sounds.  However, when trying to download it to my iPad I get "Transaction error.  Please try again later!" and my iPad freezes there.  I have tried since 2/9/13 but get the same error message.  What can I do?

    Hi,
    Ask you BASIS to implement the following Note throgh SNOTE:
    Note 204841 - Message CY 831 Structure KBED is not currently supported
    Pls reward points if solved.
    Regards,
    Renjith Michael.

  • Transaction errors: The lock operation ended unsuccessfully because of deadlock.

    Hi,
    One of our process is getting "Transaction errors: The lock operation ended unsuccessfully because of deadlock." error while processing Partitions in AS 2005.
    We have a process that processes dimensions and partitions based on a SQL table.  Sometimes when the it is processing two partitions at the same time (multi-threaded) for same measure group, server throws deadlock error.    This does not happen all the time.
    Both partitions are bound to different tables in relational database and I also traced the SQL Server and did not get any deadlock error.
    I searched for this error on Google and did not find anything.
    Anyone have any idea about this error?
    Thanks

    Hi All,
    when i  execute the job for cube refreshment,sometimes it is executing successfully,but sometimes it is getting failed with below error  
    Started:  4:08:08 AM  Error: 2015-01-14 04:55:21.03     Code: 0xC11D0005     Source: Analysis Services Processing Task Analysis Services Execute DDL Task     Description: Transaction errors: The lock operation
    ended unsuccessfully because of deadlock.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  4:08:08 AM  Finished: 4:55:21 AM  Elapsed:  2832.18 seconds.  The package execution failed.  The
    step failed.
    If any find the solution please post on it.
    Thanks
    Rambabu

  • JPA without Transactions?

    Hi Folks,
    Am I obliged to encompass my database write statements in a transaction? (Container managed or otherwise...)
    em.merge(myObj);
    em.flush();Our architecture is engineered so that transaction management is delegated to the database. JPA will (presumably) invoke an INSERT INTO or an UPDATE on a view which has some clever code, triggers etc. behind it to manage transactions.
    A search of the forums returned these hits but my question is still unanswered.
    * [Using JTA enabled connection in a JSP/servlet without transaction|http://forum.java.sun.com/thread.jspa?forumID=48&threadID=284423]
    * [There must be transactions for a single update sql?|http://forum.java.sun.com/thread.jspa?forumID=48&threadID=458542]
    The Spring site suggests that I must use transactions: [Can I use JPA without Transaction support?|http://forum.springframework.org/showthread.php?t=49322]
    Is this really the case?
    Thanks, Adam.

    Hi David,
    Thanks for posting here.
    I suggest you to check this link for all codings mentioned in this
    link.
    http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.ui.xaml.media.animation.timeline.completed.aspx
    Regards,
    Girish Prajwal

  • A jdbc transaction error occur

    Hi Everybody
    A jdbc transaction error occur when I deploy the application on the server .
    Below is the stack trace
    #SAP J2EE Engine JTA Transaction : [03bfffffffd3a000ffffffc0]####Application [13]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.dbpool.exceptions.BaseSQLException: Cannot commit transaction from this connection of "YTSQLS2K" DataSource. This resource participates in a local or distributed transaction.
    #SAP J2EE Engine JTA Transaction : [03bfffffffd3a000ffffffc0]####Application [13]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.dbpool.exceptions.BaseSQLException: Cannot initiate transaction from a connection of "YTSQLS2K" DataSource. Local or distributed transaction has already started.
    #SAP J2EE Engine JTA Transaction : [03bfffffffd3a000ffffffc0]####Application [13]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.dbpool.exceptions.BaseSQLException: Cannot commit transaction from this connection of "YTSQLS2K" DataSource. This resource participates in a local or distributed transaction.
    Any idea about it
    I use the jdbc version in datasource <jdbc-1.x>
    is there a need to replace it with <jdbc-2.0>
    Thank You
    Syed Saifuddin

    Hibernate allows you to choose transaction manager. As Nikolay pointed out, in a JEE envirnment it's prefferable to use JTA transactions. All you need to do is to configure hibernate to use a JTA transaction manager. It is all written in the Hibernate documentations. See
    http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-j2ee
    and
    http://www.hibernate.org/42.html#A5 .
    The relevant properties that need to be set in the configuration are:
    hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
    and
    hibernate.transaction.manager_lookup_class=<Class that knows how to lookup>
    You need to implement a class that knows how to lookup user transaction in SAP J2EE Egnine.
    The class must extend org.hibernate.transaction.JNDITransactionManagerLookup and only override its abstract method getName (simply returning the lookup string). Then provide the fully qualified name as value of the property and make sure that Hibernate can load the class.
    That should work.
    HTH
    -Georgi
    Message was edited by:
            Georgi Pavlov

  • Could not commit transaction Error 1 Detected During Transaction G/L Account

    hi experts
    when i was adding Sales Order i am getting an error as Could not commit transaction Error 1 Detected During Transaction G/L Account

    Hi,
    Plz find the following threads:
    Transaction failure with error message \&quot;Error -1 detected during transaction\&quot; when update the G\\L Account D…
    "Could not commit transaction: Error -1 detected during transaction"
    Could not commit transaction: Error -1 detected during transaction 'Payment Methods for Payment Wizard' (OPYM)
    Could not commit transaction when inserting new items

  • "Could not commit transaction: Error -1 detected during transaction"

    hi guys,
    im getting this error "Could not commit transaction: Error -1 detected during transaction" when trying to create standard document/s. i am now using B1 8.8, MS SQL 2008.
    originally, my program was written for B1 2005, MS SQL 2005, and it WORKED.
    we upgraded into B1 8.8, MS SQL 2008, and now my program is not working. it is now having the mentioned error upon committing transaction (vCompany.EndTransaction(wf_Commit)). tried removing transaction handling, and it WORKED. also, tried simplifying the program, instead of creating multiple documents, i modified it in just creating one document with transaction handling, and it WORKED.
    initialliy, this issue seems to be related to MS SQL 2008.
    please help, thanks.

    Hi Emmanuel........
    You get this error due to the Approval Procedure.
    Please check if it is activated then please deactivate it from Administration> Approval> Approval Template.......
    Then try.......
    Regards,
    Rahul

  • "Transaction Errors : Aborting transaction on session " while processing the cube

    HI Team,
    Currently i have developed a cube and successfully deployed it in to the SSAS server.
    But when i process the cube the measures in the cube got successfully processed. After that the process is still running and showing the status as "Transaction errors : aborting transaction on session XYZAB".
    can you please guide me in solving this issue. The cube takes more than 6 hrs to process.
    thanks in advance
    baskar k

    Hi,
    I have Similar issue with 2005 and in 2005 I can't execute select * from $system.discover_sessions.
    Do we have any other way to resolve it.
    If I restart SSAS Server, It starts working fine and I cant restart at day time.
    http://blogs.msdn.com/b/sql_pfe_blog/archive/2009/08/27/deadlock-troubleshooting-in-sql-server-analysis-services-ssas.aspx
    Thanks Shiven:) If Answer is Helpful, Please Vote

  • TS1702 In programm Front Line Commando,  Do you want to bay one Ladge Crate of gold for 20USD  Buy,  Please contact iTunes support to complate this transaction  ERROR - purchase failed

    Programm Front Line Commando
    Do you want to bay one Ladge Crate of gold for 20USD
    Buy
    Please contact iTunes support to complate this transaction
    ERROR - purchase failed

    You need to contact iTunes Customer Support. There is a "Contact Us" link at the bottom right of every forum page.
    Best of luck.

  • Really weird quicktime error - showing stuff beneath it?

    I'm getting a really weird quicktime error like something I've never seen before. It's been happening for a few weeks now I guess, but I don't recall quite when it began.
    Basically, almost any video I open in it ends up splicing into fragments. The audio works fine, but the video shows part of the video, then part of the windows behind it, then the desktop, then the video, and cycling back again and splicing through.
    I'm up to date on everything and I ran disk permissions and I can't figure out what's going on. It's definitely quicktime though - it's affecting my iTunes and my Finder video previews as well, across a whole range of codecs. It doesn't affect VLC or mPlayer.
    Any idea what to do?

    A&I reinstalls the OS over the existing OS (to the version on your install DVD that came with the MacBook) but leaves user files and installed applications intact. You should still do a clone on an external drive first though. Or at least backup all your data files.
    After A&I you then use the downloadable combo updater for OSX and the latest QT for QT, and then after reboot repair permissions. You can then run Software Update for the other updates like iLife etc.
    If your install DVD was for 10.4.X and you are not on 10.5 then don't use the original DVD use the 10.5 retail disk instead.

  • JPA Metadata issue/ Weird Column error or bug in openjpa ...?

    Hi All,
    I am getting the following exception when using openjpa in my project.
    The line of code that throws the error is also mentioned
    The latter error shows a column mismatch error which i am not sure is correct since the db i am using is Oracle 10g and the datatypes for the column are varchar2.
             BcsPort bcsPort=em.find(BcsPort .class, port);   //Error after this call.
    EJB Exception: : &lt;openjpa-1.1.1-SNAPSHOT-r422266:965591 fatal user error&gt; org.apache.openjpa.per
    sistence.ArgumentException: Errors encountered while resolving metadata.  See nested exceptions for details.
            at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:567)
            at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:308)
            at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1121)
            at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:268)
            at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:451)
            at sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:93)
            at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
            at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
            at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
            at $Proxy76.find(Unknown Source)
           .... so onFollowed by this as the cause from what i can make
    Caused by: &lt;openjpa-1.1.1-SNAPSHOT-r422266:965591 fatal user error&gt; org.apache.openjpa.persistence.ArgumentException: "
    com.test.domain.BcsNe.ne" declares a column that is not compatible with the expected type "varchar".  Column detail
    s:
    Full Name: bcsne.ne
    Type: blob
    Size: 0
    Default: null
    Not Null: false
            at org.apache.openjpa.jdbc.meta.MappingInfo.mergeColumn(MappingInfo.java:660)
            at org.apache.openjpa.jdbc.meta.MappingInfo.createColumns(MappingInfo.java:518)
            at org.apache.openjpa.jdbc.meta.ValueMappingInfo.getColumns(ValueMappingInfo.java:143)
            at org.apache.openjpa.jdbc.meta.strats.StringFieldStrategy.map(StringFieldStrategy.java:79)
            at org.apache.openjpa.jdbc.meta.FieldMapping.setStrategy(FieldMapping.java:120)
            at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:80)
            at org.apache.openjpa.jdbc.meta.FieldMapping.resolveMapping(FieldMapping.java:438)
            at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java:403)
            at org.apache.openjpa.jdbc.meta.ClassMapping.resolveNonRelationMappings(ClassMapping.java:834)
            at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:324)
            at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:667)
            at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:549)
            ... 78 moreI have seen this link https://issues.apache.org/jira/browse/OPENJPA-1481
    Can anyone help me out on this as i cannot make out if this is a problem in openjpa or the weblogic server 10.0 server
    that i am using to make the call..
    Any inputs on this highly appraciated

    gimbal2 wrote:
    That link seems to deal with a bug relating to a one to many mapping. I don't see anywhere in your post that you are dealing with the same thing.
    Actually i am using Many to One mapping as you can see from the code excerpt
    BcsPort
    @ManyToOne(optional=false, cascade=CascadeType.ALL, fetch=FetchType.EAGER)
         @JoinColumn(name="ne",referencedColumnName="ne")
         private BcsNe bcsNe;Why i posted the link was that it seems to throw the same weird column exception that i got and more googling revelead that it was indeed some issue between the way the oracle varchar2 field is being handled by openjpa.
    so just needed to confirm if this was a widely faced issue and a possible fix to the same
    Is there a particular reason why you are using openjpaActually it's been added recenlty to the system as before it was using normal JDBC Code...
    In stead of the persistence provider shipped with your JEE container anyway?Do you mean that i should use the Oracle Weblogic 10.3 persistence provider...?
    kindly suggest...
    thanks

Maybe you are looking for

  • [solved] transferring (migrate) my install to a new hard drive

    I did some googling, but could not find a howto which replicated my situation... I bought a new SSD for my netbook and I am wondering what the best way to go about transferring my arch install to it without going thru an install-from-scratch would be

  • Repost CO Doc with wrong offsetting account...

    Hi Experts, Please kindly advise, We have settlement doc like below : CR : Expense 1 CR : Expense 2 DR : Expense 3 DR : AuC And we found in our CO report (KOB1), we have settlement doc like below 1. Expense 1 with offsetting AuC 2. Expense 2 with off

  • Writing messages to log file from database procedures

    Folks, Is there a way by which I will be able to write messages from a database procedure to a log file? I would like to know what a procedure is doing and if it has failed or suceeded just as we do in a Unix shell script where we can direct messages

  • Vista and Sound Blaster Audigy

    Okay I am getting desperate. I have been searching all over for this odd occurence but I havent found anything. I am running a dual core amd processor with Vista 64-bit, 4 GB RAM, and a Sound Blaster Audigy. I purchased this card off of ebay, so I do

  • Flv won't play in safari or opera???

    I am trying to add a video to this site: http://www.ld-ink.com/Millennium/index.html The video plays in Firefox, IE, and Google Chrome. It does not play for me in Safari of Opera. Can anyone give me some assistance as to why this is happening? When I