Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Scaladin and SBT configuration

Christopher P
9 years ago Apr 19, 2012 10:58pm
Risto Yrjänä
9 years ago Apr 20, 2012 2:58pm
Christopher P
9 years ago Apr 20, 2012 3:48pm
Risto Yrjänä
9 years ago Apr 22, 2012 1:28pm
Steve Thompson
9 years ago Apr 29, 2012 1:59pm
Christopher P
9 years ago May 10, 2012 4:41pm
Christopher P
9 years ago May 10, 2012 4:45pm
Christopher P
9 years ago May 10, 2012 4:52pm
Lutz Huehnken
9 years ago Mar 21, 2013 5:00pm

Hi,

I'm new to Vaadin, but I feel adventurous and would like to try out the latest version, and with Scala. So I try to get a simple Vaadin "Hello World" to run with
Scala 2.10.1
Vaadin 7.0.3
Scaladin 3.0.0 (build from github sources)
sbt 0.12.2

I get some example code to compile, but when I run
sbt
> container:start

all I see is

javax.servlet.UnavailableException: Servlet Not Initialized

and a stack trace.

Does someone by any chance have a working build.sbt for Scaladin 3 / Vaadin 7 ? Or maybe someone can point me to an example / hello world application for this combination somewhere?

Thanks,
Lutz

Last updated on Mar, 21st 2013
Henri Kerola
9 years ago Mar 21, 2013 10:12pm

Lutz Huehnken: Does someone by any chance have a working build.sbt for Scaladin 3 / Vaadin 7 ? Or maybe someone can point me to an example / hello world application for this combination somewhere?

Here's a simple sbt setup that works:

├── build.sbt
├── lib
│   └── scaladin_2.10-3.0.0-SNAPSHOT.jar
├── project
│   ├── plugins.sbt
└── src
    └── main
        ├── scala
        │   └── com
        │       └── example
        │           └── MyScaladinUI.scala
        └── webapp
            └── WEB-INF
                └── web.xml

build.sbt

name := "myproject"

scalaVersion := "2.10.1"

libraryDependencies ++= Seq(
  "com.vaadin" % "vaadin-server" % "7.0.3",
  "com.vaadin" % "vaadin-client-compiled" % "7.0.3",
  "com.vaadin" % "vaadin-themes" % "7.0.3",
  "javax.servlet" % "servlet-api" % "2.4",
  "org.eclipse.jetty" % "jetty-webapp" % "8.1.10.v20130312" % "container"
)

seq(webSettings :_*)

plugins.sbt

libraryDependencies += "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.1"

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="VaadinScala" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <display-name>Scaladin Application</display-name>
        <context-param>
                <description>
                Vaadin production mode</description>
                <param-name>productionMode</param-name>
                <param-value>false</param-value>
        </context-param>
        <servlet>
                <servlet-name>Scaladin Application</servlet-name>
                <servlet-class>vaadin.scala.ScaladinServlet</servlet-class>
                <init-param>
                        <param-name>ScaladinUI</param-name>
                        <param-value>com.example.MyScaladinUI</param-value>
                </init-param>
        </servlet>
        <servlet-mapping>
                <servlet-name>Scaladin Application</servlet-name>
                <url-pattern>/*</url-pattern>
        </servlet-mapping>
</web-app>

MyScaladinUI.scala

package com.example

import vaadin.scala._

class MyScaladinUI extends UI {
  content = Button("Click me!", Notification.show("Hello World!"))
}
Last updated on Mar, 21st 2013
Lutz Huehnken
9 years ago Mar 22, 2013 8:18am
Henri Kerola
9 years ago Mar 22, 2013 8:20am
Olivier SAINT-EVE
8 years ago Mar 09, 2014 7:46pm

hello henri,

I tried to copy the example you gave, but I have an error while entering "sbt" :
   scala.reflect.internal.FatalError: object Predef does not have a member $qmark$qmark$qmark
I add that I used this plugins.sbt:
*************
libraryDependencies += "com.github.siasia" % "xsbt-web-plugin_2.9.2" % "0.12.0-0.2.11.1"
*************
because sbt was unable to find the former file.
Do you know what's wrong?

Lukasz Byczynski
8 years ago Mar 09, 2014 8:29pm