Hi,
I am new to php. I have copied one php application from one linux server to other linux server
after copy application is working fine but the applet to view image in that application is showing two error messages.

error is :

java.lang.NullPointerException
    at com.primeleaf.viewer.manager.DocumentManager.setDocument(DocumentManager.java:123)
    at com.primeleaf.viewer.manager.CommunicationManager.init(CommunicationManager.java:76)
    at com.primeleaf.viewer.DocumentViewer.init(DocumentViewer.java:67)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)



and   



com.sun.java.swing.plaf.windows.WindowsLookAndFeel
[Fatal Error] :1:1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at com.primeleaf.viewer.io.ReaderThread.getContentBytes(ReaderThread.java:139)
    at com.primeleaf.viewer.manager.CommunicationManager.init(CommunicationManager.java:74)
    at com.primeleaf.viewer.DocumentViewer.init(DocumentViewer.java:67)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
java.awt.Dimension[width=217,height=106]

Code to run that Applet on client machine is

<BODY>

<input type="hidden" id="HSPath" name="HSPath" value=" <?php echo rtrim($_SERVER['HTTP_HOST']);?>">
<script type="text/javascript">
var nhpath;
nhpath= document.getElementById('HSPath').value;
var hpath = nhpath.replace(/^\s+|\s+$/g, '') ;
document.write('<OBJECT classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase = "http://java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0"   WIDTH = "100%" HEIGHT = "385"  border="0">');

document.write('<PARAM NAME = "CODE"  VALUE = "com.primeleaf.viewer.DocumentViewer.class" >');
document.write('<PARAM NAME = "ARCHIVE"  VALUE = "PrimeleafViewer.jar" >');
document.write('<PARAM NAME = "type"  VALUE = "application/x-java-applet;version=1.4">');
document.write('<PARAM NAME = "scriptable" VALUE = "true">');
document.write('<PARAM NAME = "SESSION_ID" VALUE="MYDAT">');
document.write('<PARAM NAME = "DOCUMENT_ID" VALUE="20070928">');
document.write('<PARAM NAME = "START_PAGE" VALUE="-1">');

document.write('<PARAM NAME = "END_PAGE" VALUE="-1">');

document.write('<PARAM NAME = "INITIAL_PAGE" VALUE="0">');

document.write('<PARAM NAME = "CONTENT_TYPE" VALUE="1">');

document.write('<PARAM NAME = "CONTENT_URL" VALUE="http://'+hpath+'/dms/user/Gravity/GraViewImg.php">');

document.write('<PARAM NAME=  "cache_version" VALUE="1.0.1.17">');

document.write('<PARAM NAME = "image" VALUE="/images/appletlogo.gif">');

document.write('<PARAM NAME = "boxbgcolor" VALUE="#ffffff">');

document.write('<COMMENT>');

document.write('<EMBED type = "application/x-java-applet;version=1.4" CODE = "com.primeleaf.viewer.DocumentViewer.class" ARCHIVE = "PrimeleafViewer.jar"   WIDTH = "100%"    HEIGHT = "385"  scriptable = "true"     CONTENT_URL="http://'+hpath+'/dms/user/Gravity/GraViewImg.php"  pluginspage = "http://java.sun.com/products/plugin/index.html#download" cache_version="1.0.1.17">');

document.write('<NOEMBED></NOEMBED>');

document.write('</EMBED>');

document.write('</COMMENT>');

document.write('</OBJECT>');
</script>
<!--</td>
</tr>
</table>
-->
</BODY>

Can any body provide me any solution, how i can make this image viewer applet to work.

Thanks in advance.

What happens inside GraViewImg.php? And do you get correct access to this url?

http://'+hpath+'/dms/user/Gravity/GraViewImg.php

From the errors it seems the applet is receiving NULL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.