I need to handle Faces Exception thrown and display custom page on being caught.
I found the answer I tried overriding the MyFaces exception in web.xml and created a separate bean for handling all the bad request.It worked for me.
Related
I've got a Domain Driven Design solution and for some reason, I'm getting this exception at RunTime when the API call is made through GateWay:
One or more errors occurred. (Method not found: 'Void FluentValidation.AbstractValidator`1.When(System.Func`2<!0,Boolean>, System.Action)'.)
The error occurs as below:
I have solution like this:
The main 4 project I'm focusing on right now are:
Core.Model
Account.Api
Service.Api.Gateway
Web.ClientSite
Web.ClientSite makes request to Service.Api.Gateway which then calls Account.Api.
Note that Core.Model is referenced everywhere
VERY IMPORTANT: If I remove the reference of FluentValidation from Core.Model, the exception disappears.
I'm hoping these information is enough. Why do you think I'm getting this exception and how can I eliminate.
Looks like some of libs (ocelot) are incompatible with new changes in FluentValidation 8.1.2. Try to downgrade to FluentValidation before 8.1.2. Hope it helps
I got similar exception:
System.MissingMethodException : Method not found:
'FluentValidation.AssemblyScanner
FluentValidation.AssemblyScanner.FindValidatorsInAssembly(System.Reflection.Assembly)'
In my case I needed to upgrade the ediatR.Extensions.Microsoft.DependencyInjection and MediatR.Extensions.FluentValidation.AspNetCore packages as well to fix the issue.
Our application is JSF2 based and we are desiging a exception handling for that. I tried using JSF2 exception handling framework configured in faces-config.xml.
When I throw a null pointer from backing bean, which is referred in Facelets page, then it is coming to exception handling function as javax.el.PropertyNotFoundException and also it doesn't have any other stack trace about.
Is there any way to get the exact cause of the exception and the stack trace?
That will happen when the action method is called from inside a composite component. This is already been reported as JSF issue 1806 which is scheduled to be fixed for JSF 2.2.
As far now, there's no way to get the root cause in the exception handler, because it's completely swallowed. Your best bet is using a separate logger or, as a hacky workaround, to pass the exception as a request attribute yourself.
Enabling the Development mode usually gives better error information.
Add the following to your web.xml.
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
However you should turn this off for your production.
How can we handle exceptions in Struts? Please share the sample code.
The following URL should help http://www.objectsource.com/j2eechapters/Ch18-Exception_Handling.htm
Use log4j to log the exceptions,
Never use System.out.println in struts application to catch exceptions, as it is expensive ,
Tutorials for log4j> http://logging.apache.org/log4j/1.2/manual.html
to handle the errors:
in struts project to handle the error objet by using ActionError object and to handle the errors by using ActionErrors object.
for suppose
ActionError ae1=new ActionError("err.one");
ActionError ae2=new ActionError("err.two");
Action Errors aes=new ActionErrors();
aes.add(ae1);
aes.add(ae2);
saveErrors(request,aes);//store the errors object in request object
to handle exception:
1)using try and cach blocks
2)using declarative exception handling technique
to handle the exceptions by using global exceptons tag in struts-config.xml
whenever that exception will be came it executes the gen.jsp page.
I have a custom portlet made for liferay and sometimes it throws an exception. Why it throws exceptions is irrelevant.
How to catch exceptions thrown by portlet handler methods in order to email information about them? I know I could do try catching on every handler method but it would be a much more elegant and cleaner solution to catch the exception on a higher level and just email some information about the error.
I'm using Spring Portlet MVC, so i got all spring-related niceties at hand.
Problem(s) solved.
Made a class that implements org.springframework.web.portlet.HandlerExceptionResolver and declared it in applicationContext.xml:
<bean id="myExeptionResolver" class="net.foo.bar.MyExeptionResolver" />
Spring picks the class up and magically knows what it's for.
For the emailing I used Liferay's MailEngine.
I created a maven archetype for spring based portlet. There is an implementation of exception resolver that emails an administrator based on level of priority.
I tried to run the sample application of Nimble 0.2 (blogito) downloaded here but unfortunately I got stuck with 2 major issues:
When running grails run-app, I got 2 times out of 3 the following error :
2009-10-24 14:38:15,198 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowExecutionSnapshotFactory': Cannot resolve reference to bean 'flowRegistry' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowRegistry': Cannot resolve reference to bean 'flowBuilderServices' while setting bean property 'flowBuilderServices'...
I have also a similar issue on my project running Nimble 0.3-SNAPSHOT
But sometimes, it works (really... I don't know why... it's magical...) So I can use the blogito app until I need to create a local account and I got the following exception:
2009-10-24 14:30:31,846 [4974549#qtp0-4] ERROR view.GroovyPageView - Error processing GroovyPageView: Error executing tag <g:form>: org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <n:recaptcharequired>: groovy.lang.MissingPropertyException: No such property:enabled for class: com.megatome.grails.RecaptchaService
So is there anyone here who has ever solved these issues? Do you have any idea about the problems? Do I need to open an issue on Nimble project?
Thx,
Fabien.
If some have encountered the same issue and if you are interested into the solution, I got the answer in another forum.
Here is the link :
http://www.nabble.com/Nimble-and-Blogito-to26038767.html
Fabien