spv03 / full-hibernate-plugin-for-struts2

Automatically exported from code.google.com/p/full-hibernate-plugin-for-struts2
0 stars 0 forks source link

full-hibernate-plugin 2.2 with hibernate-validator 4.1.0 #31

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The most recent version of hibernate-validator does not contain the class 
org.hibernate.validator.engine.ResourceBundleMessageInterpolator anymore, so an 
Exception is thrown.

using an older hibernate-validator 4.0.2 solves the problem.

Stacktrace:
java.lang.NoClassDefFoundError: 
org/hibernate/validator/engine/ResourceBundleMessageInterpolator
    com.googlecode.s2hibernate.struts2.plugin.s2hibernatevalidator.validators.Struts2HibernateValidatorV402.validate(Struts2HibernateValidatorV402.java:48)
    com.googlecode.s2hibernate.struts2.plugin.s2hibernatevalidator.validators.Struts2HibernateValidatorV402.validate(Struts2HibernateValidatorV402.java:1)
    com.googlecode.s2hibernate.struts2.plugin.s2hibernatevalidator.interceptor.HibernateValidatorInterceptor.intercept(HibernateValidatorInterceptor.java:83)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.googlecode.s2hibernate.struts2.plugin.interceptors.SessionTransactionInjectorInterceptor.intercept(SessionTransactionInjectorInterceptor.java:211)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

regards, 
markus

Original issue reported on code.google.com by mar...@demetz.eu on 25 Feb 2011 at 2:52

GoogleCodeExporter commented 8 years ago
look like the classe change to a new package

org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator

Original comment by sebastie...@gmail.com on 1 Mar 2011 at 1:52

GoogleCodeExporter commented 8 years ago
I changed the source code to that : interpolator = new 
ResourceBundleMessageInterpolator();

but I have a problem later.  

In struts.xml  I have this

<package name="default" extends="hibernate-default" >

        <interceptors>
            <interceptor-stack name="mybasicStack">
                <interceptor-ref name="paramsPrepareParamsStack"/>
                <interceptor-ref name="defaultStackHibernate"/>
            </interceptor-stack>
        </interceptors>

        <!-- Default interceptor stack. -->
        <default-interceptor-ref name="mybasicStack"/>

in my DAO

public String execute() throws Exception {

        try {
            service.create(user);
        } catch (Exception e) {
            e.printStackTrace();
            throw e; 
        }
        return SUCCESS;
    }

if I run the code in debug mode.. I see that I go into : 
Struts2HibernateValidatorV402.java   before I go into my execute method.

but the validator never return errors.  

band I will get this error

# messageTemplate='{javax.validation.constraints.NotNull.message}'} ]
File:   org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java
Line number:    161

this line : Set<ConstraintViolation<ActionSupport>> constraintViolations = 
validator.validate(actionAs);

in Struts2HibernateValidatorV402.java

return a empty Set.

Original comment by sebastie...@gmail.com on 1 Mar 2011 at 3:23

GoogleCodeExporter commented 8 years ago
I am facing the same problem. I also need the hibernate-validator 4.1.0.

Original comment by ayslanms on 3 Mar 2011 at 1:08

GoogleCodeExporter commented 8 years ago
I created a Injector to validate Model using Hibernate validator 4.1.  Works 
fine for me.  I'll create a project on github soon.  I didn't need all the 
others extras of this plugin.  

Original comment by sebastie...@gmail.com on 3 Mar 2011 at 1:12

GoogleCodeExporter commented 8 years ago
In my project I only need the hibernate validation.

Original comment by ayslanms on 3 Mar 2011 at 1:38