Upload a File with Jersey using AJAX and HTML5 progress bar

You may also like...

Subscribe
Notify of
guest
7 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Mike B.
Mike B.
January 25, 2016 03:35

I have a similar project but somehow when I deploy it I get an error. Have you encountered anything similar? Severe: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has failed during application initialization. [[FATAL] No injection source found for a parameter of type public javax.ws.rs.core.Response rover7c.rest.SegmentController.postSegment(java.lang.String,java.lang.String,java.io.InputStream,org.glassfish.jersey.media.multipart.FormDataContentDisposition) at index 2.; source=’ResourceMethod{httpMethod=POST, consumedTypes=[multipart/form-data], producedTypes=[application/json], suspended=false, suspendTimeout=0, suspendTimeoutUnit=MILLISECONDS, invocable=Invocable{handler=ClassBasedMethodHandler{handlerClass=class rover7c.rest.SegmentController, handlerConstructors=[org.glassfish.jersey.server.model.HandlerConstructor@189cd22e]}, definitionMethod=public javax.ws.rs.core.Response rover7c.rest.SegmentController.postSegment(java.lang.String,java.lang.String,java.io.InputStream,org.glassfish.jersey.media.multipart.FormDataContentDisposition), parameters=[Parameter [type=class java.lang.String, source=userId, defaultValue=null], Parameter [type=class java.lang.String, source=deviceId, defaultValue=null], Parameter [type=class java.io.InputStream, source=file, defaultValue=null], Parameter [type=class org.glassfish.jersey.media.multipart.FormDataContentDisposition, source=file, defaultValue=null]], responseType=class javax.ws.rs.core.Response}, nameBindings=[]}’, [WARNING] The (sub)resource method postSegment… Read more »

Mike Borozdin
Mike Borozdin
January 25, 2016 17:54

Hi! I am using configuration in a slightly different way. I believe both are valid, do you think this is what’s causing the problem?

<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>rover7c.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>

omar
omar
September 30, 2016 20:49

Hey i was able to build youre uploader using mvn clean install and it was successful but i dont understand what modification i need to make to be able to post file to the rest service everytime i upload a file it says error. Any help would be great my project is due very soon and this would be awesome to include.

THanks!

Memorynotfound.com
Memorynotfound.com
October 2, 2016 22:05
Reply to  omar

Hello Omar, Is the error originating from the server, or the client? And can you please provide more detail about which error you’re receiving?

Paco Gamero
Paco Gamero
February 6, 2017 19:50

Hi!, I am testing some examples with the same bad result, your code is the last one. My problem is that the event progress is triggered only one time. For example, following your code, the event is triggered at the beginning and the progress bar is filled with the 100% value, but the file is not uploaded yet. Any idea? Thanks in advance.

7
0
Would love your thoughts, please comment.x
()
x