1. 程式人生 > >play framework 2.5.3 學習和使用過程中的“坑”

play framework 2.5.3 學習和使用過程中的“坑”

play framework 2.5.3學習和使用過程中的“坑”

最近專案需要,接觸到了play, 使用過程中,遇到了一些坑, 記下來。

1. 版本

play1.x2.x 兩個系列,差異很大。

2.x系列 中的2.3+也有所不同,(目前官方的說法是 Lightbend Activator

安裝還是比較簡單的,

基本就是解壓縮, 配置PATH

依賴的有

SCALA (基本也是解壓縮,配置PATH

2. jdk

文件上明確說明需要 java 1.8

我這邊因為防火牆和 Linux 版本的問題, yum一直有問題。

這次的解決辦法是,直接下載了Oraclejdk1.8

tar.gz 版本的那個。

解壓縮後,直接修改 /usr/bin/java /usr/bin/javac 的指向,(其他的沒有動,可能會出現莫名錯誤)

修改了 /etc/profile中的 JAVA_HOME(沒有的話, 建立一個)

3. 最基本的三個命令

第一次執行的時候,會自動下載很多的依賴項。需要耐心等候。

輸出類似如下:

[info] Resolving jline#jline;2.12.1...

[info] downloadinghttps://repo1.maven.org/maven2/com/typesafe/play/play-server_2.11/2.5.0/play-server_2.11-2.5.0.jar...

[info] [SUCCESSFUL ]com.typesafe.play#play-server_2.11;2.5.0!play-server_2.11.jar(9245ms)

[info] downloadinghttps://repo1.maven.org/maven2/com/typesafe/play/play-java_2.11/2.5.0/play-java_2.11-2.5.0.jar...

[info] [SUCCESSFUL ]com.typesafe.play#play-java_2.11;2.5.0!play-java_2.11.jar (18457ms)

[info] downloadinghttps://repo1.maven.org/maven2/com/typesafe/play/play-netty-server_2.11/2.5.0/play-netty-server_2.11-2.5.0.jar...

[info] [SUCCESSFUL ]com.typesafe.play#play-netty-server_2.11;2.5.0!play-netty-server_2.11.jar(6129ms)

首先,安裝好了後, 先得建立一個最小示例, 檢驗下還有哪些問題。

activator new mytest play-java,

使用play-java模板 建立 mytest工程

下面這個命令,省略了 模板 play-java, 可以互動的輸入,如果也省略了專案名字,也可以互動輸入

activator new test

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Fetching the latest list oftemplates...

Could not fetch the updated list oftemplates. Using the local cache.

Check your proxy settings or increasethe timeout. For more details see:

http://lightbend.com/activator/docs

Browse the list of templates:http://lightbend.com/activator/templates

Choose from these featured templates orenter a template name:

1) minimal-akka-java-seed

2) minimal-akka-scala-seed

3) minimal-java

4) minimal-scala

5) play-java

6) play-scala

(hit tab to see a list of alltemplates)

