0

ポートレット struts 2 ejb3 を開発しています。プロジェクト ejb を構成し、ポートレット プロジェクトでアクション クラスと struts.xml を構成しました。

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
 <package namespace="/view" extends="struts-portlet-default" name="view">
     <!-- If no class attribute is specified the framework will assume success and
        render the result index.jsp -->
        <!-- If no name value for the result node is specified the success value is the default -->
  <action name="index">
   <result>/html/view/index.jsp</result>
  </action>

  <action name="create" method="ajouterOUmodifier" class="com.esprit.action.AdressAction">
          <result name="success" type="redirect">index</result>
           <result name="input">/html/view/ajoutAdress.jsp</result>
    </action>

    </package>
</struts>

そしてjspファイル

    <%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
    <link href="<s:url value="/resources/main.css"/>" rel="stylesheet" type="text/css"/>
</head>
<body>
<s:form action="create" method="post">

 <s:textfield name="adress.nom" label="Firstname"/>
  <s:textfield name="adress.prenom" label="Lastname"/>
                <s:submit value="ok" />
        </s:form>
</body>
</html>

しかし、プロジェクトを実行するとエラーが表示されます:

エラー [jsp:154] java.lang.ClassNotFoundException: com.esprit.metier.AdressDao from BaseClassLoader@33b2c7a8{VFSClassLoaderPolicy@1e52011c{name=vfsfile:/D:/android/jboss-5.1.0.GA/server/default/ deploy/DepartmentWEB-portlet.war/ domain=ClassLoaderDomain@69ac5f83{name=vfsfile:/D:/android/jboss-5.1.0.GA/server/default/deploy/DepartmentWEB-portlet.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE 親=ClassLoaderDomain @ 5183a17c{DefaultDomain}} roots=[MemoryContextHandler@432465105[path= context=vfsmemory://5c4o13m-e9nqdk-h49ogxti-1-h49ohbp5-2a]

手伝って頂けますか ?

4

1 に答える 1

0

ClassNotFound 状態は、次の 2 つの問題が原因で発生する可能性があります。

  1. クラスローダーが文句を言っているクラスがクラスパスにありません
  2. クラスローダーが不平を言うクラスは、何らかの理由でロードできない別のクラスを参照しています(たとえば、クラスパスにないか、そうでないものを参照しています...)

だから:あなたのクラスパスをチェックしてください:com.esprit.metier.AdressDaoそこにありますか?そのスーパークラス (階層全体) とそれが実装するすべてのインターフェース? すべてのメンバーと参照されるクラス (メソッド シグネチャも参照)。

さらに、これが実際にポートレットの jsp である場合は、これらをページに追加するのはポータルの仕事であるため、これを<html>含む<head>べきではありません。<body>おそらく、css をテーマまたは<header-css>セクションの liferay-portlet.xml に含める必要があります (ただし、これはクラスが見つからない経験に影響を与えるべきではありません。これは一般的なポータルのアドバイスです)。

于 2012-07-05T18:16:37.927 に答える