Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6765963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:46:26+00:00 2026-05-26T14:46:26+00:00

I have a web service (built using jaxb/jaxws) that invokes a stateless EJB to

  • 0

I have a web service (built using jaxb/jaxws) that invokes a stateless EJB to store some data in the database. The data is being stored as an entity bean. The entity bean has a unique constraint applied to it via the @Column(unique = true) annotation.

When the web service attempts to save data, the transaction fails, and rightfully so. The problem is that since I am using CMP, the transaction is not committed until after the call to the stateless EJB. The end result is that I am not able to trap the exception and it is getting funneled up to the WS stack and results in an ambiguous fault containing the string: Error committing transaction:;nested exception is: weblogic.transaction.internal.AppSetRollbackOnlyException.

Is there a way to catch the exception being thrown so I can provide more information to the caller? Thank you.

Version information:

  • Application Server: Oracle Weblogic 10.3
  • Persistence Provider: Hibernate 3.2.5.ga (JPA 1.0)
  • JDK/JRE: 1.6_0_05 (provided by Weblogic install)

Update:
I tried to implement an EJB 3 interceptor around the method invocation and this does not appear to work.

public class TestInterceptor {

@AroundInvoke
public Object logCall(InvocationContext context) throws Exception {

    System.out.println("Invoking method: " + context.getMethod().getName());

    try {
        return context.proceed();
    } catch (Throwable t) {
        System.out.println("I caught an exception: " + t.getMessage());
        throw new Exception(t);
    }

}

The reason I think this doesn’t work is because the processing chain is such that the actual persist happens outside of the method (of course).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:46:27+00:00Added an answer on May 26, 2026 at 2:46 pm

    You could try using Bean Validation. It’s nicely connected with the JPA (invoked during pre-persist, pre-update and pre-remove phases and can be used in different layers of your application.

    Unfortunately, as far as I know, if a validation constraint violation occurs, the transaction is marked for rollback… I don’t know how you could cope with that but one (seems nasty and untested) way I could think of is to inject a ValidatorFactory and validate the object by yourself. Perhaps then you could catch the ValidationException.

    EDIT: I’m not sure if the Bean Validation was available in Java EE 5.

    EDIT 2: You can create an interceptor which will catch the exception thrown by the JPA (or more precisely by the database). As the interceptor is invoked as a part of the same transaction as the EJB method you might need to explicitly invoke EntityManager#flush(-) to synchronise changes with the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service built for SharePoint 2007 that I am trying to
Hi I have a web service built using the Zend Framework. One of the
I have a web service that exposes operations to and from a database. I'm
I've built a web service using Django-Piston that allows for POST and GET requests.
I'm using Grails 1.3.7. I have some code that uses the built-in base64Encode function
I have built a CXF+Spring Web service using Eclipse running on Tomcat7. The web
I have no experience with web services. Historically I've built client-server systems using proprietary
I have an application that sends messages to an external web service. I build
I have a web-service that I will be deploying to dev, staging and production.
I have a web service that I created in C# and a test harness

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.