<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
    #email-body { min-width: 30em !important; }
    #email-page { padding: 8px !important; }
    #email-banner { padding: 8px 8px 0 8px !important; }
    #email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
    #email-fields { padding: 0 8px 8px 8px !important; }
    #email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
    <tr valign="top">
        <td id="email-page" style="padding:16px !important;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
                <tr valign="top">
                    <td bgcolor="#3b4d64" style="background-color:#3b4d64;color:#ffffff;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="https://issues.jboss.org/s/en_USkylogg-418945332/847/58/_/jira-logo-scaled.png" alt="" style="vertical-align:top;" /></td>
                </tr><tr valign="top">
    <td id="email-banner" style="padding:32px 32px 0 32px;">
        
                
        
        
            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
                                        <img id="email-avatar" src="https://community.jboss.org/people/TheGroove/avatar/16.png" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
                        <div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
                                    <a class="user-hover" rel="TheGroove" id="email_TheGroove" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=TheGroove" style="color:#326ca6;">Christian Groove</a>
     created <img src="https://issues.jboss.org/images/icons/issuetypes/newfeature.png" height="16" width="16" border="0" align="absmiddle" alt="Feature Request"> <a style='color:#326ca6;text-decoration:none;' href='https://issues.jboss.org/browse/WELD-1321'>WELD-1321</a>
            </div>
                        <div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
                <a style='color:#326ca6;text-decoration:none;' href='https://issues.jboss.org/browse/WELD-1321'><strong>WELD/CDI get mixed up with CMT and persistency (context)</strong></a>
            </div>
                    </td>
    </tr>
</table>
    </td>
</tr>
<tr valign="top">
    <td id="email-fields" style="padding:0 32px 32px 32px;">
        <table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
            <tr valign="top">
                <td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Issue Type:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                <img src="https://issues.jboss.org/images/icons/issuetypes/newfeature.png" height="16" width="16" border="0" align="absmiddle" alt="Feature Request">        Feature Request
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Affects Versions:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    1.1.10.Final            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Assignee:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                                        <a class="user-hover" rel="jharting" id="email_jharting" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=jharting" style="color:#326ca6;">Jozef Hartinger</a>
                </td>
</tr>                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Components:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    CDI API            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Created:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        31/Jan/13 4:38 AM
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Description:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <p style='margin-top:0;margin-bottom:10px;'>Dear sirs,</p>

<p style='margin-top:0;margin-bottom:10px;'>in order to test our calculation engine, that runs inside a EJB<br/>
container (as an MDB for batch processing), we decided to use<br/>
CDI to test this calculation engine .... outside of the JEE<br/>
container, within a looping Junit test.</p>

<p style='margin-top:0;margin-bottom:10px;'>The JUnit test invocation (and mocking) is working well with <br/>
DeltaSPIKE and Weld-1.1.10. That's perfect.</p>

<p style='margin-top:0;margin-bottom:10px;'>Unfortunately we are unable to run the calculation engine <br/>
inside the EJB-container (respective as an mdb), cause the<br/>
XA-datasource went mad and logged out weired messages of<br/>
unsucceeded connect-request or weired transaction context.</p>

<p style='margin-top:0;margin-bottom:10px;'>So i decided to extend my maven-driven test application, <br/>
in order to emulate that faulty behaviour. This application<br/>
works similar to our application.</p>

<p style='margin-top:0;margin-bottom:10px;'>Small test app description:<br/>
The major project contains three sub-projects:<br/>
+ CdiTestMackEAR for to build the ear<br/>
+ CdiTestMackEJB contains the EJB beans<br/>
  ok, there is actually ony one, that (self) initiates<br/>
  our test by means of a timer, that is attached to <br/>
  the timelyTest runner. <br/>
+ CdiTestMackService sub package that contains the calc engine,<br/>
  that is implementet in the CalculationEngineExmp01Impl<br/>
  class. Any data request is beeing declared by the<br/>
  DataSvcIf interface.<br/>
  Implementation are </p>
