Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    DMI-RPC iText NoClassDefFoundError

    I am running SmartClient Version: SmartClient_v82p_2012-04-11 (v8.2p_2012-04-11/EVAL Deployment 2012-04-11) on Mozilla Firefox 3.6.18 with Firebug using Windows XP Pro 32 bit.

    I have had great success building my prototype app with a robust client-side application. I have brought it to the point where I need to interact with the server-side reporting using iText.

    I can get the MeetingAgenda10 Java class to start using a button with the following code:
    Code:
    	DMI.call({
    		appID: "PlanetProject", 
    		className: "com.planetproject.server.reports.MeetingAgenda10", 
    		methodName: "main", 
    		requestParams: { downloadResult: true, downloadToNewWindow:true } 
    	});
    that references the following PlanetProject.app.xml:
    Code:
    <Application>
        <rpcBindings>
    	<ServerObject ID="MeetingAgenda01" className="com.planetproject.server.reports.MeetingAgenda01">
    	    <visibleMethods>
    	        <method name="main"/>
    	    </visibleMethods>
    	</ServerObject>
    	<ServerObject ID="MeetingAgenda10" className="com.planetproject.server.reports.MeetingAgenda10">
    		    <visibleMethods>
    		        <method name="main"/>
    		    </visibleMethods>
    	</ServerObject>
        </rpcBindings>
    </Application>
    Before it gets going the result is a NoClassDefFoundError looking for one of the iText classes.

    The console log is attached. My research indicates this 'missing' class is most likely a class name collision. This is a puzzle because the class appears to be fully qualified in the console log. (Coincidentally, I have found many duplicate 'Phrase' and 'Element' classes in other jar files in WEB-INF/lib.)

    The java code is attached as well. It is ugly, but it works in Eclipse and generates a PDF file. I tried to create an executable jar file with all the resources in a single package, but did not see a way to invoke the same public class main method.

    I will try moving the libraries I reference to different WEB-INF/lib locations. Oddly enough, there are four of them under SmartClient:
    Code:
    SmartClient\WEB-INF
    SmartClient\WEB-INF\embeddedTomcat\webapps\manager\WEB-INF
    SmartClient\WEB-INF\embeddedTomcat\webapps\ROOT\WEB-INF
    SmartClient\tools\visualBuilder\workspace\webapps\server\WEB-INF
    A bit of assistance might go a long way here to help me solve this problem. I tried fully qualifying my references in the java file, but that did not help. I think I am just missing something simple that an experience java coder would know offhand.

    I know the java program is not set up to receive arguments yet. And, the DMI call does not deliver them yet. But, if I can get past this class name problem I know how to inch forward.

    Thanks,

    Rick
    Attached Files

    #2
    I finally found the problem. After chasing around CLASSPATH problems and solutions, I noticed the use of the -cp option on the command used to start java programs. So, I looked inside the 'embeddedTomcat.bat' file. It uses the -cp option to OVERRIDE all other classpath sources. I would have been fine if the option included WEB-INF\lib. But, it did not. It did include WEB-INF\classes. But, all the other entries were all specific JAR files.

    The solution was simply to add my 'missing' jar filenames to the list.

    DOH!

    I hope this information helps save someone a lot of time searching. I certainly wish I had started my search at this end of the classpath chain.

    So, now I can run my java servlets locally as well as on a remote server.

    Rick

    Comment

    Working...
    X