> 5 <=(輸入5

OK, application "test" isbeing created using the "play-java" template.

(省略部分輸出)

To run "test" from thecommand line, "cd test" then:

/home/spark/activator-dist-1.3.10/test/activatorrun

To run the test for "test"from the command line, "cd test" then:

/home/spark/activator-dist-1.3.10/test/activatortest

To run the Activator UI for "test"from the command line, "cd test" then:

/home/spark/activator-dist-1.3.10/test/activatorui

[[email protected] activator-dist-1.3.10]#

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

進入互動輸入介面,或者控制檯,

可以輸入

compile 編譯專案

run 執行在一個web容器裡執行專案

test 單元測試

專案的名字,就是所在的資料夾, 這個資料夾的名字,以後可以修改,不會影響專案。

部分輸出

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

[mytest] $ compile

[info] Updating{file:/tmp/mytest/}root...

[info] Resolving jline#jline;2.12.1...

[info] Done updating.

[info] Compiling 6 Scala sources and 10Java sources to /tmp/mytest/target/scala-2.11/classes...

[info] 'compiler-interface' not yetcompiled for Scala 2.11.7. Compiling...

[info] Compilation completed in29.644 s

[success] Total time: 94 s, completedMay 12, 2016 6:23:53 PM

[mytest] $ run

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

[error] p.c.s.NettyServer - Failed tolisten for HTTP on /0.0.0.0:9000!

[error] (compile:run)play.runsupport.ServerStartException

[error] Total time: 7 s, completed May12, 2016 6:24:03 PM

[mytest] $

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


相關推薦

play framework 2.5.3 學習使用過程的“

play framework 2.5.3學習和使用過程中的“坑” 最近專案需要,接觸到了play, 使用過程中,遇到了一些坑, 記下來。 1. 版本 play分1.x和2.x 兩個系列,差異很大。 2.x系列 中的2.3+也有所不同,(目前官方的說法是 Ligh

5.2 5.3 學習內容總結

byw999一:對象數組:存儲對象的一個數組 Student[] student = new Student[5] ;int[] arr = {24,69,80,57,13} ; Arrays:針對數組操作的工具類 (提供了一些針對數組排序和二分搜索法)1>public static String

Play framework 2.5.x JAVA版本 教程零

這個部落格主題主要是介紹play framework 2.5.x版本的,JAVA版本,由於對Scala不是特別熟悉,後面可能會繼續學習。 大家看官方的文件可以看到,play framework是一個輕量級,響應式程式設計(reactive) 現代程式設計。 https://

Play framework 2.5.x JAVA版本 教程一 IntelliJ 除錯

本節主要講怎麼使用IntelliJ 來除錯程式碼。 預備工作: 1 下載IntelliJ 開發工具(確實好用,android studio 就是基於它開發的) 2 下載scala外掛 坑在這裡:   付費版本的Intellij才能下載play外掛,進行直接debug.  

.NET Framework 2.0/3.0/3.5 以 v90 平臺工具集為目標。請確保在計算機上安裝了 Visual Studio 2008

計算 3.5 今天 點擊 右鍵 解決 鼠標右鍵 得到 ima 今天在Visual Studio2010下面開發C++應用的時候發現“.NET Framework 2.0/3.0/3.5 以 v90 平臺工具集為目標。請確保在計算機上安裝了 Visual Studio 200

ACMNO.12有一分數序列: 2/1 3/2 5/3 8/5 13/8 21/13...... 求出這個數列的前N項之和,保留兩位小數。 輸入 N 輸出 數列前N項 樣例輸入 10

題目描述 有一分數序列: 2/1 3/2 5/3 8/5 13/8 21/13...... 求出這個數列的前N項之和,保留兩位小數。 輸入 N 輸出 數列前N項和 樣例輸入 10 樣例輸出 16.48 來源/分類 C語言 題目

c++求分數序列2/1,3/2,5/3,8/5,13/8,21/13....前20項的

求分數序列2/1,3/2,5/3,8/5,13/8,21/13…前20項的和 規律:從第二項開始,後一項的分母等於前一項的分子,後一項的分母等於前一項分母與分子之和 #include "stdafx.h" #include<iostream> using namespace

有一分數列2/1,3/2,5/3,8/5,13/8,21/13...求出這個數列的前20項的

l = [1,1] l1 = [] [l.append(l[x] + l[x + 1]) for x in range(20)] print(l) print(len(l)) [l1.append(l[y + 2]/l[y + 1]) for y in range(20)]

【C語言】求序列2/1+3/2+5/3+8/5+13/8+........前20項

我們能直接從序列上觀察出規律:(1)首先每一項的分母都與其前一項的分子相等, (2)每一項的分子都等於其前一項的分子與分母和。知道了規律,我們就好辦事兒!#include <stdio.h> int main () { double i = 2.0,j =

c語言:有一個分數序列: 2/1+3/2+5/3+8/5+13/8+… 求出這個數列前 20 項的

程式:#include <stdio.h>int main(){   double s=0,a=2,b=1;   int t,i,n=20;  //改變n的值即可求任意項的和   for (

Error opening zip file or JAR manifest missing : D:\play-1.2.5/framework/play-1.2.5.jar

play框架寫的專案,在eclipse中匯入,build-path中所有jar包都新增。執行程式,出現: Error occurred during initialization of VM  agent library failed to init: instrument

web.xml & web-fragment.xml (Servlet 2.3, 2.4, 2.5 + 3.0)模板

div location log javaee mls schema ins pub too 轉自:http://jlcon.iteye.com/blog/890964 web.xml v2.3 Xml代碼 <?xml version="1.0" en

給Java開發人員的Play Framework(2.4)介紹 Part1:Play的優缺點以及適用場景

dead 跟著 框架 sta web 錯誤 gist 解壓 環遊世界 1. 關於這篇系列這篇系列不是Play框架的Hello World,由於這樣的文章網上已經有非常多。這篇系列會首先結合實際代碼介紹Play的特點以及適用場景。然後會有幾篇文章介紹Play與Spring

題目: 2/1, 3/2, 5/3, 8/5, 13/8, 21 13 ...

core image src scanner find log out sum his java源碼: package studying; import java.util.Scanner; public class Sum_Of_FirstN {

py4CV例子2.5車牌識別svm算法重構

技術分享 情況 return gpo car san jpg 公開 exc 1、什easypr數據集; easyPR是一個開源的中文車牌識別系統,其目標是成為一個簡單、高效、準確的非限制場景(unconstrained situation)下的車牌識別庫。相比於其

2018/5/3單純純潔

文件上傳 實力 日常 表達 不同 多人 class 吹水 這也   過得很快的一天,深夜想要看的歐冠,雖然沒睡,但也不想看了。很奇怪,有想做的事情的時候,身體會不自然得要困要累。 但當你無所事事,確實十分的精神,然後時間從你的身邊溜走,有時會無奈地鄒鄒眉頭。在編程上,把一個

dubbo-admin-2.5.3.war 啟動不了

jdk1.8 JD 問題 AR dmi admin dubbo 寫法 啟動 前幾天把jdk1.8安裝了,卸載了jdk1.7,然後一直沒事,今天dubbo-admin-2.5.3.war 啟動不了,一直報錯,,現在錯誤沒了,後來在網上搜了挺久,發現了問題,是jdk1.8的問題

[VCB-Studio 科普教程 2.5] 基於 PotPlayer madVR 的播放器教程(已更新 XySubFilter)

高精度 out source 無法使用 需要 dev 耳機 避免 解碼 Potplayer 是高清影視常用的播放器,界面簡潔,功能齊全,比 MPC-HC 和 MPC-BE 更人性化;但其默認方案十分糟糕,預設過多錯誤,無法正確播放 10-bit 視頻,一直飽受詬病。VCB-

用正則表達式實現 運算 express = '1 -2* ((60-30 +(-40/5) *(9-2*5/3 +7 /3*99 /4*2998 +10 *568 /14))-(-4*3)/(16-3*2))'

repl bsp val 實現 strip expr 運算 lac spl #!/usr/bin/env python # coding:utf-8 import re def dealwith(express): express.replace(‘+-‘,‘