Multipart Fileupload problem with Akka 2.4.8 and 2.4.9-RC1

177 views
Skip to first unread message

Scott Lunel

unread,
Aug 4, 2016, 11:28:56 AM8/4/16
to Akka User List
Hello everyone,


I seem to be having a problem with Multipart file upload since Akka 2.4.8. It works perfectly fine in 2.4.7.

I've google searched for anything related to this and haven't found much, so I've decided to post here.

Code to reproduce:

val upload = path("upload") {
    post {
      fileUpload("file") {
        case (fileInfo, bytes) ⇒
          complete("Done")
      }
    }
}


The exception:

Uncaught error from thread [toplevel-akka.actor.default-dispatcher-10] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[toplevel]
java.lang.NoSuchMethodError: akka.stream.ActorMaterializer$.downcast(Lakka/stream/Materializer;)Lakka/stream/ActorMaterializer;
at akka.http.scaladsl.unmarshalling.MultipartUnmarshallers$$anonfun$multipartUnmarshaller$1$$anonfun$apply$1$$anonfun$apply$2$$anonfun$2.apply(MultipartUnmarshallers.scala:78)
at akka.http.scaladsl.unmarshalling.MultipartUnmarshallers$$anonfun$multipartUnmarshaller$1$$anonfun$apply$1$$anonfun$apply$2$$anonfun$2.apply(MultipartUnmarshallers.scala:78)
at scala.Option.getOrElse(Option.scala:121)
at akka.http.scaladsl.unmarshalling.MultipartUnmarshallers$$anonfun$multipartUnmarshaller$1$$anonfun$apply$1$$anonfun$apply$2.apply(MultipartUnmarshallers.scala:78)
at akka.http.scaladsl.unmarshalling.MultipartUnmarshallers$$anonfun$multipartUnmarshaller$1$$anonfun$apply$1$$anonfun$apply$2.apply(MultipartUnmarshallers.scala:71)
at akka.http.scaladsl.unmarshalling.Unmarshaller$$anon$1.apply(Unmarshaller.scala:52)
at akka.http.scaladsl.unmarshalling.LowerPriorityGenericUnmarshallers$$anonfun$messageUnmarshallerFromEntityUnmarshaller$1$$anonfun$apply$1$$anonfun$apply$2.apply(GenericUnmarshallers.scala:20)
at akka.http.scaladsl.unmarshalling.LowerPriorityGenericUnmarshallers$$anonfun$messageUnmarshallerFromEntityUnmarshaller$1$$anonfun$apply$1$$anonfun$apply$2.apply(GenericUnmarshallers.scala:20)
at akka.http.scaladsl.unmarshalling.Unmarshaller$$anon$1.apply(Unmarshaller.scala:52)


This appears to be throwing an exception when the code hits:

entity(as[Multipart.FormData])

I've written my own custom code to do multipart form file uploads and I initially suspected it was a problem on my end. However, after testing the above code (using one of the file upload directives), this error is being thrown in the akka http source.

Is anyone else having this issue? I can't seem to get multipart file uploads to work in 2.4.8 and 2.4.9-RC1.

Any help / information would be greatly appreciated.


Regards,

Scott.

Johan Andrén

unread,
Aug 4, 2016, 11:30:15 AM8/4/16
to Akka User List
Hi Scott, 

Seems like you are mixing different versions of akka-http and akka-streams. Look over your dependencies!

--
Johan
Akka Team

Scott Lunel

unread,
Aug 4, 2016, 11:53:34 AM8/4/16
to Akka User List
Hey Johan,

Thanks for the quick reply.

Looks like you were right. My Maven configuration is rather complicated, and one of the child projects was not pulling in the correct version of akka-http.

Such a silly mistake.

Konrad Malawski

unread,
Aug 4, 2016, 11:55:20 AM8/4/16
to akka...@googlegroups.com, Scott Lunel
Glad that was it Scott.
I'd recommend keeping an akka.version property in properties in Maven, 
and bump it there each time instead of specifically keeping the version in all dependencies explicitly.

Hope this helps, happy hakking!

-- 
Konrad `ktoso` Malawski
Akka @ Lightbend
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Scott Lunel

unread,
Aug 5, 2016, 5:46:37 AM8/5/16
to Akka User List
Hey, sorry but I have yet another stupid question.

All of my dependencies seem to be correct now, but when I switch from version 2.4.8 to 2.4.9-RC1, I get this error:

[ERROR] error: missing or invalid dependency detected while loading class file 'Unmarshaller.class'.
[INFO] Could not access type Unmarshaller in value akka.http.javadsl.unmarshalling,
[INFO] because it (or its dependencies) are missing. Check your build definition for
[INFO] missing or conflicting dependencies.

It says in the migration documentation from 2.4.8 to 2.4.9-RC1 that the package has been moved from akka.http.javadsl.server to the unmarshalling one shown above.

I can't seem to get around this error no matter what I do.

Konrad Malawski

unread,
Aug 5, 2016, 5:49:14 AM8/5/16
to akka...@googlegroups.com, Scott Lunel
Hi Scott,
OSGi messed up our RC1 release.
Sorry for the trouble, though glad we did the RC which is there for finding such issues before we release a stable version.

The bug is explained in https://github.com/akka/akka/issues/21105 and I've fixed both root cause and sbt plugin so we'll never have this issue again.
I'm releasing RC2 right now, please wait a bit and upgrade to it then.

Thanks

-- 
Konrad `ktoso` Malawski
Akka @ Lightbend

--

Scott Lunel

unread,
Aug 5, 2016, 7:15:08 AM8/5/16
to Akka User List, scott...@gmail.com
Ah ok that explains a lot.

No worries, thanks for the reply. I appreciate it!
Reply all
Reply to author
Forward
0 new messages