


How to Solve 'No injection source found' Errors in Jersey Multipart File Uploads?
Multipart File Upload Issues with Jersey Restful API
In an effort to create a RESTful service for file uploads, you encountered the error: "No injection source found for a parameter of type public javax.ws.rs.core.Response." This error arises after attempting to run your Tomcat server.
Solution:
Your current dependencies include jersey-multipart-1.18.jar, which is meant for Jersey 1.x. For a successful build, replace it with these two JARs:
- jersey-media-multipart-2.17
- mimepull-1.9.3
Additionally, register the MultiPartFeature class to your application. If using ResourceConfig, simply invoke:
register(MultiPartFeature.class);
For web.xml configuration, add the following as an init-param to the Jersey servlet:
<init-param> <param-name>jersey.config.server.provider.classnames</param-name> <param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value> </init-param>
After removing jersey-multipart-1.18.jar, you may encounter compile errors due to modified package names. Specifically, the following package names have changed:
- FileUploadHandler -> org.glassfish.jersey.media.multipart
- MultiPartFeature -> org.glassfish.jersey.media.multipart
- FormDataParam -> org.glassfish.jersey.media.multipart
- FormDataContentDisposition -> org.glassfish.jersey.media.multipart
Update your code accordingly, and your file upload service should operate as intended.
The above is the detailed content of How to Solve 'No injection source found' Errors in Jersey Multipart File Uploads?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool