0

アプリケーションがデプロイされるたびに、初めて ServletContextListener を使用して特定の関数を実行しようとしました。なので

SEVERE: Error listenerStart in netbeans ..

Apache tomcat server logs in netbeans..

2013 年 11 月 15 日 11:59:03 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: クラス app.classes.ContextListenerProcess java.lang.IllegalAccessException のアプリケーション リスナーの構成エラー: クラス org.apache.catalina.core.DefaultInstanceManager はできます修飾子 "" を持つクラス app.classes.ContextListenerProcess のメンバーにアクセスしない

これは、ServletContextListener を実装する私の Java クラス ファイルです。

package app.classes;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;


@WebListener()
class ContextListenerProcess implements ServletContextListener {

@Override
public void contextDestroyed(ServletContextEvent sce) {
}

@Override
public void contextInitialized(ServletContextEvent sce) {
    // Do your startup work here
    System.out.println("Processing Started .....");
}
}

ここに私の web.xml が ContextListenerProcess クラスを追加しています...

 <listener>
<listener-class>app.classes.ContextListenerProcess</listener-class>
 </listener>

問題を解決するために私を助けてください..事前に感謝..

4

3 に答える 3

1

クラスContextListenerProcessは、パッケージ プライベートではなくパブリックである必要があります。

于 2013-11-15T09:10:29.803 に答える