mvn jetty:运行部署但是服务不可用503

时间:2016-02-11 13:33:21

标签: maven jetty embedded-jetty

我目前在我的项目中添加了jetty maven插件,但是在运行之后,它似乎运行但是获得了503.我的Web应用程序似乎正常运行,就像所有spring web ap

public class MusicService extends Service {


private MediaPlayer mPlayer;
private MusicBroadcastReceiver mBroadcastReceiver;

@Override
public void onTaskRemoved(Intent rootIntent) {
    Log.d("MusicService", "onTaskRemoved");
}

private void pause() {
    if (mPlayer != null) {
        mPlayer.pause();
    }
}

private void previous() {
    if (mPlayer != null) {
        mPlayer.release();
    }
    mPlayer = MediaPlayer.create(MusicService.this, R.raw.loststars);
    mPlayer.start();
}

private void next() {
    if (mPlayer != null) {
        mPlayer.release();
    }
    mPlayer = MediaPlayer.create(MusicService.this, R.raw.nanshannan);
    mPlayer.start();
}

private void start() {
    if (mPlayer != null) {
        mPlayer.start();
    }
}

@Override
public void onCreate() {
    super.onCreate();

    mBroadcastReceiver = new MusicBroadcastReceiver();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("com.geekband.mo.musicplayer");
    registerReceiver(mBroadcastReceiver, intentFilter);
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    mPlayer = MediaPlayer.create(MusicService.this, R.raw.loststars);

    NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    Notification noti = new Notification.Builder(MusicService.this)
            .setContentTitle("play")
            .setContentText("playing")
            .setSmallIcon(R.mipmap.ic_launcher)
            .build();
    // manager.notify(0, noti);
    // startForeground(0, noti);
    startForeground(1, noti);
    return super.onStartCommand(intent, flags, startId);
}

@Override
public void onDestroy() {
    if (mPlayer != null) {
        mPlayer.release();
    }
    super.onDestroy();
}

@Nullable
@Override
public IBinder onBind(Intent intent) {
    return null;
}

public class MusicBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        int action = intent.getIntExtra("action",0);
        switch (action) {
            case 0:
                start();
                break;

            case 1:
                pause();
                break;

            case 2:
                next();
                break;

            case 3:
                previous();
                break;

        }
    }
}
}

我的配置

Feb 11, 2016 1:50:51 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod
INFO: Mapped "{[/api/city/v1/update],
Feb 11, 2016 1:22:55 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 29097 ms
2016-02-11 13:22:55.016:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.m.p.JettyWebAppContext@18f56b9{/myapp,file:///home/osboxes/develop/projects/java/myapp/src/main/webapp/,STARTING}{file:///home/osboxes/develop/projects/java/myapp/src/main/webapp/}
2016-02-11 13:50:38.313:INFO:/smartinsure:main: Spring WebApplicationInitializers detected on classpath: [com.interswitchng.techquest.smartinsure.rest.config.WebXml@1ebb1b6]
2016-02-11 13:50:38.781:WARN:/smartinsure:main: unavailable

当jetty开始部署时,这是日志

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.3.0.M2</version>
    <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds> 
        <webApp>
            <contextPath>/app</contextPath>
        </webApp>
        <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <port>8081</port>
                <maxIdleTime>60000</maxIdleTime>
            </connector>
        </connectors>z
    </configuration>
</plugin>

任何帮助?

0 个答案:

没有答案