Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java Permissions Problems

Status
Not open for further replies.

crmayer

Programmer
Nov 22, 2002
280
US
We run a Java based application for our entire company. I have recently run into a problem. Anytime we run a report from the Java Application, we have the ability to save the report as a file. Here is where I am completely confussed on this issue. You can save the report as different file types (.pdf, .ps, .txt, .xls, .cvs). I am getting all kinds of reports (from end users) that they can not save to a file anymore. Users can save it to the file formats of .pdf, .ps, but can NOT save .xls, .txt, .cvs. At first I thought it had something to do with Windows XP SP2, but I have recently tested this and I am able to save a to a file on a computer that has SP2 installed. Then I thought that only the local computer Administrator could save files, but again, I went to a different client, logged on as the local Admin and was unable to save those file types. This is the java error I am getting when I try this:

Execution time: 00:00:578
java.lang.NullPointerException
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.tms.common.lib.report.ReportPage.toString(ReportPage.java:614)
at com.tms.common.lib.ReportDocument.toString(ReportDocument.java:359)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at com.tms.common.lib.report.ReportDocumentGridView.<init>(ReportDocumentGridView.java:53)
at com.tms.common.lib.ReportDocument.writeToStream(ReportDocument.java:310)
at com.tms.common.lib.ReportDocument.saveToFile(ReportDocument.java:284)

At this point, I am completely back to square one, I have no clue what is causing this, nor do I know where to start. Everytime I think I have a lead on where the problem might be, I find something to completely contradict what my theory was. Can ANYBODY help point me in the right direction? Is this a windows permision problem? Is this a java permisions problem..... I am LOST.

I have administrative rights to our network, plus have full admin rights in our application, and there are XP computers I have NO problem with. One more thing to add, there is not one windows 2k pro computer here that has this problem.

Any ideas?
 
Does it only happen on machines with XP SP2 ?

Can you complete the operation on any XP machine with SP2 ?

--------------------------------------------------
Free Database Connection Pooling Software
 
So far I have run accrossed so many different senerios.

The only version of windows is XP, but it does not seem to be specific to SP2. I have been able to save a file as a report on a XP without sp2 as local admin, but not as my (which my user is part of the admin group). But then I go to another computer with XP, and I can not save to a file as local adimn. I have been unable to find a pattern here. It does not seem to matter if it has SP2 or not, but it does seem to be specific to pc's running XP.
 
Weird.

You've got a definite stack trace there, so I would start by looking at the code identified in the trace - and add in some debug to check that everything is as you are expecting it to be.

--------------------------------------------------
Free Database Connection Pooling Software
 
I looked into doing this, but ran into one problem. The server where my development environment is set up, I am able to save files......
Do you think I should actually modify the class where the exception is being throw to try and get more information?

I am pretty new to Java, I used to program in C before we upgraded to this Java version of this application. So, I guess I am not sure what I should do to debug this? Do I try and create some type of log file that will print more detail? Is there a way to get more detail from where the exception is being thrown from?
 
I would kick off by adding debug into ReportDocument.java and checking the parameters are all correct, and then drill down through the other files in your package that are called in that stack trace.

--------------------------------------------------
Free Database Connection Pooling Software
 
When programs stop working, the data is sometimes the problem. You're getting a null pointer exception when your reporting package tries to sort an array. This will occur when an array of Objects contains a null entry.

In other words, it may not have anything to do with the client machines. Have you tried running and saving the EXACT report that the users are complaining about?

If you have the source to the com.tms.common.lib.report package, you can recompile it to include debug information, which will get you more information in the stack trace. Other than that, I would examine the code that is creating the data for the reports.
 
Unfortunately I am able to run this report from one PC and have it fail with that error. Then come over to MY pc (windows 2K pro) and run the same report and it runs fine. The thing that I do not get is why would it allow me to save this same report in different formats????? I can run the same report and save as .pdf or .ps, but the other 3 formats all fail? That is what I do not understand. That is also why I guess I was ruling out the java code and looking at the PC and permissions instead..... I just do not get that part of it.
 
I definately think that this is computer specific.... I am the system admin and I have access to pretty much everything here. I am able to save reports from my computer and a few others, but I have run acrossed a few pc's here that run windows xp that I am unable to save reports as a file.
 
