2016-09-25 20 views
2

동적 웹 프로젝트를 만들었습니다. 나는 그것을 실행하기 위해 Tomcat 6.0을 설치했다. 난 DFC를 사용하여 웹 인터페이스를 만들려고 해요 그리고 그것은 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) 

항아리를 기록

Jars List

+0

'DfException'에 대해'java.lang.ClassNotFoundException'이라고 말하면 전쟁에서 병을 포함 시켰습니까? –

+0

예, 분명히/documentum/shared 폴더 아래에있는 모든 병을 추가했습니다. – Zeus07

답변

0

내 애플리케이션이 정상적으로 실행 중입니다. 나는 dfc.jar와 dctm.jar를 tomcat의 lib 폴더에 넣어야했습니다.

1

Connection.java에서 다음과 같은 방법이 있습니다

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

DfException이 때문에 오류를 수입되지 않았습니다. 따라서 Connection.java에 다음 import 문을 추가하십시오.

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

완료되었지만 여전히 작동하지 않습니다. 2016년 9월 25일 오전 3시 9분 50초 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