Home >Java >javaTutorial >How to Fix 'No injection source found' Errors in Multipart/Form-data REST API Uploads?
A common error encountered when uploading files through a RESTful API using the MULTIPART_FORM_DATA content type is:
"No injection source found for a parameter of type public javax.ws.rs.core.Response..."
This error typically occurs due to missing or incorrect JAR dependencies for handling multipart forms.
To resolve this issue, you need to replace the outdated jersey-multipart-1.18.jar dependency with the following two:
In your Maven dependency, use:
<dependency> <groupId>org.glassfish.jersey.media</groupId> <artifactId>jersey-media-multipart</artifactId> <version>2.17</version> </dependency>
register(MultiPartFeature.class);
<init-param> <param-name>jersey.config.server.provider.classnames</param-name> <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value> </init-param>
The above is the detailed content of How to Fix 'No injection source found' Errors in Multipart/Form-data REST API Uploads?. For more information, please follow other related articles on the PHP Chinese website!