EJB 3:发生了使用现有的两阶段资源提交具有单阶段功能资源的非法尝试

时间:2017-07-01 16:45:09

标签: java-ee ejb ejb-3.1 websphere-8 ejb-2.x

最近我们已将EJB2应用程序迁移到EJB 3.现在我们面临以下错误。

string resource = "https://management.core.windows.net/";
string clientId = "1950a258-227b-4e31-a9cf-717495945fc2";
string userName = "<replace>";
string password = "<replace>";
string apiVersion = "2016-06-01";

using(var client = new HttpClient())
{
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    string tokenEndpoint = "https://login.microsoftonline.com/common/oauth2/token";
    var body = $"resource={resource}&client_id={clientId}&grant_type=password&username={userName}&password={password}";
    var stringContent = new StringContent(body, Encoding.UTF8, "application/x-www-form-urlencoded");
    var response = await client.PostAsync(tokenEndpoint, stringContent).ConfigureAwait(false);
    var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

    JObject jobject = JObject.Parse(result);
    var token = jobject["access_token"].Value<string>();

    client.DefaultRequestHeaders.Add("Authorization", $"bearer {token}");
    var subcriptions = await client.GetStringAsync($"https://management.azure.com/subscriptions?api-version={apiVersion}").ConfigureAwait(false);
    var tenants = await client.GetStringAsync($"https://management.azure.com/tenants?api-version={apiVersion}").ConfigureAwait(false);
    Console.WriteLine(subcriptions);
    Console.WriteLine(tenants);

    //We have the SubscriptionID, TenantId and the token to
    //the subscription here. How to do New-AzureRmADApplication and New-AzureRmADServicePrincipal with the application ID here? Specifically I'm considering to use a certificate thumbrint if it matters.
    //var subscription = "... from subscriptions...";
    //var tenantId = "... from tenants...";
}

我们首先进行基于XA数据源的事务,然后是非XA,最后是XA。

在XA导致问题后,似乎就像NON-XA。

这适用于EJB2。

有人可以帮助我们。

提前致谢。

1 个答案:

答案 0 :(得分:1)

听起来你正在使用不支持两阶段XA的资源(可能是数据库驱动程序)?我不是这方面的专家,但这个博客可能有用:

https://www.ibm.com/developerworks/community/blogs/aimsupport/entry/trace_analysis_wtrn0063e?lang=en