<ul class="alternate" type="square">
        <li>MockMeMockMe for JUnit testing and</li>
        <li>JpaDataSvc the failing JPA implementation.</li>
</ul>


<p style='margin-top:0;margin-bottom:10px;'>You can simply let the application write a bunch of <br/>
exception, iff (see ServiceAccessPointBean.java line 55ff<br/>
assign a string:<br/>
    inParamter.setBoxName(myBoxName) ;</p>

<p style='margin-top:0;margin-bottom:10px;'>or blind out any exception:<br/>
    inParamter.setBoxName(null) ;</p>

<p style='margin-top:0;margin-bottom:10px;'>Finally both assignments cause problems, but apparently the<br/>
first one creates excptions.</p>

<p style='margin-top:0;margin-bottom:10px;'>Conclusion:<br/>
1) From my point of view the cause of the problem is<br/>
the CDI-API, that lacks of some important functionality<br/>
for transaction oriented processing.</p>

<p style='margin-top:0;margin-bottom:10px;'>When the transactional method starts to run,<br/>
the SLSB has been activated (postconstruct finished).<br/>
All my ressouces have been reserved for my atomic<br/>
operations. I will not require additional ressources<br/>
from the injected implementation during runtime.<br/>
Therefore all injected references should have been<br/>
initialized (with their ressources) or better should<br/>
be re-use the reserved/allocated ressources.</p>

<p style='margin-top:0;margin-bottom:10px;'>In other words: Iff my atomic transaction starts,<br/>
i do not want to allocate others during runtime.<br/>
(we are not playing the Spring game in an EJB!!!)</p>

<p style='margin-top:0;margin-bottom:10px;'>As a consequence of this, i would expect a <br/>
passthrough interface, sharing my reserved<br/>
ressources to the injected instances.</p>

<p style='margin-top:0;margin-bottom:10px;'>Besides, it should be possible (better say the standard),<br/>
to inherit the current transaction context to the<br/>
injected implementations, maybe some of them <br/>
needs them. (Nestated transaction shall not be<br/>
the only one option).</p>

<p style='margin-top:0;margin-bottom:10px;'>I was thinking of the transacion-cts, when i was<br/>
folling the irritating stack traces. I guessed, that<br/>
each CDI invocation created a separate transaction<br/>
context outside of the EBJ container.</p>

<p style='margin-top:0;margin-bottom:10px;'>Iff you have any question, let me know.<br/>
For now, i'll have to remove the CDI from<br/>
our project, until it is transaction safe.</p>

<p style='margin-top:0;margin-bottom:10px;'>(SEE ALSO: <a href="http://stackoverflow.com/questions/8772175/how-to-implement-container-managed-transaction-cmt" class="external-link">http://stackoverflow.com/questions/8772175/how-to-implement-container-managed-transaction-cmt</a>)</p>

<p style='margin-top:0;margin-bottom:10px;'>Another thing is: Please write in your documentation<br/>
what can be doen with Weld/CDI and which use cases<br/>
(like mine) is not expected to work.</p>
    </td>
</tr>
                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Environment:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        JBOSS 7.1.1_final with Weld 1.1.10
    </td>
</tr>
                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Project:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <a style="color:#326ca6;" href="https://issues.jboss.org/browse/WELD">Weld</a>
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Labels:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    jboss
            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Priority:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                        <img src="https://issues.jboss.org/images/icons/priorities/critical.png" height="16" width="16" border="0" align="absmiddle" alt="Critical">                Critical
    </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Reporter:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                                        <a class="user-hover" rel="TheGroove" id="email_TheGroove" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=TheGroove" style="color:#326ca6;">Christian Groove</a>
                </td>
</tr>                                                    
    
    
                        </table>
                </td>
            </tr>
        </table>
    </td>
</tr>













            </table>
        </td><!-- End #email-page -->
    </tr>
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
            This message is automatically generated by JIRA.<br />
            If you think it was sent incorrectly, please contact your JIRA administrators<br />
            For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
        </td>
    </tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->