运行服务器后播放应用程序意外的异常

时间:2019-03-24 09:23:52

标签: scala server playframework

我有一个用于简单CRUD操作的Scala Play应用程序。我能够运行此应用程序,并对其进行了大量测试。但是,现在当我尝试运行该应用程序时,服务器已启动,但是无法接受任何http请求,并且突然失败。

我尝试运行以下命令

clean
compile
update
reload

,它们全部成功执行。当我使用run命令运行服务器时,在控制台上得到的输出为

[IJ][user-service] $ run

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

现在,一旦我发出任何http请求(该请求之前已经起作用),就会出现以下错误。

[error] application - 

! @7bag02h83 - Internal server error, for (GET) [/service/api/setup] ->

play.api.UnexpectedException: Unexpected exception[IllegalArgumentException: requirement failed: sourceMapper parameter is no longer supported by createContext; use create method's devContext parameter instead]
    at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:186)
    at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
    at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:202)
    at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:117)
    at akka.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1318)
    at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:519)
    at akka.stream.impl.fusing.GraphInterpreter.processEvent(GraphInterpreter.scala:482)
    at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:378)
    at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:588)
    at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:472)
Caused by: java.lang.IllegalArgumentException: requirement failed: sourceMapper parameter is no longer supported by createContext; use create method's devContext parameter instead
    at scala.Predef$.require(Predef.scala:277)
    at play.api.ApplicationLoader$.createContext(ApplicationLoader.scala:187)
    at play.core.server.DevServerStart$$anon$1.$anonfun$reload$3(DevServerStart.scala:172)
    at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
    at play.core.server.DevServerStart$$anon$1.reload(DevServerStart.scala:171)
    at play.core.server.DevServerStart$$anon$1.get(DevServerStart.scala:124)
    at play.core.server.AkkaHttpServer.handleRequest(AkkaHttpServer.scala:202)
    at play.core.server.AkkaHttpServer.$anonfun$createServerBinding$1(AkkaHttpServer.scala:117)
    at akka.stream.impl.fusing.MapAsyncUnordered$$anon$31.onPush(Ops.scala:1318)
    at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:519)
[error] application 

有人可以让我知道我在这里想念的吗?是某种需要添加的配置设置吗?

任何指针都将非常有帮助。在此先感谢!!!

1 个答案:

答案 0 :(得分:0)

我恢复了build.sbt文件的依赖关系,现在看来可以正常工作了。

当前build.sbt(正在运行)

public partial class Statt : UserControl
    {
        string dataIN;
        double dataForGraph;


        public Statt()
        {
            InitializeComponent();

            cartesianChart1.Series.Add(new LineSeries
            {
                Values = new ChartValues<double> { dataForGraph },
                StrokeThickness = 4,
                StrokeDashArray = new System.Windows.Media.DoubleCollection(20),
                Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(107, 185, 69)),
                Fill = System.Windows.Media.Brushes.Transparent,
                LineSmoothness = 0,
                PointGeometry = null
            });
        }

        public void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            dataIN = serialPort1.ReadExisting();
            dataForGraph = Convert.ToDouble(dataIN);
            this.Invoke(new EventHandler(ShowData));

        }


        public void ShowData(object sender, EventArgs e)
        {
            testLabel.Text = dataIN;
        }
    }

旧的build.sbt(这给了我错误)

libraryDependencies += guice
libraryDependencies += "com.typesafe.play" %% "play-slick" % "3.0.3"
libraryDependencies += "com.typesafe.play" %% "play-slick-evolutions" % "3.0.3"

libraryDependencies += "com.h2database" % "h2" % "1.4.196"

libraryDependencies += specs2 % Test

我不知道它如何再次开始工作,但是解决了我的问题。谢谢!!!