I am working on Struts2 and spring integrated project.
I am getting OGNL exception as: -
Error setting expression 'lookupLicProductSKU.udiPID' with value '[Ljava.lang.String;#1feae0f'
ognl.OgnlException: target is null for setProperty(null, "udiPID", [Ljava.lang.String;#1feae0f)
I also have Spring AOP configured for all the actions to capture few logs. When ever AOP in in action and when I get the OGNL exception specified above, the flow breaks. If I remove the AOP defined in applicationContext.xml, flow runs smooth though there are the above specified OGNL exceptions. I do not understand the reason why this is happening.
Is there a way to make it work with AOP in place? Please let me know.
Related
My problem is that I want the same exception handling for all exceptions using DropWizard, and for this purpose I register an exception mapper for Exception. But exceptions for the default exceptions mappers, e.g. JDBI are not caught by my exception mapper due to the default exception mappers.
As stated in the documentation, DropWizard registers a number of default exception mappers. The documentation c.f. https://www.dropwizard.io/1.0.0/docs/manual/core.html#overriding-default-exception-mappers suggests setting server.registerDefaultExceptionMappers to false in the yml configuration.
I cannot get this to work though, which seems to have been a problem for others as well: https://github.com/dropwizard/dropwizard/issues/2380.
The problem stated is a year old - does anybody know the current status of whether registerDefaultExceptionMappers is supposed to disable the default exception mappers?
I'm using Apache Struts 2 version 2.3.14.2 to develop a web app.
I came across a method in OgnlUtility called setEnableEvalExpression to disable the OGNL expression evaluation.
Can I disable OGNL expression evaluation on the information following "redirect"?
Or Is there any other way to disable OGNL expression evaluation?
If I set up SS HttpSecurity using Java Config. Spring Boot creates a springSecurityFilterChain, which is logged during setup logs. However, the FilterRegistrationBeans now with standard URL patterns are not invoked.
2 Part Question:
Is this standard behavior? Where... once Spring Security is installed, all of my Servlet FilterBeanRegistrations are suddenly broken?? I would have thought Spring Boot would auto-figure out how to "add" them onto the appropriate springSecurityFilterChain automatically. Anyway, that is not what I am seeing.
I see the http.addFilter(myFilter) API methods. But, I don't want to pollute my SecurityConfig to know about all these filters I have. How do I add my custom Servlet filters into the springSecurityFilterChain bean from the 'outside' so to speak? You know.. 'auto-configure' them myself, onto the springSecurityFilterChain. :)
As you can see below, the WebSecurityConfigurerAdapter adds a lot of stuff to the security filter chain by default.
Although I still don't know which one of the settings caused the FilterBeanRegistrations to break, setting disableDefaults to true and configuring the security filter chain myself did the trick.
if(!disableDefaults) {
http
.csrf().and()
.addFilter(new WebAsyncManagerIntegrationFilter())
.exceptionHandling().and()
.headers().and()
.sessionManagement().and()
.securityContext().and()
.requestCache().and()
.anonymous().and()
.servletApi().and()
.apply(new DefaultLoginPageConfigurer<HttpSecurity>()).and()
.logout();
}
I am using Spring Webservice (2.1.0) Client to send a very simple Message to a Soap UI Mock Webservice. (Hello World style, no namespaces)
Before Sending the DOMSource via the SpringWebserviceTemplate it is extracted from
a jdom2.Element as jdom2.transform.JDOMSource. (JDOM 2.0.2)
The Transformer is Saxon 9.4.0.4.
While calling the Spring Webservice Template function sendSourceAndReceiveToResult
the net.sf.saxon.IdentityTransformer throws a NullPointerException when executing
the transform(DOMSource,responseResult) function.
Since DOMSource is available at that point I do not know what could have gone wrong.
Stacktrace tells me the Nullpointer was thrown at:
net.sf.saxon.lib.SerializerFactory.getReceiver (line 239).
It would help me greatly if you could speculate on possible causes.
Please note that the best way of reporting a Saxon problem is to use either the Saxon forums at http://saxonica.plan.io, or the saxon-help mailing list on SourceForge. We try to monitor questions on StackOverflow, but it's often a few days before we notice them.
With this kind of problem, the cause is often that some piece of software (like Spring Webservice) is using the JAXP TransformerFactory mechanism to load whatever XSLT transformer it finds on the classpath, but hasn't actually done the testing to ensure that it works with an arbitrary XSLT transformer; people often test only with the default one provided by the JDK. It's not clear from your question whether you actually intended for it to use Saxon or not.
Line 239 of SerializerFactory is actually doing
throw new IllegalArgumentException("Unknown type of result: " + result.getClass());
(having tested whether result is one of the kinds of Result that it recognizes); so it looks to me as if result (which is probably the value passed to the transform() method) is null. Check the contents of your responseResult value.
#Html.RenderPartial(MVC.Shared.Views._Sorter);
throws error =>
There is no build provider registered for the extension '.spark'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: There is no build provider registered for the extension '.spark'. You can register one in the section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value 'Web' or 'All'.
Any ideas what might be wrong?
Adding this to web.config=>system.web=>compilation
<buildProviders>
<add extension=".spark" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
Forces app to build spark view as webforms view and produces ${Something.something} all around. So - what's an equivalent for spark viewengine?
Can you please try to make the following change to T4MVT.tt. In the method ViewsFolderInfo.AddView, change the line:
Views[viewFieldName] = GetVirtualPath(item);
to
Views[viewFieldName] = viewFieldName;
If that works well, we can just add a switch to the settings file that makes it do this instead of the default full path.
Let me know how that goes!
Note that MVC.Shared.Views._Sorter is just a constant with the path to the view. If you were to write this code without T4MVC, what exact string would you pass in there?
Maybe Spark has different requirements in the type of view paths it accepts here? If needed, we can tweak T4MVC to make this work, but I'd like to fully understand the Spark behavior outside of T4MVC first.