Failed to load sbt configuration Play-Scala - scala

i was trying to make a new project with play-scala in my activator, but i keep getting this error:
java.lang.NoClassDefFoundError: play/Play$
Use 'last' for the full log.
Failed to load project.

I found the answer here:
Why does sbt fail with NoClassDefFoundError: play/Play$ in Play 2.2.x projects after sbt compile in Play 2.3 project?
The project/play-fork-run.sbt file in the your-project-name\project folder needs to be removed if you tried the entire process through the "activator ui" web interface.

Related

activator fails to load project after IDE restart (scala, play, intellij idea)

I have a small play application (resultful service) and I am using Intellij Idea. My project compiles fine from the IDE, and I could also use activator to compile and run the application. I quit the IDE (while my application was running inside activator). Now activator or sbt cannot load the build.sbt file and complain:
[MY_APP_FOLDER]/build.sbt:1: error: not found: object play
import play.PlayImport.PlayKeys._
I still can compile from within the IDE.
EDIT: I am thinking if there is some sort of cache for activator that could be corrupted for this application? My other application is loaded into activator with no problem.
I found out that somehow the plugins.sbt was removed from the project folder. After recovering it, the compilation is successful again.

eclipse gives error on start up after adding sbteclipse plugin

I add sbt eclipse plug-in .First I created the project named hello the in project directory i created a file named plugins.sbt and add this line in it
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")
and after the sbt> I typed eclipse then it created the project for eclipse
when I open eclipse it gives me error message
An error has occurred. See the error log for more details
The org.eclipse.jdt.ui.javaElementFilters plug-in extension "scala.tools.eclipse.javaelements.ScalaElementFilter" specifies a viewer filter class which does not exist.
Plug-in org.scala-ide.sdt.core was unable to load class scala.tools.eclipse.javaelements.ScalaElementFilter.
An error occurred while automatically activating bundle org.scala-ide.sdt.core (806).
please help me to how to resolve this error and when I imported the sbt project eclipse give me another error
Building workspace has encountered a problem
Errors occurred during the build.
Error instantiating builder 'org.scala-ide.sdt.core.scalabuilder'.
Plug-in org.scala-ide.sdt.core was unable to load class scala.tools.eclipse.ScalaBuilder.
An error occurred while automatically activating bundle org.scala-ide.sdt.core (806).
Plug-in org.scala-ide.sdt.core was unable to load class scala.tools.eclipse.ScalaBuilder.
An error occurred while automatically activating bundle org.scala-ide.sdt.core (806).
Please help me
scala version 2.11.1
sbt version 0.13
I added the scala-IDE plugin from this source
http://scala-ide.org/download/current.html
i am using eclipse juno and pasted the following location in install new software
http://download.scala-ide.org/sdk/helium/e38/scala211/stable/site
my project compiles successfully in sbt
Are you using Eclipse Luna for Java Developers (as opposed to Eclipse Classic) AND Scala IDE 4.0 milestone 3? There is a known issue (solved in the nightly builds since then), reported on the mailing list here.
You can "fix" it by either upgrading the Scala plugin to a nightly build (they're pretty stable), or going with Eclipse Classic instead.

How to run Lift's 'Ecommerce example' app

I'm new to Scala and Lift and SBT. I've cloned Ecommerce example from Lift's sample applications.
Now I want to simply run the application.
Documentation says, that container:start should start the app. But I'm getting error:
> container:start
[error] No action named 'container:start' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
[info]
[info] Total time: 0 s, completed 25.05.2013 16:47:05
I guess that maybe it's because version difference.
[info] using LiftProject with sbt 0.7.5 and Scala 2.7.7
How can I start this application ?
And if it's caused by version difference is it possible to upgrade the application to latest sbt and scala version ?
Update
I've tried to use jetty-start and received another error:
> jetty-start
[error] No action named 'jetty-start' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
I've also found another similar command jetty-run from sbt help. When I run it I'm getting a huge number of compilation errors. It seems like my scala 2.9.2 cannot compile the code.
This project, as far as I see, uses the old SBT version. The old way to start the web application is:
./sbt
> jetty-start
if you want to reload the app on source change, use ~ jetty-start
Note that there's a far more up to date liftweb project example here: https://github.com/lift/lift_25_sbt
probably sbt did not download the requried jar files.
run the following command
> sbt
> update
now sbt should download the requried jar files
>jetty-run
now sbt should compile and run the web-app.

Play framework 2.0 unresolved dependencies

I have created a scala project with play framework 2.0.
The project compiles and runs fine both with sbt and play commands.
However, the problems started when I tried to add another play project as a dependency to my project, because I needed to reuse some of its classes.
sbt compile succeeds, but play compile/run does not.
They give me the following error:
sbt.ResolveException: unresolved dependency: name_of_old_project_play_dependency: not found
I am also not able to run the project with sbt run; whenever I do a request to the play framework, I get a null pointer exception.
Is that because both the projects are play projects and maybe there is a conflict somewhere?
Any insight would be appreciated!
Please be sure to view the play version since sbt (the build system play uses) may have different versions.
Please verify the build.properties and plugins.sbt play version.
A technique I use to solve unresolved dependencies is to check the links that sbt tries to access.
I manually try to fetch the file by visiting the failed sites. I usually discover I have a version mishap.

GWT Development Mode with Eclipse/Maven

I am just starting with GWT. I use Eclipse and have installed the GWT plugin.
I have followed the directions here Maven GWT 2.0 and Eclipse to set up a GWT project using the gwt-maven-plugin. When I run the Maven goals gwt:compile gwt:run, GWT Development Mode is launched and I can copy the url from it to my browser and view the label.
However, the project has this problem:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
If I try to run the project as a Google Web Application, I get this warning:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
I can get rid of the problem by copying the web.xml to the war directory, but I still get the URL issue when running as a Google Web App.
If I'm using Maven and GWT in Eclipse, should I just ignore the web.xml problem and always run applications in development mode via the Maven goals? Or is there a way to set things so I can run as a Google Web App?
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run? I have added breakpoints to my application but it doesn't stop on them. I'm not sure if it is something I've configured wrong or if it's just not possible.
Update:
In response to Prem's answer...
When I run a compile gwt:run, the web.xml file isn't copied. When I run the install gwt:run, I get this error:
[INFO] --- gwt-maven-plugin:1.2:test (default) # SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
I’m guessing that bug http://jira.codehaus.org/browse/MGWT-24 is included in version 1.2 of the gwt-maven-plugin. Normally I wouldn’t run install on a project that builds a war file, but I would expect to at least get past the test phase of the build cycle.
Does anybody have any idea why I would get this error on the install but not the compile goals? Also, should I be expecting either goal to copy the web.xml file from src/main/webapp/WEB-INF/web.xml to the /war directory?
Description: The web.xml file does not exist
gwt-maven-plugin creates a project with 'war' packaging format (it's a web app so no surpirse here). Web.xml for this project will be under 'src/main/webapp' folder which will be copied to the 'war' directory (which is set as the output directory) as part of the 'resources' phase in the maven build life-cycle. You should always use
mvn compile gwt:run
or
mvn install gwt:run
so that resources are copied, all java files are compiled and gwt:compile is also invoked (since it is bound to the 'compile' phase automatically)
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
As per the stackoverflow link you used as reference, only your maven build file is setup with startupUrl. In order for it to work in Eclipse, you must edit the Run Configuration of your project and add the '-statupUrl' command line arguments to the existing arguments in the "Arguments" panel.
However, this is just a warning and it should not stop you from running your GWT application from eclipse. If you are facing the same "web.xml" problem here as well, it could be because you did not compile your project in your IDE before invoking "Run as Web Application". I suggest you to disable "Build Automatically" option for this project and always build it manually and invoke "GWT Compile" and then try "Run as web application"
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run?
In general you must use "Remote Application" debug configuration for remote debugging a process. However I am not sure if it will work for GWT projects.
I got me too this warning:
No startup URLs supplied and no plausible ones found
when I have followed this gwt tutorial
In that screenshot there is no checkbox with "Generate sample code" . In my IDE ( sdk 2.5) it is, so I have unchecked...
It wasn't created any of the server and client packages, I have created the client manually, as the tutorial required. The tutorial until that step doesn't say I must have a server package too. That and his configuration is missing from project.
If you right-click on your project and go to Properties -> Google -> Web Application, your WAR directory might be something like either war or src/main/webapp/WEB-INF/classes.
Change that to src/main/webapp.
Also un-check the box next to "Launch and delploy from this directory..."
That's what fixed this problem for me. It also fixed the "can't find gwt-servlet.jar" problem at the same time.