admin@glassfish.java.net

Re: ActionReport cause not set on bean validation failure?

From: Carla Mott <carla.mott_at_oracle.com>
Date: Wed, 29 Sep 2010 10:39:21 -0700

This could be due to a change I put in. I removed the exception object
because the underlying code printed the message passed and the message
in the exception which was a duplicate. Whatever fix goes in has to
deal with duplicate error messages again.

I think the best fix would be to change all the places in the code that
creates the TransactionFailure exception. that is a more sweeping
change.

Note I did run the QL and admin dev tests after my fix and didn't see
errors.

carla

Joe Di Pol wrote:
> Jerome Dochez wrote:
>> do you know when it stopped working ?
>
> Looks like it is due to r41084, a change to GenericCreateCommand.java
> I can fix that.
>
> A related problem I see in the execute() method is that when
> handling exceptions it includes e.toString() when creating
> the error message for the ActionReport. Seems like it should
> do something like:
>
> ExceptionUtil.getRootCause(e).getMessage()
>
> Since typically the most interesting text is in the lowest
> level cause.
>
> Thoughts?
>
> Joe
>
>>
>> On Sep 28, 2010, at 10:49 AM, Joe Di Pol wrote:
>>
>>> When bean validation fails on the Node config bean the resulting
>>> ActionReport does not have the exception set.
>>>
>>> For example create-node-config does this:
>>>
>>> public void execute(AdminCommandContext context) {
>>> ActionReport report = context.getActionReport();
>>>
>>> CommandInvocation ci =
>>> cr.getCommandInvocation("_create-node", report);
>>> ParameterMap map = new ParameterMap();
>>> . . .
>>> ci.parameters(map);
>>> ci.execute();
>>>
>>> After the ci.execute() if there was a bean validation failure then
>>> report.getFailureCause() returns null instead of the exception
>>> and report.getMessage() returns:
>>>
>>> "Exception while adding the new configuration
>>> org.jvnet.hk2.config.TransactionFailure: Injection failed on public
>>> abstract void
>>> com.sun.enterprise.config.serverbeans.Node.setName(java.lang.String)
>>> throws java.beans.PropertyVetoException"
>>>
>>> I'm pretty sure this use to work (the exception was set on the
>>> ActionReport). FYI here is the trace from the log file of the
>>> exception I'd expect to see set in the ActionReport.
>>>
>>> Anybody know if anything changed?
>>>
>>> Thanks,
>>>
>>> Joe
>>>
>>> [#|2010-09-28T10:27:36.105-0700|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.config.support|_ThreadID=16;_ThreadName=Thread-1;|Exception
>>> while adding the new configuration
>>> org.jvnet.hk2.config.TransactionFailure: Injection failed on public
>>> abstract void
>>> com.sun.enterprise.config.serverbeans.Node.setName(java.lang.String)
>>> throws java.beans.PropertyVetoException
>>> org.jvnet.hk2.config.TransactionFailure: Injection failed on public
>>> abstract void
>>> com.sun.enterprise.config.serverbeans.Node.setName(java.lang.String)
>>> throws java.beans.PropertyVetoException
>>> at
>>> org.jvnet.hk2.config.ConfigSupport._apply(ConfigSupport.java:203)
>>> at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:133)
>>> at org.jvnet.hk2.config.ConfigSupport.apply(ConfigSupport.java:112)
>>> at
>>> org.glassfish.config.support.GenericCreateCommand.execute(GenericCreateCommand.java:140)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:365)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:375)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1072)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:101)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1221)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1210)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.cluster.CreateNodeConfigCommand.execute(CreateNodeConfigCommand.java:93)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:375)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1072)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:101)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1221)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1210)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:375)
>>>
>>> at
>>> com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:209)
>>> at
>>> com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
>>>
>>> at
>>> com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
>>>
>>> at
>>> com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
>>>
>>> at
>>> com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:824)
>>>
>>> at
>>> com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:721)
>>> at
>>> com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1014)
>>> at
>>> com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:220)
>>>
>>> at
>>> com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
>>>
>>> at
>>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
>>>
>>> at
>>> com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
>>>
>>> at
>>> com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
>>>
>>> at
>>> com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
>>>
>>> at
>>> com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
>>>
>>> at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
>>> at
>>> com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:530)
>>>
>>> at
>>> com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:511)
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>> Caused by: org.jvnet.hk2.component.ComponentException: Injection
>>> failed on public abstract void
>>> com.sun.enterprise.config.serverbeans.Node.setName(java.lang.String)
>>> throws java.beans.PropertyVetoException
>>> at
>>> org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:212)
>>>
>>> at
>>> org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:102)
>>>
>>> at
>>> org.glassfish.config.support.GenericCreateCommand$1.run(GenericCreateCommand.java:145)
>>>
>>> at org.jvnet.hk2.config.ConfigSupport$1.run(ConfigSupport.java:115)
>>> at
>>> org.jvnet.hk2.config.ConfigSupport._apply(ConfigSupport.java:174)
>>> ... 35 more
>>> Caused by: java.lang.reflect.InvocationTargetException
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>> at
>>> org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:197)
>>>
>>> ... 39 more
>>> Caused by: java.lang.RuntimeException:
>>> org.jvnet.hk2.config.ValidationException: Constraints for this bean
>>> violated.
>>> Message = name must match "[\p{L}\p{N}_][\p{L}\p{N}\-_./;#]*"
>>> at
>>> org.jvnet.hk2.config.WriteableView.setter(WriteableView.java:183)
>>> at
>>> org.jvnet.hk2.config.WriteableView.invoke(WriteableView.java:139)
>>> at $Proxy79.setName(Unknown Source)
>>> ... 44 more
>>> Caused by: org.jvnet.hk2.config.ValidationException: Constraints for
>>> this bean violated.
>>> Message = name must match "[\p{L}\p{N}_][\p{L}\p{N}\-_./;#]*"
>>> at
>>> org.jvnet.hk2.config.WriteableView.handleValidation(WriteableView.java:665)
>>>
>>> at
>>> org.jvnet.hk2.config.WriteableView.setter(WriteableView.java:180)
>>> ... 46 more
>>> |#]
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>