We help IT Professionals succeed at work.

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

chsrinivas123
on
5,122 Views
Last Modified: 2013-12-10
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

Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004

Commented:
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.

Author

Commented:
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.
CERTIFIED EXPERT
Top Expert 2004

Commented:
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

Author

Commented:
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)
CERTIFIED EXPERT
Top Expert 2004

Commented:
Is there any other messages print out before or after this message?

Author

Commented:
sorry it doesn't give any other informational messages before and after.
CERTIFIED EXPERT
Top Expert 2004

Commented:
What about AdminDocumentAssemblyAction.java at line 1053?
Could you post this source?

Author

Commented:
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

CERTIFIED EXPERT
Top Expert 2004

Commented:
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

Author

Commented:
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.

Author

Commented:
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

Author

Commented:
Any more ideas Sompol to avoid this exception without having to put ithe JARS in server/LIB directory of weblogic
CERTIFIED EXPERT
Top Expert 2004

Commented:
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
CERTIFIED EXPERT
Top Expert 2004

Commented:
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

Author

Commented:
Sorry it was typo kept it in APP-INF/LIB only.

Author

Commented:
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.
CERTIFIED EXPERT
Top Expert 2004
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2004
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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.

Author

Commented:
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.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.