Home >Java >javaTutorial >How to Resolve 'No injection source found' Error in Jersey Multipart Form Data Upload?
Multipart Form Data Injection Issue
Issue Description:
When attempting to upload files through a REST service using Jersey, the following error is encountered:
No injection source found for a parameter of type public javax.ws.rs.core.Response
Problem Analysis:
The error indicates that the Jersey multipart form data feature is not properly configured or the required JAR files are missing.
Solution:
1. Remove and Add Required JAR Files:
Add the following two dependencies:
2. Register MultiPartFeature:
Register the MultiPartFeature in your Jersey configuration:
web.xml:
<init-param> <param-name>jersey.config.server.provider.classnames</param-name> <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value> </init-param>
3. Update Imported Classes:
After removing jersey-multipart-1.18.jar, there will be compile errors for missing imported classes. Update the class names to reflect the following changes:
The above is the detailed content of How to Resolve 'No injection source found' Error in Jersey Multipart Form Data Upload?. For more information, please follow other related articles on the PHP Chinese website!