Restlet 2.2 uses the fasterxml jackson library to support json serialization.
There are other data bindings supported by jackson, other than json, and included with the restlet 2.2 distribution. As such, many jars are loaded at program start time. Here is the full list:
com.fasterxml.jackson.annotations.jar
com.fasterxml.jackson.core.jar
com.fasterxml.jackson.csv.jar
com.fasterxml.jackson.databind.jar
com.fasterxml.jackson.jaxb.jar
com.fasterxml.jackson.smile.jar
com.fasterxml.jackson.xml.jar
com.fasterxml.jackson.yaml.jar
How do I configure jackson, or restlet, so that it does not attempt to load the formats that I'm not interested in using? e.g. I have no interest in smile, yaml, or csv but if I don't include these jars I get a class not found exception when my server starts.
I'm not sure that it's a Restlet issue but I made work Restlet and Jackson with not all these jars.
If you only want to use Jackson for the JSON format, you can add the following jar files:
com.fasterxml.jackson.annotations.jar: Jackson annotation
com.fasterxml.jackson.core.jar: Jackson core
com.fasterxml.jackson.databind.jar: Jackson data binding
com.fasterxml.jackson.smile.jar: Jackson smile support
Hope it will help you.
Thierry
Related
While building the code getting package sun.security.action is not visible
Package sun.security.action is declared on module java.base, which does not export it to the unnamed module.
What should I do.
Kindly advice, Thanks in advance
Java 8 had no module system - everything is visible or just needs to get imported by archives in jdk (f.e. tools.jar).
Java 9 brought JMS and encapsulated some jdk classes.
In your case, see <JAVA_HOME>/lib/src.zip!/java.base/module-info.class:
exports sun.security.action to
java.desktop,
java.security.jgss,
jdk.crypto.ec,
jdk.incubator.foreign;
Your package isn't public but restricted to some other internal packages/modules.
There was a workaround by adding compiler option --add-exports=java.base/sun.security.action=ALL-UNNAMED at compile time to fix this limitation until version 16.
With version 17 and JEP 403 forget all hope:
It is not a goal to define new standard APIs to replace internal elements for which standard replacements do not yet exist, though such APIs could be suggested in response to this JEP.
Backwards compatibility and important frameworks have lower priority than jdk security - JCP makes strange decisions and works against the community sometimes -.-
in apache nifi 1.10 source code, i can find PutDruidRecord code in
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/main/java/org/apache/nifi/processors/druid/PutDruidRecord.java
However, i can't find this processor in nifi 1.10 ui
nifi canvas
Any one can advise?
Out of Apache NiFi's Migration Guidance:
We've removed the following nars from the default convenience binary. These include kite-nar, kafka-0-8-nar, flume-nar, media-nar, druid-controller-service-api-nar, druid-nar, other-graph-services-nar. You can still get them from the various artifact repositories and use them in your flows but we cannot bundle them due to space limitations by default.
I have started on using Swagger. At this point, I have received a swagger file for swagger version 1.2. However, if I want to generate something with this file, it just gives me a bunch of errors that look more like it just ignores the fact that my swagger file is in version 1.2 spec and just goes ahead and validates it against version 2.0 of the spec.
Some of the errors I got:
Missing required property: paths
Additional properties not allowed:
models,apis,resourcePath,swaggerVersion,apiVersion
...
The last error tells me that apiVersion is unknown, although the gitHub page claims that the latest stable is supposed to be compatible with version 1.0, 1.1, 1.2 and 2.0. Is there a way that I can "force" the generator to think 1.2 spec instead of 2.0 spec?
I've verified with an official 1.2 spec yaml file too:
https://raw.githubusercontent.com/swagger-api/swagger-codegen/v2.0.18/samples/yaml/pet.yml
But it gives the same errors when you load it in the Swagger editor:
http://editor.swagger.io/#/
The swagger-codegen project relies on the swagger-parser, which has a module called swagger-compat-spec-parser which will actually convert your 1.2 specification into 2.0 format before passing on to the code generator.
The errors you're seeing are because that conversion has failed. You can save you swagger 1.2 files locally, tweak them, and re-run the processing.
The challenge with the 1.2 to 2.0 conversion is that swagger 1.2 did not initially have a schema to validate against. Thus there are a lot of invalid swaggers out there, and it's technically impossible to convert all the different issues in 1.2 specs into 2.0.
That said, we are always trying to make the tooling better so if you find a "repeatable" bug in the 1.2 converter, file an issue in the swagger-spec project and we'll see about fixing it (most are easy).
I am using Struts 2.1 in my project.
In struts.xml maxsize element in my project is as follows :
<constant name="struts.multipart.maxSize" value="2147483648" />
For the file upload process,
is it possible to supersede the normal 2 Gb file limit of Struts2 ?
You should migrate to the latest version of Struts2.
From 2.3.20 and above, a new MulitpartRequest implementation can be used to upload large files:
Alternate Libraries
The struts.multipart.parser used by the fileUpload interceptor to
handle HTTP POST requests, encoded using the MIME-type
multipart/form-data, can be changed out. Currently there are two
choices, jakarta and pell. The jakarta parser is a standard part of
the Struts 2 framework needing only its required libraries added to a
project. The pell parser uses Jason Pell's multipart parser instead of
the Commons-FileUpload library. The pell parser is a Struts 2 plugin,
for more details see:
http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html. There
was a third alternative, cos, but it was removed due to licensing
incompatibilities.
As from Struts version 2.3.18 a new implementation of MultiPartRequest
was added - JakartaStreamMultiPartRequest. It can be used to handle
large files, see WW-3025 for more details, but you can simple set
<constant name="struts.multipart.parser" value="jakarta-stream" />
> in struts.xml to start using it.
Validation framework which has been rolled up as part of the JEE6 spec (WL12). Both the WL10 and WL12 versions of our application were deployed with the following open source libraries:
JSR-303 / validation-api.jar (version 1.0)
Hibernate Validator (version 4.2.0)
However, the libraries are also bundled with WL 12 (modules directory). Note that the Hibernate Validator version is slightly different.
modules.javax.validation_1.0.0.jar
hibernate.validator_4.1.0.jar
With our WL12 run we are getting below exception:
javax.validation.ValidationException: Unable to get available provider
Attempted Solutions
Our next attempt was to use the WebLogic FilteringClassLoader to prefer the libraries from our application (APP-INF/lib directory) by specifying them in the weblogic-application.xml file (i.e. choose our versions over WebLogic’s). We were already doing this for several other open source libraries in WL10:
<prefer-application-packages>
<package-name>com.google.common.*</package-name>
<package-name>org.apache.commons.lang.*</package-name>
<package-name>org.apache.commons.logging.*</package-name>
<package-name>org.apache.commons.beanutils.*</package-name>
<package-name>org.apache.commons.collections.*</package-name>
<package-name>antlr.*</package-name>
<package-name>javax.validation.*</package-name>
<package-name>org.hibernate.validator.*</package-name>
</prefer-application-packages>
After making that change, our application experienced the following run-time error trying to process any request that makes use of the validation framework:
javax.validation.ValidationException: Unable to get available provider resolvers.
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:259)
at web20.hibernate.validation.ValidatorFactoryConfigurator.getValidatorFactory(ValidatorFactoryConfigurator.java:39)
at web20.hibernate.validation.ValidationHandlerImpl.handleHibernateValidations(ValidationHandlerImpl.java:180)
at web20.hibernate.validation.ValidationHandlerImpl.performValidation(ValidationHandlerImpl.java:255)
at web20.hibernate.validation.ValidationHandlerImpl.validateAndFormatMessages(ValidationHandlerImpl.java:302)
at web20.hibernate.validation.ValidationHandlerImpl.validateUsingHibernateGroups(ValidationHandlerImpl.java:113)
at service.serviceapp.performValidations(serviceapp.java:392)
at service.serviceapp.performValidations(serviceapp.java:379)
at service.TransactionalServiceImpl.search(TransactionalServiceImpl.java:300)
Given that Bean Validation is part of the EE standard, I assume there is some code Bean Validation integration code which causes the problem. I see two potential solutions:
Patch the WL instance and upgrade to the Validator version you want to use
Try writing your own ValidationProvider. Internally it could just delegate to the Hibernate Validator classes. If you then add a validation.xml to your application, specifying your custom provider, WL should bootstrap this one. TBH, I don't know whether this will work. There are many unknowns and I don't know enough about the integration of WL and Bean Validation.
Personally, I think I would just try to upgrade the Validator version used in WL.