akka-remote prevents application from "shading" (standalone JAR creation) due to config issues in Akka 2.1-M1
I've a maven-based project depending on akka, akka-remote and some another libraries.
I want to distribute my application as standalone JAR (with all dependencies included), so I'm using Shade plugin for maven:
Everything is ok, but akka-remote is not able to use default config values anymore, so I'm forced to copy ALL the options for akka-remote and netty transport into my application.
If any option is missing akka gives me the following stacktrace:
I want to distribute my application as standalone JAR (with all dependencies included), so I'm using Shade plugin for maven:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
Everything is ok, but akka-remote is not able to use default config values anymore, so I'm forced to copy ALL the options for akka-remote and netty transport into my application.
If any option is missing akka gives me the following stacktrace:
Exception in thread "main" e4139c62-0a69-450a-8bee-7210c6a6983dakka.remote.RemoteTransportException: Could not load remote transport layer akka.remote.netty.NettyRemoteTransport
at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:74)
at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:581)
at akka.actor.ActorSystemImpl._start(ActorSystem.scala:579)
at akka.actor.ActorSystemImpl.start(ActorSystem.scala:588)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:109)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:102)
at akka.actor.ActorSystem$.create(ActorSystem.scala:64)
at akka.actor.ActorSystem.create(ActorSystem.scala)
at <MYAPP>
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'require-cookie'
at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:115)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:136)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155)
at com.typesafe.config.impl.SimpleConfig.getBoolean(SimpleConfig.java:165)
at akka.remote.netty.NettySettings.<init>(Settings.scala:24)
at akka.remote.netty.NettyRemoteTransport.<init>(NettyRemoteSupport.scala:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3$$anonfun$apply$1.apply(DynamicAccess.scala:109)
at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3$$anonfun$apply$1.apply(DynamicAccess.scala:106)
at akka.actor.DynamicAccess.withErrorHandling(DynamicAccess.scala:73)
at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:106)
at akka.actor.ReflectiveDynamicAccess$$anonfun$createInstanceFor$3.apply(DynamicAccess.scala:103)
at scala.util.Either.fold(Either.scala:98)
at akka.actor.ReflectiveDynamicAccess.createInstanceFor(DynamicAccess.scala:103)
at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:73)
... 8 more
Leave a comment
on 2012-10-18 08:25 *
By worufuramo
Description changed from I've a maven-based project ... to I've a maven-based project ...
This is not something we can solve in akka. Packaging into fat jars comes with this problem, and it can be solved by merging the reference.conf files, which is supported by some other fat jar plugins (for sbt), such as the assembly plugin. See background and solutions by reading the threads related to "assembly plugin" in the mailinglist. https://groups.google.com/forum/?fromgroups#!searchin/akka-user/assembly$20plugin
on 2012-10-19 12:56 *
By matthew.pflueger
This works for me:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allinone</shadedClassifierName>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.echoed.chamber.Main</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
on 2012-10-19 14:49 *
By Patrik Nordwall
Assigned to set to matthew.pflueger@gmail.com
Status changed from Invalid to Fixed
thanks for helping, changing it to fixed :-)
Updating tickets (#939, #940, #1941, #2081, #2126, #2213, #2214, #2215, #2219, #2222, #2223, #2239, #2240, #2249, #2250, #2252, #2253, #2254, #2256, #2259, #2263, #2264, #2265, #2267, #2270, #2271, #2275, #2277, #2286, #2287, #2289, #2290, #2303, #2304, #2308, #2310, #2311, #2317, #2323, #2331, #2374, #2392, #2394, #2405, #2408, #2423, #2424, #2425, #2440, #2444, #2445, #2449, #2453, #2456, #2459, #2461, #2473, #2477, #2485, #2491, #2495, #2498, #2501, #2505, #2515, #2517, #2523, #2534, #2541, #2544, #2545, #2549, #2582, #2583, #2588, #2589, #2598, #2599, #2618, #2623, #2626, #2627, #2630, #2631, #2633, #2634, #2635, #2637, #2638, #2642, #2643, #2646, #2647, #2648, #2649, #2650, #2653, #2655, #2657, #2658)