This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Using Scala classes in a Java Servlet (in Eclipse)

2 replies
Lachlan Cotter
Joined: 2009-11-01,
User offline. Last seen 42 years 45 weeks ago.
Hi all,



I trying to use Scala classes that I've developed in a Java Servlet.
I've set-up my servlet in a Dynamic Web Project (in Eclipse) and linked it to a Scala project in the same workspace (under Build Path > Projects).
I also selected the Scala project under Java EE Module Dependancies.
This works with Java projects, however, for the Scala project, I get the following build warning when building the web application:
Classpath entry ch.epfl.lamp.sdt.launching.SCALA_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result. 
Also, Eclipse can't seem to find my Scala classes from within the Java web app.

What is the meaning of the build error? and what can I do to remove it?


Cheers,Lach
milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Using Scala classes in a Java Servlet (in Eclipse)

On Fri, Dec 4, 2009 at 7:23 AM, Lachlan Cotter wrote:
> What is the meaning of the build error? and what can I do to remove it?

It means that the Dynamic Web Project tooling doesn't know enough
about Scala to know how to deploy a web application with a dependency
on the Scala library. You'll need to include scala-library.jar
explicitly.

Cheers,

Miles

Lachlan Cotter
Joined: 2009-11-01,
User offline. Last seen 42 years 45 weeks ago.
Re: Using Scala classes in a Java Servlet (in Eclipse)
Hi Mike,

Thanks for the help. To be honest, I got side tracked and haven't actually tried this yet. In the meantime, I ended just using an embedded Jetty server in my Scala project which is working just fine for development. Eventually I'll probably have to split it up to make it deployable.

Cheers,Lach

On 07/12/2009, at 1:41 AM, Miles Sabin wrote:
On Fri, Dec 4, 2009 at 7:23 AM, Lachlan Cotter <lach@lachlanc.id.au> wrote:
What is the meaning of the build error? and what can I do to remove it?

It means that the Dynamic Web Project tooling doesn't know enough
about Scala to know how to deploy a web application with a dependency
on the Scala library. You'll need to include scala-library.jar
explicitly.

Cheers,


Miles

--
Miles Sabin
tel: +44 (0)7813 944 528
skype:  milessabin
http://www.chuusai.com/
http://twitter.com/milessabin

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland