I use package com.oreilly.servlet to upload files to my server which is build by Tomcat 10, but it seems this package is old and the class MultipartParser need javax.servlet.http.HttpServletRequest as parameter,but servlet only provide me jakarta.servlet.http.HttpServletRequest,so how can i transform jakarta class to javax class? Or is there any jar i can use to upload file quickly?
21 Answer
Tomcat 10
Apache Tomcat 9 and 10 are essentially the same product. One uses the javax.* package naming, and the other uses jakarta.* naming, respectively. The two products are developed in parallel.
The change in package naming is part of the transition of Oracle handing off responsibility for Java EE technologies to the Eclipse Foundation where they were renamed Jakarta EE.
If you are not familiar with this transition, read some industry press, view some video presentations on YouTube etc. This has been covered many time in many places.
If you want to continue using the old naming, just use Tomcat 9 instead of Tomcat 10.0 — same performance, same feature set. You can defer making the name change if you so choose. But future development of Jakarta EE will be done in the new package naming.
If you choose to go with the new naming, you may need to do little more than change your import statements. There may be tools to assist you with this, including new features in the latest IDEs. Again, article and videos are plentiful.
class MultipartParser need javax.servlet.http.HttpServletRequest
If you want to move to the new package naming, you will need to update any and all libraries and tooling using the old naming to new versions using the new naming. If you cannot obtain new versions, you’ll have to stick to the old naming and Tomcat 9.
Or is there any jar i can use to upload file quickly?
I expect you can find many libraries to assist with file upload.
However, asking for software recommendations is explicitly off-topic on this site. See sister site, Software Recommendations Stack Exchange.