I meet this problem when I import the source code of spring-security-OAuth2. I am not quite familiar with XML.
the wrong code is
<oauth2:authorization-server client-details-service-ref="clientDetails">
<oauth2:authorization-code />
<oauth2:custom-grant token-granter-ref="tokenGranter" />
</oauth2:authorization-server>
it reported
cvc-complex-type.2.4.a: Invalid content was found starting with element 'oauth2:custom-grant'. One of '{"http://www.springframework.org/schema/security/oauth2":implicit, "http:// www.springframework.org/schema/security/oauth2":refresh-token, "http://www.springframework.org/schema/security/oauth2":client-credentials, "http://www.springframework.org/schema/ security/oauth2":password}' is expected.
You are using an old version of Spring Security OAuth that does not support "custom-grant"
Related
I am upgrading from Spring 4.3 to Spring 5.3 and it seems that placeholders are no longer supported for the #ActiveProviles annotation.
The following code worked with the old Spring version:
#RunWith(SpringRunner.class)
#SpringBootTest
#ActiveProfiles({"${profileA}","someProfileWithoutPlaceholders"})
#ContextConfiguration(classes = MyApplication.class)
public class MyTest {...}
But it stopped working with the upgrade and now it get
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'nucleus.hibernate.dialect' in value "${nucleus.hibernate.dialect}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124)
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239)
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
... 55 more
Note, that 'nucleus.hibernate.dialect' is defined in the application properties referenced by "${profileA}".
As a workaround, I tried to specify the properties as test property source explicitly using
#TestPropertySource(locations={"classpath:/application-${profileA}.properties"}})
and that works.
I am not sure if using placeholders for selecting a Spring profile on a Spring integration test is an officially supported feature. If yes, I consider this a breaking change in the Spring test framework.
After debugging around the test case I got a bit more insight on this issue.
It seems that in
org.springframework.core.env.PropertySourcesPropertyResolver#getProperty(java.lang.String, java.lang.Class<T>, boolean)
the test property source 'test' splits up the profiles and has two entries:
spring.profiles.active[0] -> "${profileA}
spring.profiles.active[1] -> "someProfileWithoutPlaceholders"
So when looking up with key "spring.profiles.active", it does not find any value, and org.springframework.core.env.AbstractPropertyResolver#resolveNestedPlaceholders is not called.
This is done in org.springframework.core.env.AbstractEnvironment#doGetActiveProfiles when building the test application context..
In the old Spring version, there was only one map entry:
spring.profiles.active -> "${profileA},someProfileWithoutPlaceholders"
so it found the entry and resolved the placeholder.
I am trying to use the sbeTool with the Eurex codecs:
JAVA -Dsbe.target.namespace=eobiV81 -classpath "../sbe-tool-1.7.0.jar;../agrona-0.9.6.jar" uk.co.real_logic.sbe.SbeTool eobi81.xml
This eobi.xml file looks slightly different from the sample provided and the tool execution fails (it succeeds on the the car.xml example file):
Exception in thread "main" java.lang.NullPointerException
at uk.co.real_logic.sbe.xml.XmlSchemaParser.getAttributeValue(XmlSchemaParser.java:221)
at uk.co.real_logic.sbe.xml.MessageSchema.<init>(MessageSchema.java:47)
at uk.co.real_logic.sbe.xml.XmlSchemaParser.parse(XmlSchemaParser.java:105)
at uk.co.real_logic.sbe.SbeTool.parseSchema(SbeTool.java:274)
at uk.co.real_logic.sbe.SbeTool.main(SbeTool.java:199)
Can anyone help me find a way to get the xml compiling? I believe maybe the eobi.xsd file should be useful, but not sure how.
Thanks
Eurex EOBI is not compliant with the SBE 1.0 standard. You can see this if schema validation is turned on for the SBE Tool. To parse Eurex messages you will need a different codec.
I am evaluating SAXON EE edition to validate XML against xsd and schematron.
Can someone help me in resolving the following queries:
While validating xml document against xsd, can we also get xpath of that error node along with errors in plain text. Currently I am getting error only.
Can we validate xml against schematron using Saxon EE version? Any code sample would be a great help.
Thanks.
1. While validating xml document against xsd, can we also get xpath of that error node.
Yes, the error information includes an XPath reference to the invalid node (in most cases: there are some cases such as duplicate IDs where there isn't one specific node in error).
If you generate an XML validity report using SchemaValidator.SetValidityReporting() then the resulting report will include the path information. Here's an example:
<?xml version="1.0" encoding="UTF-8"?>
<validation-report xmlns="http://saxon.sf.net/ns/validation"
system-id="file:/Users/mike/repo2/samples/data/books-invalid.xml">
<error line="3"
column="17"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/#x"
xsd-part="1"
constraint="cvc-complex-type.3">Attribute #x is not allowed on element <BOOKS></error>
<error line="10"
column="17"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/Q{}ITEM[1]/Q{}PRICE[1]"
xsd-part="2"
constraint="cvc-datatype-valid.1">The content "$0.2" of element <PRICE> does not match the required simple type. Cannot convert string to decimal: $0.2</error>
<error line="21"
column="20"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/Q{}ITEM[2]/Q{}PUB-DATE[1]"
xsd-part="2"
constraint="cvc-datatype-valid.1">The content "2002-02-31" of element <PUB-DATE> does not match the required simple type. Invalid date "2002-02-31" (Non-existent date)</error>
<error line="42"
column="22"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/Q{}ITEM[3]/Q{}REPUTATION[1]"
xsd-part="1"
constraint="cvc-complex-type.2.4">In content of element <ITEM>: The content model does not allow element <REPUTATION> to appear immediately after element <WEIGHT>. No further elements are allowed at this point. </error>
<meta-data>
<validator name="SAXON-EE" version="9.8.0.9"/>
<results errors="4" warnings="0"/>
<schema file="books.xsd" xsd-version="1.1"/>
<run at="2018-03-07T15:22:04.847Z"/>
</meta-data>
</validation-report>
You can also get the information if you supply an IInvalidityHandler as a callback to the SchemaValidator, though this requires a bit more digging. Saxon calls your IInvalidityHandler supplying a StaticError object (which is a bit of a misnomer). The StaticError object doesn't have the path information directly available, but it contains a reference to an XPathException object which can be cast to a ValidationException, and ValidationException has a method getPath() which returns this information if available.
2. Can we validate xml against schematron.
Saxon doesn't include a schematron validator per se, though many of the third-party tools that do schematron validation make use of Saxon "under the hood". I'm not up-to-date with the situation on .NET - but essentially there are two kinds of Schematron processor: those that generate XSLT code from the schematron schema (which typically use Saxon both to generate the XSLT and to execute it), and "native" processors. Searching for "schematron on .NET" gives you quite a number of projects, but I have no idea of their current status or quality.
I am trying port to Dart this nice paper-datatable implementation using custom_element_apigen.
Some problems occurred and sought to find solutions according to my understanding (perhaps included more problems!).
However, still an error is thrown and not been able to move on. I need some help about how port to Dart!!! I will briefly describe the steps, errors and solutions that gave and a link to source code of the project test:
1) I following the steps, accord to https://github.com/dart-lang/custom-element-apigen. I had problems on Windows, but I got to resolve after (custom_element_apigen: gives an error importing paper-datatable to Dart)
2) apigen.yaml used with custom_element_apigen does not clear how to configuration.
I used the "trial-and-error" method until no more error occur. It was so:
files_to_generate:
- paper-datatable\paper-datatable.html
- paper-datatable\paper-datatable-column.html
- paper-datatable\paper-datatable-edit-dialog.html
- paper-datatable\paper-datatable-card.html
- paper-datatable\paper-datatable-styles.html
- paper-datatable\datatable-icons.html
files_to_load:
- package:polymer_elements/src/paper-material/paper-material.html
- package:polymer_elements/src/iron-ajax/iron-request.html
- package:polymer_elements/src/iron-ajax/iron-ajax.html
- package:polymer_elements/src/iron-form/iron-form.html
- package:polymer_elements/src/iron-meta/iron-meta.html
- package:polymer_elements/src/iron-icon/iron-icon.html
- package:polymer_elements/src/iron-iconset-svg/iron-iconset-svg.html
- package:polymer_elements/src/paper-ripple/paper-ripple.html
- package:polymer_elements/src/paper-checkbox/paper-checkbox.html
- package:polymer_elements/src/neon-animation/animations/opaque-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-in-animation.html
- package:polymer_elements/src/neon-animation/animations/fade-out-animation.html
- package:polymer_elements/src/paper-tooltip/paper-tooltip.html
- package:polymer_elements/src/iron-resizable-behavior/iron-resizable-behavior.html
- package:polymer_interop/src/js/debug/src/lib/template/templatizer.html
Some paths imports were wrongs on paper-datatable*.(html and dart) files. p.e. : import 'packages\polymer_interop\src\js\debug\src\lib\template\templatizer.dart'; I changed to import 'package:polymer_interop/src/behaviors/templatize.dart';
on paper_datatable_column.dart.
I changed reserved Dart word default to defaultx on get defaultx => jsElement[r'default']; and set defaultx(value) { jsElement[r'default'] = (value is Map || (value is Iterable && value is! JsArray)) ? new JsObject.jsify(value) : value;} instructions on paper_datatable_column.dart and paper_datatable_card.dart;
After the following erros were occuring in several polymer componentes. P.e.: Failed to execute 'registerElement' on 'Document': Registration failed for type 'iron-meta'. A type with that name is already registered.
I changed all paths into paper-datatable*.* files to get official package (pub.dartlang) of the polymer and polymer elements. P.e.: <link rel="import" href="paper_icon_button_nodart.html"> to <link rel="import" href="../../packages/polymer_elements/paper_icon_button_nodart.html">. The register problem does not occur more!
But now, the following problem is occuring and I don't know how to resolve it: On debug console appear the following message: Uncaught SyntaxError: Unexpected token =>. The web app works on browser, but the paper-datatable does not appear.
My complete test project (webstorm) is on https://github.com/supermuka/paper_datatable_port_dart_demo
Is there some wrong in how I used Dart custom_element_apigen (and apigen.yaml)? Did I some things wrong on paths changed? I also need to change some other source?
Thanks!
Most likely you just created a syntax error when editing the files. That being said there are options built in to do most of the things you manually did, and that also makes it easier to update in the future.
omit_imports: This is used on individual items in the files_to_generate section. It can be used to get rid of the templatizer import entirely, resolving issue #3. See example here.
name_substitutions: This is used on individual items in the files_to_generate section, and allows you to rename fields. You can use this to resolve issue #4, example here.
stubs_to_generate: This option allows you to generate stubs which actually import elements from a different package, this should resolve issue #5 you listed above. See example usage here.
Hopefully that helps, and applying those options will just resolve your issues.
I got this error which according to Apache Support is an issue relating with Glassfish rather than OpenJPA:
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
The stacktrace is:
Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1410)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1368)
at com.ckd.model.BookModel.pcNewObjectIdInstance(BookModel.java)
at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:138)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1693)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1643)
... 112 more
Has anyone come across this before and how to resolve it? I have been stuck on this issue for the last several days.
Another of my post related to this issue can be found here: JSF 2: h:link and getrowdata.
The above error relates to a problem with the OpenJPA enhancer. When you execute Sun's JDK the OpenJPA's dynamic enhancer starts by default. This action, in turn, stuffs up Glassfish's classloader class - hence, the WEB9031 error.
For those who experience this same issue, a simple workaround is to do the enhancement at build time - which I did in ANT with org.apache.openjpa.ant.PCEnhancerTask - and add this property to your persistence.xml to shut off the dynamic enhancer: <property name="openjpa.DynamicEnhancementAgent" value="false"/>.
Also, it wouldn't hurt to throw this in your persistence.xml as well <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />.