Tomcat无法加载Java Spark应用程序

时间:2019-02-08 23:09:49

标签: java tomcat spark-java

此问题与Apache Spark无关,但与名为Spark的Java Web框架有关。

enter image description here这是我们的旧应用程序,它使用Spark Java。当我尝试在Tomcat中进行部署时,抛出了找不到Sparkfilter的错误。我应该在哪里检查解决此问题?

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
   <filter>
   <filter-name>SparkFilter</filter-name>
   <filter-class>spark.servlet.SparkFilter</filter-class>
   <init-param>
     <param-name>applicationClass</param-name>
     <param-value>com.example.resource.Spark</param-value>
   </init-param>
 </filter>

 <filter-mapping>
   <filter-name>SparkFilter</filter-name>
   <url-pattern>/*</url-pattern>
 </filter-mapping>
    <listener>       
      <listener-class>
         com.example.utilities.PropertiesLoader
      </listener-class>
   </listener> 
</web-app>

catalina.out错误

java.lang.NullPointerException
    at com.example.resource.Spark.init(Spark.java:121)
    at spark.servlet.SparkFilter.init(SparkFilter.java:61)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4657)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5304)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1140)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1875)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

我看到pom.xml包含Spark框架。我还应该检查什么来解决这个问题?

0 个答案:

没有答案