2013-02-24 7 views
2

스프레이 캔에서 sbt-revolver가 설정되어 실행되고 있지만 변경 사항이 표시되지 않습니다. 서비스에 요청하십시오.Scala - Spray.io - sbt-revolver - jrebel - 다시로드 할 때 HttpService (또는 기타)에 변경 사항이 표시되지 않음

당신은 그것의 일을하고 jrebel 로그에 볼 수 있습니다

[success] Total time: 1 s, completed Feb 24, 2013 3:13:18 AM 
app: [INFO] [02/24/2013 03:13:19.497] [com-example-Boot-spray.io.io-bridge-dispatcher-7] [akka://com-example-Boot/user/io-bridge] akka://com-example-Boot/user/io-bridge started 
app: [INFO] [02/24/2013 03:13:19.851] [com-example-Boot-akka.actor.default-dispatcher-2] [akka://com-example-Boot/user/http-server] akka://com-example-Boot/user/http-server started on localhost/127.0.0.1:9000 
>     ~products 
[success] Total time: 0 s, completed Feb 24, 2013 3:13:23 AM 
1. Waiting for source changes... (press enter to interrupt) 
[info] Compiling 1 Scala source to /Users/tripled153/Development/src/Foundationv2/spray-template/target/scala-2.10/classes... 
[success] Total time: 2 s, completed Feb 24, 2013 3:13:33 AM 
2. Waiting for source changes... (press enter to interrupt) 

하지만 내 특성에 메시지를 변경하면 새로 고침에 표시되지 않습니다.

package com.example 

import akka.actor.Actor 
import spray.routing._ 
import spray.http._ 
import MediaTypes._ 


// we don't implement our route structure directly in the service actor because 
// we want to be able to test it independently, without having to spin up an actor 
class MyServiceActor extends Actor with MyService { 

    // the HttpService trait defines only one abstract member, which 
    // connects the services environment to the enclosing actor or test 
    def actorRefFactory = context 

    // this actor only runs our route, but you could add 
    // other things here, like request stream processing 
    // or timeout handling 
    def receive = runRoute(myRoute) 
} 


// this trait defines our service behavior independently from the service actor 
trait MyService extends HttpService { 

    val myRoute = 
    path("") { 
     get { 
     respondWithMediaType(`text/html`) { // XML is marshalled to `text/xml` by default, so we simply override here 
      complete { 
      <html> 
       <body> 
       <h1>Say hello to <i>spray-routing</i> on <i>spray-can</i>!</h1> 
       </body> 
      </html> 
      } 
     } 
     } 
    } 

} 

이것은 리볼버가 설치된 예를 기반으로 제작되었습니다. https://github.com/spray/spray-template

+0

설정이 잘못되었다는 것은 어렵습니다. github에서 예제 프로젝트를 만들 수 있습니다. – 4e6

+1

프로젝트는 여기에 스프레이 템플릿 프로젝트입니다 : https://github.com/spray/spray-template/ – JasonG

+1

그것은 저에게 효과적입니다. 재미있는 ... 어쩌면 jrebel 라이센스 활성화 문제 일 수 있습니다. jrebel의 출력을're-start'에서 볼 수 있습니까? 예를 들어, myJRebel 서버에 접속 중입니다. 버전, 라이센스 등에 대한 정보가 있습니까? – 4e6

답변

2

문제는 서비스가 시작될 때 경로가 한 번만 빌드되는 것입니다. 모든 요청에 ​​대해 dynamic 지시문을 사용하여 전체 경로를 다시 작성하여 다시 작성하십시오.

편집 : 주제에 대한이 mailing list thread을 참조하십시오.

+0

글타래에 추가 할 수있는 훌륭한 조언. 나는 이것이 언젠가 누군가를 도울 것이라고 확신한다. – JasonG

+0

나는 이것을 시도했지만 도움이되지 않았다. 그래도 고마워. – JasonG

1

jrebel.jar절대 경로 사본으로 JREBEL_PATH을 설정했는지 확인하십시오.

0

재시작 명령을 사용하고 JRebel이 변경 사항을 포착하지 않았습니다.

열기 다른 터미널 세션 (이것은 시작이 아니라 다시 시작 명령이다)와 ~ 컴파일 명령을 SBT 중 하나 개를 실행 터미널 세션에서

시작 SBT과 start 명령을 실행 : 그럼 이런 짓을.

그리고 SBT를 start와 ~ compile 명령으로 두 개의 별도 창에서 실행하면 트릭이 수행됩니다.

분명히 JRebel은 유효한 라이센스가 있어야합니다.

소스 코드가 변경되었을 때 JRebel이 절대적으로 모든 것을 다시로드하지 않는다는 것을 기억하십시오. 캐시 된 경로 또는 데이터와 같은 캐시 된 값에 특히주의하십시오. 이 경우 캐시 재로드를 강요하기 위해 간단한 트릭을 작성하거나, 시간 기반이거나 파일 잠금 또는 JRebel이 새로 고치는 재로드 가능한 클래스의 간단한 특성을 조달 할 수 있습니다.