Upload a File with Jersey using AJAX and HTML5 progress bar

You may also like...

7
Leave a Reply

avatar
4 Comment threads
3 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
Paco GameroMemorynotfound.comomarMemoryNotFoundMike Borozdin Recent comment authors
  Subscribe  
newest oldest
Notify of
Mike B.
Guest
Mike B.

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=[[email protected]]}, 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
Guest
Mike Borozdin

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
Guest
omar

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
Guest
Memorynotfound.com

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
Guest
Paco Gamero

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.