[opencms-dev] Re: Failed in installing OpenCms6.2.0 on WebSphere 5.1. Please give me a hand.

Georg Raffer georg.nc at gmail.com
Thu May 11 10:55:55 CEST 2006


Hello Zhibin,

I also had this problem; check class:
org.opencms.util.CmsFileUtil

in line 563 (?) add the following lines:

if(numRead==-1){
break;
}

It seems that in IBM Java the method available():
int available = in.available();

returns a wrong value. It should return -1 if stream is finished. Try to
add the following lines:

if(numRead==-1){
break;
}


The method then should look like this:

public static byte[] readFully(InputStream in) throws IOException {

if (in instanceof ByteArrayInputStream) {
// content can be read in one pass
return readFully(in, in.available());
}

ByteArrayOutputStream out = new ByteArrayOutputStream(2048);
if (in.available() > 0) {
// read the file content in available chunks
int offset = 0;
int numRead = 0;
do {
int available = in.available();
if (available > 0) {
byte[] bytes = new byte[available];
numRead = in.read(bytes, offset, bytes.length);
* if(numRead==-1){
break;
}
* out.write(bytes, offset, numRead);
offset += numRead;
} else {
numRead = in.read();
if (numRead != -1) {
out.write(numRead);
offset++;
}
}
} while (numRead != -1);
} else {
// read the file content byte-to-byte
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
}
in.close();
out.close();
return out.toByteArray();
}


Hope that helps! We are currently using Websphere 6.01 it seems to work
well.

Greetings from Austria,

Georg


Huang Zhibin wrote:
> Hi, Georg
> These days I installed OpenCms6.2.0 on WebSphere 5.1 and met with some
> problem.
> I search it in maillist and found some info from you. I did it
> according to your suggestions, setting compress="false" in the
> build.xml, but not working
> <jar
> jarfile="${opencms.output.jars}/opencms.jar"
> basedir="${opencms.output.classes}"
> includes="org/opencms/**"
> compress="false" >
> <metainf dir="${opencms.input.warfiles}/WEB-INF" includes="opencms.tld"/>
> </jar>
>
> I compile jar with the command: ant jar
>
> my environment is MySQL + WAS5.1 + SUN JDK 1.4. Content in setup.log
> is attached below.
>
> Can you give me some suggestions?
>
> Thanks very much.
> Parker
>
> 1:OpenCms WEB-INF path:
> "C:\IBM\WebSphere\AppServer\installedApps\bmcczbhuang\opencms_war.ear\opencms.war\WEB-INF\".
>
> 2:OpenCms property file:
> "C:\IBM\WebSphere\AppServer\installedApps\bmcczbhuang\opencms_war.ear\opencms.war\WEB-INF\config\opencms.properties".
>
>
> 3:
> 4:java.lang.IndexOutOfBoundsException
> 5: at
> java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java(Compiled
> Code))
> 6: at org.opencms.util.CmsFileUtil.readFully(CmsFileUtil.java:560)
> 7: at org.opencms.util.CmsFileUtil.readFile(CmsFileUtil.java:519)
> 8: at org.opencms.util.CmsFileUtil.readFile(CmsFileUtil.java:532)
> 9: at
> org.opencms.configuration.CmsConfigurationManager.cacheDtdSystemId(CmsConfigurationManager.java:444)
>
>
> 10: at
> org.opencms.configuration.CmsConfigurationManager.<init>(CmsConfigurationManager.java:153)
>
>
> 11: at
> org.opencms.main.OpenCmsCore.initConfiguration(OpenCmsCore.java:843)
> 12: at
> org.opencms.main.OpenCmsCore.upgradeRunlevel(OpenCmsCore.java:1503)
> 13: at org.opencms.main.CmsShell.<init>(CmsShell.java:495)
> 14: at
> org.opencms.setup.CmsSetupWorkplaceImportThread.run(CmsSetupWorkplaceImportThread.java:155)
>
>
> 15:java.lang.NullPointerException
> 16: at org.opencms.main.CmsShell.printPrompt(CmsShell.java:654)
> 17: at org.opencms.main.CmsShell.executeCommands(CmsShell.java:818)
> 18: at org.opencms.main.CmsShell.start(CmsShell.java:687)
> 19: at
> org.opencms.setup.CmsSetupWorkplaceImportThread.run(CmsSetupWorkplaceImportThread.java:194)
>
>
> 20:java.lang.NullPointerException
> 21: at org.opencms.main.CmsShell.exit(CmsShell.java:602)
> 22: at
> org.opencms.setup.CmsSetupWorkplaceImportThread.kill(CmsSetupWorkplaceImportThread.java:118)
>
>
> 23: at
> org.opencms.setup.CmsSetupWorkplaceImportThread.run(CmsSetupWorkplaceImportThread.java:209)
>
>
> 24:
> 25:
> 26:Shutting down OpenCms, version 6.2.0 in web application "opencms.war"
> 27:Shutdown completed, total uptime was 00:00:50.
> 28:
>
>
>




More information about the opencms-dev mailing list