Play 2.5.4中的Java cors问题

时间:2016-08-15 21:12:37

标签: java playframework cors

我在调查我的API时遇到了问题。为了重新解决我试图添加一个CorsFilter但是当我做激活器dist并部署到生产时我得到了

Exception in thread "main" java.lang.NoClassDefFoundError: play/filters/cors/CORSFilter
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getDeclaredConstructors(Class.java:2020)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:890)
    at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46)
    at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:134)
    at com.google.inject.internal.InternalInjectorCreator.build

我有" com.typesafe.play" %" filters-helpers_2.11" %" 2.5.4"在我的build.sbt

这是过滤器代码

import play.filters.cors.CORSFilter;
import play.http.DefaultHttpFilters;
import javax.inject.Inject;

public class Filters extends DefaultHttpFilters {
    @Inject public Filters(CORSFilter corsFilter) {
        super(corsFilter);
    }
}

0 个答案:

没有答案