Bean Validation problem (Netbeans, Maven, Glassfish, Java EE)

Hi, I have a strange problem. I have a Maven Java Enterprise Application in Netbeans. I have a User.class in the EJB part defined with annotations. In a Useredit window (in the UI part) I use the standart BienFieldGroup binding, the fields are set to setImmediate(true). So when the field loses focus the validation begins, but Glassfish gives the error:

Warning: Failed invoking AtmosphereFramework.doCometSupport()
java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
at …

(see the whole error below). The strange thing is:

  • If I leave a field out (value is null) then the validation works when I hit the OK button and I get an error notification and can correct it;
  • If I cange the value of a field and it is “” or an invalid value, I get the error message from Glassfish (and the application tries to load something for infinite time, possibly some hibernate error message).

Since I was confused, I made a vaadin webapplication to test the code and the most interesting parts comes here:

  • If I lunch FIRST the testApp (which starts Glassfish) and SECOND the JavaEEApp (Glassfish is already running) then everything is fine, but
  • If I start FIRST the JavaEEApp (which starts Glassfish) and SECOND the testApp (Glassfish is running already) then both have the same BeanFieldGroup validation error.
  • If I use simple field validation, with
    lastNameField.addValidator(new StringLengthValidator(…
    , then everything is perfect in both cases.

So I think the code must be OK, but something is wrong with the Glassfish loading (I tried to change the hibernate validation in Glassfish, to add it to every part of the JavaEE project, to add every dependency to testApp, but nothing seems to work the same cases remain). I don’t know which part of these project can make the Glassfish loading different. Please help if you have a clue.

User.class is:

@Table(name = “users”)
public class User implements Serializable {

@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private long id;

@Column(name ="role")
private String role;

@Size(min =2, max = 20)
@Column(name ="firstName")
private String firstName;

@Size(min = 2, max = 20)
@Column(name ="lastName")
private String lastName;

[/code]UserEditor and TestApp is using

public class UserEditor extends Window implements Button.ClickListener {

    public static final String ID = "usereditorswindow";

    private final BeanFieldGroup<User> fieldGroup;
    private TextField firstNameField;
    private TextField lastNameField;
        fieldGroup = new BeanFieldGroup<User>(User.class);
        FormLayout details = new FormLayout();
        firstNameField = new TextField("First Name");
    public void buttonClick(Button.ClickEvent event) {
        if (event.getButton()== ok){
                try {

The whole error message is:

Warning: Failed invoking AtmosphereFramework.doCometSupport()
java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateExpression(
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolateMessage(
at org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator.interpolate(
at org.hibernate.validator.internal.engine.ValidationContext.interpolate(
at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(
at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolations(
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(
at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForDefaultGroup(
at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForCurrentGroup(
at org.hibernate.validator.internal.engine.ValidatorImpl.validateValueInContext(
at org.hibernate.validator.internal.engine.ValidatorImpl.validateValue(
at com.vaadin.ui.AbstractField.validate(
at com.vaadin.ui.AbstractField.validate(
at com.vaadin.ui.AbstractField.getErrorMessage(
at com.vaadin.ui.AbstractComponent.beforeClientResponse(
at com.vaadin.ui.AbstractField.beforeClientResponse(
at com.vaadin.ui.AbstractTextField.beforeClientResponse(
at com.vaadin.server.communication.UidlWriter.write(
at com.vaadin.server.communication.AtmospherePushConnection.push(
at com.vaadin.server.communication.AtmospherePushConnection.push(
at com.vaadin.ui.UI.push(
at com.vaadin.server.VaadinSession.unlock(
at com.vaadin.server.VaadinService.requestEnd(
at com.vaadin.server.communication.PushHandler.callWithUi(
at com.vaadin.server.communication.PushHandler.access$200(
at com.vaadin.server.communication.PushHandler$1.onRequest(
at org.atmosphere.cpr.AsynchronousProcessor.action(
at org.atmosphere.cpr.AsynchronousProcessor.suspended(
at org.atmosphere.container.GlassFishServ30WebSocketSupport.service(
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(
at org.atmosphere.websocket.DefaultWebSocketProcessor$
at org.atmosphere.util.VoidExecutorService.execute(
at org.atmosphere.websocket.DefaultWebSocketProcessor.dispatch(
at org.atmosphere.websocket.DefaultWebSocketProcessor.invokeWebSocketProtocol(
at org.atmosphere.container.GlassFishServ30WebSocketSupport$Grizzly2WebSocketApplication.onMessage(
at org.glassfish.grizzly.websockets.SimpleWebSocket.onMessage(
at org.glassfish.grizzly.websockets.frametypes.TextFrameType.respond(
at org.glassfish.grizzly.websockets.DataFrame.respond(
at org.glassfish.grizzly.websockets.BaseWebSocketFilter.handleRead(
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(
at org.glassfish.grizzly.ProcessorExecutor.execute(
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(
at org.glassfish.grizzly.threadpool.AbstractThreadPool$

Warning: java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm. Unable to deliver the websocket messages to installed component. Status 500 Message Server Error

Do you have different bean validation libraries on you classpath? Glassfish provides one for you so Java EE 6/7 API in provided scope should be enough.


Hi, thanks for the replay

First I didn’t add any validation, after the problem I added hibernate (however hibernate 5.0.0.Final is loaded by Glassfish) I tried also with the scope provided annotation in POM, but the problem is the same. As I wrote I made a test application and added ALL the dependencies the JavaEE project has and if I start that project first, that and also the JavaEE project is fine (the only difference that it is a simple vaadin webapp and not a maven javaEE). Moreover without BeanValidation the simple addvalidator with the StringValidators etc. are working fine. (which solves my problem but it is not elegant if we have BeanValidation)


Hmm. I have been using Glassfish+BeanValidation+Vaadin, but have never spotted anything like that. Maybe some other dependency is incorrectly pulling in some conflicting validation library? If you have your project sources somewhere I could look at it.


I exported the netbeans project an attached it. The EJB bean is in:
The window, which validates it is:
(which is called by QuariumENT\QuariumENT-ui\src\main\java\com\ecom\quariument\view\admin\
it is based on Vaadin Dashboard Demo to learn and test different components for a future project.

David (228 KB)


You app seems to have bit messy build and several problematic dependency problems. It died for me already during deployment due to some guava version conclict errors. You should e.g. never (in Java EE environment) include the validation API in any form. Not even as provided scope as it will come to you along the java-ee API. Also I’m pretty sure you don’t want to include dependency to vaadin-client in you EJB project. vaadin-server maybe, depending a bit what you are doing, but definitely not vaadin-client.

I looked at your User object in the project, and I’m confident that validations in it should work with Vaadin just fine once you’ll get your dependencies set up properly.


Thanks Matti,

I will remove the non neccessary dependencies and if it doesn’t solve the problem I will migrate the classes to a new project.

Thanks for your help