Comments (16)
I get the same error - we both added the entries for scala in langs.properties
in Vert.x 2.0.2-final. @galderz can you please have a look at this? Seems like running scripts doesn't really work when using vertx run X
?
from mod-lang-scala.
If you're trying to use latest master, you have to build mod-lang-scala jars locally and copy them over to you have to copy over the jar files. These are the instructions I use (adjust to your own env) when testing scripts with snapshot releases I build locally.
from mod-lang-scala.
Okay, so after doing this:
./gradlew install
vertx install io.vertx~lang-scala~0.2.0-SNAPSHOT
I don't have the jar files of mod-lang-scala
inside its own module dir in sys-mods
, even though the .class
files are available directly in the module directory (not in lib/
as jars).
So putting these .class
files into a jar and adding those into the modules lib directory seems to do the trick.
Why is that? Is this a general Vert.x issue, that it needs the language modules in a really strange format and cannot do that itself on install? Do we have to change something in the gradle build?
Will users have to do this themselves when they try to run Scala code?
from mod-lang-scala.
You shouldn't have to copy anything manually - perhaps you're not building mod-lang-scala properly with the jar files in it's lib directory?
from mod-lang-scala.
@purplefox we have the following structure in the module:
lib/
+ scala-library.jar
+ scala-compiler.jar
+ scala-reflect.jar
org/vertx/scala/
+ All the class files in their respective package...
mod.json
It looks like we need to have all the org/vertx/scala/<class-files>
in a .jar
and put that inside the lib/
directory as well, otherwise it won't work. That's strange that it somehow doesn't use the class files directly. Just tried a JS Script which downloaded lang-rhino and a Groovy Script with lang-groovy: Their modules have the same structure and do not need their class-files (or js scripts) in a jar lying in <mod-name>/lib/<classes-jar>
. So something still is wrong with the Scala module and we shouldn't need to copy anything around in it... Guess the interpreter somehow gets the wrong ClassLoader so it doesn't have org.vertx.scala.* available? Or that regex stuff which adds the *.jar
files should add the module directory itself, too?
from mod-lang-scala.
Most probably you have a classloader issue in the mod-lang-scala module. Did you implement the recommendation I made last time about removing the second classloader that was being specifically used for scripts?
from mod-lang-scala.
Looks like it doesn't have a second class loader anymore. @galderz knows more about the implementation now...
from mod-lang-scala.
This line looks suspicious to me:
Does this mean it's setting the context class loader to null?
from mod-lang-scala.
Looks like this assembles the classpath for the interpreter:
But it looks strange to me, can't the interpreter just load resources from the context classloader? It seems odd to have to construct it this way...
from mod-lang-scala.
As far as I know you cant, you have to explicitly set the interpreter's
classpath.
On Thu, Oct 24, 2013 at 7:19 PM, Tim Fox [email protected] wrote:
Looks like this assembles the classpath for the interpreter:
But it looks strange to me, can't the interpreter just load resources from
the context classloader? It seems odd to have to construct it this way...—
Reply to this email directly or view it on GitHubhttps://github.com//issues/65#issuecomment-26974153
.
Ranie Jade Ramiso
Software Engineer | Open Source Enthusiast | Professional Slacker
Philippines
w: raniejaderamiso.com
e: [email protected]
from mod-lang-scala.
Guys, leave this with me and I'll sort it out :)
from mod-lang-scala.
My fault guys, I messed it up when I refactored the ScalaVerticleFactory to split the interpreter out. PR coming right up...
from mod-lang-scala.
This is very weird. While trying to verify fix for #69 this issue seems to have reappeared :|. This was working with the 2.0.x snapshot, so maybe when we switched to 2.1-M1 something changed in the way Vert.x module classloader. Looking into it...
from mod-lang-scala.
Fixed properly now. Apologies for the inconvenience.
from mod-lang-scala.
I still get this error when using 2.1M2 ?
λ omnivore scala → λ git master → vertx run http/Server.scala
Downloading io.vertxlang-scala0.2.0. Please wait...
Downloading 100%
Module io.vertxlang-scala0.2.0 successfully installed
Compiling http/Server.scala as Scala script
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
:7: error: object scala is not a member of package org.vertx
import org.vertx.scala., org.vertx.scala.core., org.vertx.scala.core.buffer., org.vertx.scala.core.dns., org.vertx.scala.core.eventbus., org.vertx.scala.core.file., org.vertx.scala.core.http., org.vertx.scala.core.json., org.vertx.scala.core.net., org.vertx.scala.core.streams.
^
Script contains compilation errors, or http/Server.scala is a Scala class (pass -Dvertx.scala.interpreter.verbose=true to find out more)
Compiling as a Scala class
/Volumes/data-store/src/vertx-examples/src/raw/scala/http/Server.scala:17: error: expected class or object definition
vertx.createHttpServer.requestHandler { req: HttpServerRequest =>
^
Failed in deploying verticle
java.lang.IllegalArgumentException: Unable to run http/Server.scala as neither Scala script nor Scala class
at org.vertx.scala.platform.impl.ScalaVerticleFactory$$anonfun$1.apply(ScalaVerticleFactory.scala:116)
at org.vertx.scala.platform.impl.ScalaVerticleFactory$$anonfun$1.apply(ScalaVerticleFactory.scala:116)
at scala.Option.getOrElse(Option.scala:120)
at org.vertx.scala.platform.impl.ScalaVerticleFactory.load(ScalaVerticleFactory.scala:115)
at org.vertx.scala.platform.impl.ScalaVerticleFactory.createVerticle(ScalaVerticleFactory.scala:68)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1540)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:724)
Failed in deploying verticle
java.lang.IllegalArgumentException: Unable to run http/Server.scala as neither Scala script nor Scala class
at org.vertx.scala.platform.impl.ScalaVerticleFactory$$anonfun$1.apply(ScalaVerticleFactory.scala:116)
at org.vertx.scala.platform.impl.ScalaVerticleFactory$$anonfun$1.apply(ScalaVerticleFactory.scala:116)
at scala.Option.getOrElse(Option.scala:120)
at org.vertx.scala.platform.impl.ScalaVerticleFactory.load(ScalaVerticleFactory.scala:115)
at org.vertx.scala.platform.impl.ScalaVerticleFactory.createVerticle(ScalaVerticleFactory.scala:68)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1540)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:724)
from mod-lang-scala.
You are using the latest available release, 0.2.0, which is known to have that issue. In the mean time, please do gradle install
from master locally and then point conf/lang.properties to the 0.3.0-SNAPSHOT version.
from mod-lang-scala.
Related Issues (20)
- is scala included in the latest vertx HOT 2
- Class cast exception when trying to deploy a verticle HOT 2
- An example problem on manual HOT 1
- Problem with Scala scripts in fat jar HOT 5
- Strange behavior with HttpServerResponse headers().put() and putHeader() HOT 1
- scala routerMatcher companion object with default java RouterMatcher argument? HOT 2
- Mod.json empty file HOT 1
- JsonObject and JsonArray should have (Scala) monad and higher-order functions HOT 1
- Script compilation fails with Scala 2.11 HOT 1
- Scripts fail to compile on Windows HOT 1
- Upgrade to Vert.x 2.1.2 HOT 1
- Integrate SBT migration manager plugin
- Add new Router for more idiomatic Scala HOT 1
- Increment version on master?
- Change VertxExecutionContext to run directly HOT 2
- error with latest mod-lang and scala 2.11.2 HOT 1
- Scala router - make RouterException a trait
- Unable to specify instance number on the command line HOT 2
- Scala class is run as a script HOT 4
- Having get parameters can lead to inconsistent results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mod-lang-scala.