2016-09-25 15 views
2

ダイナミックWebプロジェクトを作成しました。私はそれを実行するためにTomcat 6.0をインストールしました。私はDFCを使用してWebインターフェイスを作成しようとしているし、それはdocbasesに接続し、いくつかのクエリを実行します..私はこのコードを実行しようとしているとき、私は以下のエラーを取得しています。私はDFCのプログラミングに非常に慣れているので、どんな種類のヘルプも高く評価されています。ありがとう。HTTPステータス500 - サーブレットクラスcom.Modelのインスタンス化エラー。

のwelcome.jsp

<div class="w3ls_order w3ls_order1"> 
        <Form method="post" action="Model"> 
        <a class="popup-with-zoom-anim"><button class="button" type="submit">Generate</button></a> 
        </Form> 

Model.java(サーブレット)

package com; 

import java.io.IOException; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 

import org.xml.sax.SAXException; 

import com.documentum.fc.common.DfException; 

/** 
* Servlet implementation class Model 
*/ 
public class Model extends HttpServlet { 
    private static final long serialVersionUID = 1L; 

    /** 
    * Default constructor. 
    */ 
    public Model() { 
     // TODO Auto-generated constructor stub 
    } 

    /** 
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 
    */ 
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
     // TODO Auto-generated method stub 


    } 


    /** 
    * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 
    */ 


    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 

     System.out.println("All Good!"); 
    } 

    public void docbase() throws SAXException, IOException 
    { 
     System.out.println("All good"); 
     Connection con = new Connection(); 

     try { 
      con.docBasecon(); 
     } catch (DfException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
    } 

} 

Connection.java

package com; 

import java.io.File; 
import java.io.IOException; 

import javax.xml.parsers.DocumentBuilder; 
import javax.xml.parsers.DocumentBuilderFactory; 
import javax.xml.parsers.ParserConfigurationException; 

import org.w3c.dom.Document; 
import org.w3c.dom.NodeList; 
import org.w3c.dom.Node; 
import org.w3c.dom.Element; 
import org.xml.sax.SAXException; 

import com.documentum.fc.common.DfException; 

public class Connection { 



    public static void docBasecon() throws SAXException, IOException, DfException 
    { 
     File fXmlFile = new File("C:/Users/SAHAROM/workspace/License Utility/config.xml"); 
     DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); 
     try { 
      DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); 
      Document doc = dBuilder.parse(fXmlFile); 

      doc.getDocumentElement().normalize(); 
      System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); 

      NodeList nList = doc.getElementsByTagName("docbase"); 

      DocbaseConnection dbcon = new DocbaseConnection(); 

      for (int temp = 0; temp < nList.getLength(); temp++) 
      { 
       Node nNode = nList.item(temp); 
       //System.out.println("\nCurrent Element :" + nNode.getNodeName()); 

       if (nNode.getNodeType() == Node.ELEMENT_NODE) 
       { 

        Element eElement = (Element) nNode; 

        String docbaseName = eElement.getElementsByTagName("name").item(0).getTextContent(); 
        String docbaseUname = eElement.getElementsByTagName("username").item(0).getTextContent(); 
        String docbasePass = eElement.getElementsByTagName("password").item(0).getTextContent(); 

        dbcon.DfcCon(docbaseName,docbaseUname,docbasePass); 
       } 




      } 



     } catch (ParserConfigurationException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 

    } 


} 

DocbaseConnection.java

package com; 

import com.documentum.fc.client.DfClient; 
import com.documentum.fc.client.IDfClient; 
import com.documentum.fc.client.IDfQuery; 
import com.documentum.fc.client.IDfSession; 
import com.documentum.fc.client.IDfSessionManager; 
import com.documentum.fc.client.IDfSysObject; 
import com.documentum.fc.common.DfException; 
import com.documentum.fc.common.DfLoginInfo; 
import com.documentum.fc.common.IDfLoginInfo; 
import com.documentum.xml.xdql.DfXmlQuery; 
import com.documentum.xml.xdql.IDfXmlQuery; 


public class DocbaseConnection { 


IDfSessionManager sessionMrg = null; 
IDfSession session = null; 

    public void DfcCon(String docbaseName, String username, 
      String password) throws DfException { 


     System.out.println("\nResult" +docbaseName +username +password); 



      String Docbase = docbaseName; 



      IDfLoginInfo loginInfo = new DfLoginInfo(); 
      loginInfo.setUser(username); 
      loginInfo.setPassword(password); 
      System.out.println("all good"); 
      sessionMrg = DfClient.getLocalClient().newSessionManager(); 
      System.out.println("all gooD"); 
      sessionMrg.setIdentity(Docbase, loginInfo); 
      System.out.println("all gooD"); 
      session = sessionMrg.getSession(Docbase); 
      System.out.println("All good"); 

      String query = Getquery(); 

      System.out.println("Query :" +query); 


      if(sessionMrg != null && session != null) { 
       sessionMrg.release(session); 
      } 









    } 


     public String Getquery() 
     { 

      String query = "select count(*) from dm_user"; 
      return query; 

     } 




} 

Tomcatの

INFO: Marking servlet Model as unavailable 
Sep 25, 2016 12:13:02 AM org.apache.catalina.core.StandardWrapperValve invoke 
SEVERE: Allocate exception for servlet Model 
java.lang.ClassNotFoundException: com.documentum.fc.common.DfException 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) 
    at java.lang.Class.getDeclaredConstructors0(Native Method) 
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) 
    at java.lang.Class.getConstructor0(Unknown Source) 
    at java.lang.Class.newInstance0(Unknown Source) 
    at java.lang.Class.newInstance(Unknown Source) 
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149) 
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:612) 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503) 
    at java.lang.Thread.run(Unknown Source) 

ジャーConnection.javaで

Jars List

+0

'DfException'の' java.lang.ClassNotFoundException'と言っていますが、戦争中にjarファイルをインクルードしましたか? –

+0

はい、明らかに/ documentum/sharedフォルダの下にあるすべてのjarを追加しました。 – Zeus07

答えて

0

私のアプリケーションは正常に動作しています。私はdfc.jarとdctm.jarをtomcatのlibフォルダに入れなければなりませんでした。

1

次のメソッドを持ってログインします。

public static void docBasecon() throws SAXException, IOException, DfException 

をDfExceptionは、したがって、エラーがインポートされていません。したがって、Connection.javaに次のimport文を追加してください。

import com.documentum.fc.common.DfException; 
+0

完了しましたが、まだ動作していません。 2016年9月25日午前3時09分50秒AM org.apache.catalina.core.StandardWrapperValve呼び出す SEVERE:サーブレットモデル にjava.lang.ClassNotFoundExceptionの例外を割り当てます。com.documentum.fc.common.DfException とConnection.java内 import com.documentum.fc.common.DfException; それは既にあります – Zeus07

+0

ですので、ランタイムの依存関係は間違いなくあります。 WARファイルの内容を表示することができます:jar tvf war-file-name.war –

+0

正確に何を求めているのかわかりません。もっと詳しく教えてください。 – Zeus07

関連する問題