Java code OK in AIX 3.5, fails in RHEL 7.5: It makes corrupt DOC, DOCX, XLS, XLSX files but good HTML files ...
Realistic Alternatives to Dust: What Else Could Feed a Plankton Bloom?
Why is Grand Jury testimony secret?
Does a dangling wire really electrocute me if I'm standing in water?
Unbreakable Formation vs. Cry of the Carnarium
What is the motivation for a law requiring 2 parties to consent for recording a conversation
It's possible to achieve negative score?
Is "plugging out" electronic devices an American expression?
Is bread bad for ducks?
What effect does the “loading” weapon property have in practical terms?
I looked up a future colleague on LinkedIn before I started a job. I told my colleague about it and he seemed surprised. Should I apologize?
Should I use my personal or workplace e-mail when registering to external websites for work purpose?
What does "sndry explns" mean in one of the Hitchhiker's guide books?
Dual Citizen. Exited the US on Italian passport recently
"Riffle" two strings
In microwave frequencies, do you use a circulator when you need a (near) perfect diode?
What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?
How to change the limits of integration
JSON.serialize: is it possible to suppress null values of a map?
What do hard-Brexiteers want with respect to the Irish border?
Why don't Unix/Linux systems traverse through directories until they find the required version of a linked library?
How can I create a character who can assume the widest possible range of creature sizes?
"What time...?" or "At what time...?" - what is more grammatically correct?
CiviEvent: Public link for events of a specific type
What is this 4-propeller plane?
Java code OK in AIX 3.5, fails in RHEL 7.5: It makes corrupt DOC, DOCX, XLS, XLSX files but good HTML files
The 2019 Stack Overflow Developer Survey Results Are In
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
We have a Java process (see below) to generate DOC, DOCX, XLS, XLSX, and HTML and save it to our Linux PCs. It ran well in our old AIX 3.5 machine; but in our new RHEL 7.5 machine, Microsoft proprietary document formats (DOCX, DOC, XLSX, and XLS) it outputs are corrupt. HTML files are not corrupt.
I have downloaded the output files into a Windows PC and try to open them; Exception errors say the DOC/DOCX/XLS/XSLX files are corrupt and cannot be opened.
The Java code works well in the old Linux PC. I am assuming there might some libraries or software we need to install in the new PC.
Below is my java code (Process to generate the file)
int BUFFER_SIZE=1024*256;
int bytesRead=0;
Resultset rs=obj.resultSet();
DocumentClass = new DocumentClass();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream(1));
try
{
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
while (bytesRead > 0)
{
baos.write(buffer, 0, bytesRead);
buffer = new byte[BUFFER_SIZE];
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
}
}
catch (IOException io )
{
System.out.println(io.getMessage());
}
DocumentClass.setFileBody(baos);
BufferedWriter CreateDoc = new BufferedWriter(new FileWriter("/usr/Test.docx"));
CreateDoc.write(DocumentClass.getFileBody().toString());
CreateDoc.close();
rhel java aix
add a comment |
We have a Java process (see below) to generate DOC, DOCX, XLS, XLSX, and HTML and save it to our Linux PCs. It ran well in our old AIX 3.5 machine; but in our new RHEL 7.5 machine, Microsoft proprietary document formats (DOCX, DOC, XLSX, and XLS) it outputs are corrupt. HTML files are not corrupt.
I have downloaded the output files into a Windows PC and try to open them; Exception errors say the DOC/DOCX/XLS/XSLX files are corrupt and cannot be opened.
The Java code works well in the old Linux PC. I am assuming there might some libraries or software we need to install in the new PC.
Below is my java code (Process to generate the file)
int BUFFER_SIZE=1024*256;
int bytesRead=0;
Resultset rs=obj.resultSet();
DocumentClass = new DocumentClass();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream(1));
try
{
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
while (bytesRead > 0)
{
baos.write(buffer, 0, bytesRead);
buffer = new byte[BUFFER_SIZE];
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
}
}
catch (IOException io )
{
System.out.println(io.getMessage());
}
DocumentClass.setFileBody(baos);
BufferedWriter CreateDoc = new BufferedWriter(new FileWriter("/usr/Test.docx"));
CreateDoc.write(DocumentClass.getFileBody().toString());
CreateDoc.close();
rhel java aix
it affect only kind of Microsoft proprietary document format (like Docx,doc, XLSX and XLS)
– Sanj
yesterday
Old PC : AIX 3.5
– Sanj
yesterday
New PC : Red Hat Enterprise Linux Server release 7.5 (Maipo)
– Sanj
yesterday
Sanj, now that your updates are added to the question, you can click on Delete after each Comment you left that information in, which will leave room for more Comments.
– K7AAY
yesterday
1
Are you using the same java version? Maybe you are running a newer java version on RHEL that is not supported? Are the jars/.class files in the classpath the same? Do you have no logfile? What framework/library are you using (CreateDoc)?
– Freddy
23 hours ago
add a comment |
We have a Java process (see below) to generate DOC, DOCX, XLS, XLSX, and HTML and save it to our Linux PCs. It ran well in our old AIX 3.5 machine; but in our new RHEL 7.5 machine, Microsoft proprietary document formats (DOCX, DOC, XLSX, and XLS) it outputs are corrupt. HTML files are not corrupt.
I have downloaded the output files into a Windows PC and try to open them; Exception errors say the DOC/DOCX/XLS/XSLX files are corrupt and cannot be opened.
The Java code works well in the old Linux PC. I am assuming there might some libraries or software we need to install in the new PC.
Below is my java code (Process to generate the file)
int BUFFER_SIZE=1024*256;
int bytesRead=0;
Resultset rs=obj.resultSet();
DocumentClass = new DocumentClass();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream(1));
try
{
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
while (bytesRead > 0)
{
baos.write(buffer, 0, bytesRead);
buffer = new byte[BUFFER_SIZE];
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
}
}
catch (IOException io )
{
System.out.println(io.getMessage());
}
DocumentClass.setFileBody(baos);
BufferedWriter CreateDoc = new BufferedWriter(new FileWriter("/usr/Test.docx"));
CreateDoc.write(DocumentClass.getFileBody().toString());
CreateDoc.close();
rhel java aix
We have a Java process (see below) to generate DOC, DOCX, XLS, XLSX, and HTML and save it to our Linux PCs. It ran well in our old AIX 3.5 machine; but in our new RHEL 7.5 machine, Microsoft proprietary document formats (DOCX, DOC, XLSX, and XLS) it outputs are corrupt. HTML files are not corrupt.
I have downloaded the output files into a Windows PC and try to open them; Exception errors say the DOC/DOCX/XLS/XSLX files are corrupt and cannot be opened.
The Java code works well in the old Linux PC. I am assuming there might some libraries or software we need to install in the new PC.
Below is my java code (Process to generate the file)
int BUFFER_SIZE=1024*256;
int bytesRead=0;
Resultset rs=obj.resultSet();
DocumentClass = new DocumentClass();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream(1));
try
{
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
while (bytesRead > 0)
{
baos.write(buffer, 0, bytesRead);
buffer = new byte[BUFFER_SIZE];
bytesRead = bis.read(buffer,0,BUFFER_SIZE);
}
}
catch (IOException io )
{
System.out.println(io.getMessage());
}
DocumentClass.setFileBody(baos);
BufferedWriter CreateDoc = new BufferedWriter(new FileWriter("/usr/Test.docx"));
CreateDoc.write(DocumentClass.getFileBody().toString());
CreateDoc.close();
rhel java aix
rhel java aix
edited yesterday
K7AAY
1,0861028
1,0861028
asked yesterday
SanjSanj
214
214
it affect only kind of Microsoft proprietary document format (like Docx,doc, XLSX and XLS)
– Sanj
yesterday
Old PC : AIX 3.5
– Sanj
yesterday
New PC : Red Hat Enterprise Linux Server release 7.5 (Maipo)
– Sanj
yesterday
Sanj, now that your updates are added to the question, you can click on Delete after each Comment you left that information in, which will leave room for more Comments.
– K7AAY
yesterday
1
Are you using the same java version? Maybe you are running a newer java version on RHEL that is not supported? Are the jars/.class files in the classpath the same? Do you have no logfile? What framework/library are you using (CreateDoc)?
– Freddy
23 hours ago
add a comment |
it affect only kind of Microsoft proprietary document format (like Docx,doc, XLSX and XLS)
– Sanj
yesterday
Old PC : AIX 3.5
– Sanj
yesterday
New PC : Red Hat Enterprise Linux Server release 7.5 (Maipo)
– Sanj
yesterday
Sanj, now that your updates are added to the question, you can click on Delete after each Comment you left that information in, which will leave room for more Comments.
– K7AAY
yesterday
1
Are you using the same java version? Maybe you are running a newer java version on RHEL that is not supported? Are the jars/.class files in the classpath the same? Do you have no logfile? What framework/library are you using (CreateDoc)?
– Freddy
23 hours ago
it affect only kind of Microsoft proprietary document format (like Docx,doc, XLSX and XLS)
– Sanj
yesterday
it affect only kind of Microsoft proprietary document format (like Docx,doc, XLSX and XLS)
– Sanj
yesterday
Old PC : AIX 3.5
– Sanj
yesterday
Old PC : AIX 3.5
– Sanj
yesterday
New PC : Red Hat Enterprise Linux Server release 7.5 (Maipo)
– Sanj
yesterday
New PC : Red Hat Enterprise Linux Server release 7.5 (Maipo)
– Sanj
yesterday
Sanj, now that your updates are added to the question, you can click on Delete after each Comment you left that information in, which will leave room for more Comments.
– K7AAY
yesterday
Sanj, now that your updates are added to the question, you can click on Delete after each Comment you left that information in, which will leave room for more Comments.
– K7AAY
yesterday
1
1
Are you using the same java version? Maybe you are running a newer java version on RHEL that is not supported? Are the jars/.class files in the classpath the same? Do you have no logfile? What framework/library are you using (CreateDoc)?
– Freddy
23 hours ago
Are you using the same java version? Maybe you are running a newer java version on RHEL that is not supported? Are the jars/.class files in the classpath the same? Do you have no logfile? What framework/library are you using (CreateDoc)?
– Freddy
23 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511258%2fjava-code-ok-in-aix-3-5-fails-in-rhel-7-5-it-makes-corrupt-doc-docx-xls-xls%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511258%2fjava-code-ok-in-aix-3-5-fails-in-rhel-7-5-it-makes-corrupt-doc-docx-xls-xls%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
it affect only kind of Microsoft proprietary document format (like Docx,doc, XLSX and XLS)
– Sanj
yesterday
Old PC : AIX 3.5
– Sanj
yesterday
New PC : Red Hat Enterprise Linux Server release 7.5 (Maipo)
– Sanj
yesterday
Sanj, now that your updates are added to the question, you can click on Delete after each Comment you left that information in, which will leave room for more Comments.
– K7AAY
yesterday
1
Are you using the same java version? Maybe you are running a newer java version on RHEL that is not supported? Are the jars/.class files in the classpath the same? Do you have no logfile? What framework/library are you using (CreateDoc)?
– Freddy
23 hours ago