Link to home
Start Free TrialLog in
Avatar of chsrinivas123
chsrinivas123

asked on

java.lang.InternalError: erroneous handlers when using itext.jar,poi.jar for converting MS word to PDF in weblogic8.1

I am getting "java.lang.InternalError: erroneous handlers" in weblogic console when i am converting MS word document to PDF using Itext.jar, POI.jar JAR files in weblogic8.1 server in our J2EE application.I am able to convert the PDF without any errors if i put the two jar files in SERVER / LIB of weblogic.But in our PRODUCTION environment we don't have access to change WEBLOGIC environment..So we need to do it somehow at APPLICATION Level.I am trying to put the JARS in class path in our project.properties file but no success.Please help me out.
Thanks
package com.uprr.app.cam.common.helpers;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
 
import org.apache.poi.hwpf.extractor.WordExtractor;
 
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
 
public class WordReader
{
public static String getPdfDocument(String path)
{
	String pdfPath="G:/cam/bin/casdocs/";
	String pdfDocPath=null;
	try
	{
		InputStream is = new BufferedInputStream(new FileInputStream(path));
		WordExtractor wd = new WordExtractor(is);
		String text = wd.getText();
		System.out.println(text);
		Document document = new Document(); 
		PdfWriter.getInstance(document, new FileOutputStream(pdfPath+"viewDoc.pdf"));
		document.open();
		document.add(new Paragraph(text));
		document.close();
		pdfDocPath=pdfPath+"viewDoc.pdf";
		System.out.println("Pdf Doc Path"+pdfDocPath);
	}catch(FileNotFoundException e1)
	{
		System.out.println("File does not exist."); 
	}
	catch(IOException e2)
	{
		System.out.println("IO Exception");
	}catch (DocumentException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return pdfDocPath;
}
 
}

Open in new window

Avatar of sompol_kiatkamolchai
sompol_kiatkamolchai
Flag of Thailand image

Hi,

After you get EAR or WAR file, please you check APP-INF/lib or WEB-INF/lib whether those two jar files is presented.

Sompol.
Avatar of chsrinivas123
chsrinivas123

ASKER

Hi Sompol,
  I have tried putting the two jar files in APP_INF/lib and WEB_INF/lib but still i am getting the same "java.lang.InternalError: erroneous handlers" in my console.
Hi,

The error message you're showing is very short.
Please you give me more error or exception stack trace message.
It's possible that you need to enable logging level in admin console to "info" level which the weblogic console will print more detail.

If you're not familiar with console, here is the place of setting.
your domain (left menu) --> your server (left menu)  --> logging (right pane) --> .... somewhere you can find it there ....

Sompol
C:/work/wordpdf/wordtopdf/test1.doc
Hi,
 I changed the logging level to INFO but didn't have any change in the console after restarting my server.I am sending below the stack trace.

<Dec 18, 2007 7:36:40 AM PST> <Error> <HTTP> <BEA-101017> <[ServletContext(id=2169370,name=cam_admin,context-path=/cam_admin)] Root cause of ServletException.
java.lang.InternalError: erroneous handlers
        at com.uprr.app.cam.webapp.admin.action.AdminDocumentAssemblyAction.doProcesUpdateDocumentSectionContent(AdminDocumentAssemblyAction.java:1053)
        at com.uprr.app.cam.webapp.admin.action.AdminDocumentAssemblyAction.doProcess(AdminDocumentAssemblyAction.java:125)
Is there any other messages print out before or after this message?
sorry it doesn't give any other informational messages before and after.
What about AdminDocumentAssemblyAction.java at line 1053?
Could you post this source?
1053 line corresponds to the call to
String pdfpath = WordReader.getPdfDocument(path);
I attached the code snippet for the method.
private void doProcesUpdateDocumentSectionContent(HttpServletRequest request, AdminGlobalForm form){
		if(request == null) {
			return;
		}
    	try{
    		DocumentSectionInfo documentInfo = new DocumentSectionInfo();
    		DocumentAssemblyMgrDelegate docDelegate = new DocumentAssemblyMgrDelegate();    		
    		DocumentSectionInfo docSctnInfo = this.getDocumentSctn(request);
    		String userid = this.getLoginUserId(request);    		
    		docSctnInfo.setLastChgUserID(userid);
    		String path = "C:/work/wordpdf/wordtopdf/test1.doc";
    		if(ActionConstants.VIEW_DOCUMENT_SECTION_CONTENT.equals(form.getCommand())){
    			
        		if(path !=null){
        			System.out.println(path);
        			String pdfpath = WordReader.getPdfDocument(path);
        			if(pdfpath!=null ){
        				request.setAttribute(FormConstants.PDF_LOCATION,pdfpath);
            			form.setForwardKey(ActionConstants.VIEW_DOCUMENT_SECTION_CONTENT);	
        			}        			
        		}
    		}else{    		
    		if(path !=null){
    			System.out.println(path);
    			request.setAttribute(FormConstants.PHYSICAL_LOCATION,path);
    			form.setForwardKey(ActionConstants.EDIT_DOCUMENT_SECTION_CONTENT);
    		}/*else if(documentSectionInfo.getValidUser()!=null)
    		{		
    				this.addInfo(request,new MessageInfo(documentSectionInfo.getValidUser()));    			
    				request.setAttribute(FormConstants.VALID_USER,documentSectionInfo.getValidUser());
    	    		form.setForwardKey(ActionConstants.EDIT_DOCUMENT_SECTION_CONTENT);	
    		}/*else
    			{
    				this.addInfo(request,new MessageInfo("Document doesnot exist"));    				
    	    		form.setForwardKey(ActionConstants.EDIT_DOCUMENT_SECTION_CONTENT);	
    			}*/    		
    	}
    	}catch(Exception e) {
    		form.setForwardKey(ActionConstants.GLOBAL_ERROR); 		
        }
    }

Open in new window

Are you using Unix platform in produciton? If so, I think it didn't work because of fixed path in the source code here.

Maybe String pdfPath="G:/cam/bin/casdocs/"; or
String path = "C:/work/wordpdf/wordtopdf/test1.doc";

Please check.

Hope this help,
Sompol
I am doing it on my local weblogic server.I won't be sending it to production environment until i am able to do it on local environment.I tried changing the pdfpath from G: which is a network drive to C: which is local to my machine but with no effect.
i think its all with JAR files only because i am able to achive the MS Word to PDF conversion if i put both the jar files in my local weblogic server/LIB directory
Any more ideas Sompol to avoid this exception without having to put ithe JARS in server/LIB directory of weblogic
How much access to production environment?
Can you change parameter like classpath in "Remote Start" menu?
If you can do so, you can do an adhoc solution by adding your jar there.

Hope this help,

I'm thinking about the root cause of problem but you can try above solution.

Sompol
Hi,
I saw your comment "I have tried putting the two jar files in APP_INF/lib and WEB_INF/lib but still i am getting the same "java.lang.InternalError: erroneous handlers" in my console."

Is it APP_INF or APP-INF? It should be APP-INF.

Just a guess.
Sompol
Sorry it was typo kept it in APP-INF/LIB only.
And we don't have any access to production environment as some other applications will also be deployed along with our application on the same server.
ASKER CERTIFIED SOLUTION
Avatar of sompol_kiatkamolchai
sompol_kiatkamolchai
Flag of Thailand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Finally found the solution for this.I added the jar paths in MANIFEST.MF file for that module which contains the Wordreader java class and it worked on Production environment too.
Thanks Sompol.I found that adding the jar paths in the MANIFEST.MF file will work even for production environment.Then i don't need to put those jar files in server/lib of weblogic.Crediting the points for your help.