Perhaps different java-versions on the machine?
use
Code:
java -version
to test, because multiple versions might be installed, and the one found in the path might not be the one, you installed recently.

Another idea is to compare the contents of the
$JAVA_HOME/jre/lib/ext
directories. Perhaps there are different jar-files installed, allowing to produce some fileformats or not.

(I didn't reread the whole thread - perhaps I'm telling foolish things...)

seeking a job as java-programmer in Berlin:
 
Can somebody get me started on where to start looking for the cause of this problem.....

java.lang.NullPointerException
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.tms.common.lib.report.ReportPage.toString(ReportPage.java:614)
at com.tms.common.lib.ReportDocument.toString(ReportDocument.java:360)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuffer.append(Unknown Source)
at com .tms.common.lib.report.ReportDocumentGridView.<init>(ReportDocumentGridView.java:54)
at com.tms.common.lib.ReportDocument.writeToStream(ReportDocument.java:311)
at com.tms.common.lib.ReportDocument.saveToFile(ReportDocument.java:285)

I am not sure if I need to start looking in the StringBugger.append (ReportDocumentGridView) or the Collections.sort (ReportPage)???

I have tried to find some similar things with this error, but there just is not any. I have checked java versions, 1.4.2_02 is OK on one xp machine, but not on another, another works with 1.4.2_05..... I am not finding a pattern there either. I have tried a xp machine that does not work as the normal power user, Administrator, and me and I can not get it to work, but yet I can jump to my Windows 2000 Pro machine and it works every time. I am very new to trying to debug (or even write java code for that matter), but I am not sure where else to look. It is definatly only happening on windows xp, but not all windows xp machines....

HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
I have went to the code on this and there is a call to the Util.println method (I believe that this might be wrote by our software vendor), but anyway, if I comment out the call to this, I can save reports, if I uncomment it, I get that error. All it is really doing is printing the report to execution log. The bad thing is if I go in and put comments in the Util.println method to see where it is crashing, it never gets to the actual println method. The Util class says that it is completely static and does not need to be instantiated..... So somewhere between the call to Util.println and the actual Util.println method Windows XP is not letting this run.....

Any more ideas on where to check?

This is the call to Util.println:
public ReportDocumentGridView(ReportDocument document)
{
fillUniqueColumnsAndRows(document);
elements = new ReportElement[uniqueRows.size()][uniqueCols.size()];
if (closeCount > 0)
Util.println("ReportDocument [" + document + "] export performance " +
"could be improived by adjusting report template for columns and " +
"rows that line up exactly. There were " + closeCount +
" elements that had to be adjusted to fit.");
fillGridElements(document);
}

This is the Util.println method:
public static void println(String line)
{
String timeInLog = System.getProperty("loadmaster.timeInLog");
String threadInLog = System.getProperty("loadmaster.threadInLog");
StringBuffer lineBuffer=new StringBuffer("");
if (!Util.isEmptyString(threadInLog))
{
if(threadInLog.equals("on"))
{
lineBuffer.append('[');
lineBuffer.append(Thread.currentThread().getName());
lineBuffer.append(']');
}
}
if (!Util.isEmptyString(timeInLog))
{
if(timeInLog.equals("on"))
{
Date d = new Date();
lineBuffer.append(d.format("HH:mm:ss.SSS "));
}
}
lineBuffer.append(tokenizeLine(line));
System.out.println(lineBuffer.toString());
}

As I said though, it is not getting to the Util.println method. But if I comment out the call to Util.println it works fine.
 
Code:
java.lang.NullPointerException
    at java.util.Arrays.mergeSort(Unknown Source)
(...)
    at java.util.Arrays.sort(Unknown Source)
    at java.util.Collections.sort(Unknown Source)
    at com.tms.common.lib.report.ReportPage.toString(ReportPage.java:614)
    at com.tms.common.lib.ReportDocument.toString(ReportDocument.java:360)

Which is line 614 of ReportPage.java?
and ReportDocument.java:360
and ReportDocumentGridView.<init>(ReportDocumentGridView.java:54)



seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top