(在Google Appengine上运行Spark的解决方案)

时间:2019-03-22 17:50:31

标签: java google-app-engine java-ee spark-java

<html>
<p>
    dependencies {
        compile 'com.google.appengine:appengine:+'
        compile 'com.sparkjava:spark-core:2.5.5'
        compile 'com.google.cloud:google-cloud-datastore:0.13.0-beta'
    }

//and create web.xml configuration based on SparkJava documentation:

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
    <filter>
        <filter-name>SparkFilter</filter-name>
        <filter-class>spark.servlet.SparkFilter</filter-class>
        <init-param>
            <param-name>applicationClass</param-name>
            <param-value>com.yourcompanyname.your_spark_class</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>SparkFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

//(remember the parm-name should be appplicationClass)

//now Create a spark servlet or resource class and implement  

// SparkApplication,并覆盖init方法并编写所有    //在init()方法内部进行资源映射,然后id工作     

    

0 个答案:

没有答案