javadocumentum6.5dfc

HTTP Status 500 - Error instantiating servlet class com.Model


I created a Dynamic Web Project. I have Tomcat 6.0 installed to run it. I'm trying to create web interface using DFC and it will connect to docbases and run some query.. When I'm trying to run this code, I'm getting the below mentioned error. Since I'm very new to DFC programming any kind of help is appreciated. Thanks.

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 (Servlet)

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 log

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

Jars List


Solution

  • My application is running fine now. I had to put dfc.jar and dctm.jar in the lib folder of tomcat.