简体   繁体   English

找不到Play框架Scala Intellij IDE操作

[英]Play framework scala Intellij IDE action not found

I'm trying to setup basic play scala application with Intellij IDE (v 10.5.1). 我正在尝试使用Intellij IDE(v 10.5.1)设置基本的scala应用程序。

I followed the instructions http://www.jamesward.com/2011/07/28/setup-play-framework-with-scala-in-intellij 我遵循了以下说明:http://www.jamesward.com/2011/07/28/setup-play-framework-with-scala-in-intellij

When I start the application from the IDE everything is OK: 01:44:20,734 INFO ~ Application 'hello6' is now started ! 当我从IDE启动应用程序时,一切正常:01:44:20,734信息〜现在启动了应用程序'hello6'!

But when I try to open a page in browser I'm getting the error in the output: 但是,当我尝试在浏览器中打开页面时,输出错误:

application.index action not found 找不到application.index操作

Action not found Action application.index could not be found. 找不到动作找不到动作application.index。 Error raised is Controller controllers.application not found 引发错误是找不到Controller controllers.application

play.exceptions.ActionNotFoundException: Action application.index not found
    at play.mvc.ActionInvoker.getActionMethod(ActionInvoker.java:585)
    at play.mvc.ActionInvoker.resolve(ActionInvoker.java:84)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.Exception: Controller controllers.application not found

Looks like scala compilation just not happening for some reason. 看起来scala编译只是出于某种原因而没有发生。 Everything works good if I'm running the application directly from play server. 如果我直接从播放服务器运行应用程序,则一切正常。

Play v1.2.2, scala-module 0.9.1. 播放v1.2.2,scala模块0.9.1。 Tried in Ubuntu 10.4 and Windows 7. 在Ubuntu 10.4和Windows 7中试用。

Updated adding routes file and Application.scala 更新了添加路由文件和Application.scala

# Home page
GET     /                                       Application.index

# Ignore favicon requests
GET     /favicon.ico                            404

# Map static resources from the /app/public folder to the /public path
GET     /public/                                staticDir:public

# Catch all
*       /{controller}/{action}                  {controller}.{action}

============================================================================ ================================================== =========================

package controllers

import play._
import play.mvc._

object Application extends Controller {

    import views.Application._

    def index = {
        html.index("Your Scala application is ready!")
    }

}

This part: 这部分:

application.index 应用索引

Seems wrong, shouldn't it be Application.index? 似乎不对,应该不是Application.index吗? With capital A. Check you routes file, maybe it has that typo. 用大写字母A。检查您的路由文件,也许它有错字。

Found solution. 找到解决方案。 In project structure PlayFramework Dependecies and Project Libraries were not configured properly. 在项目结构中,未正确配置PlayFramework Dependecies项目库 After I fixed paths to ...play/framework/lib and ...play/modules/scala-0.9.1/lib scala compilation start working. 在我修复了... play / framework / lib和... play / modules / scala-0.9.1 / lib的路径后,scala编译开始工作。

在路线中,将动作设为

controllers.Application.index

I was having the same problem. 我遇到了同样的问题。 After going to SBT projects and refresh it went away. 进入SBT项目并刷新后,它就消失了。

SBT项目的屏幕截图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM