You need to sign in to do that
Don't have an account?
Visualforce - An internal server error has occurred
A previously working Visualforce page now generates the following error message
An internal server error has occurred | |||
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@emea.salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.
Run a second time it generated
|
I faced this problem, and I thought something was going wrong with my VF. But on scratching my head I found that a fundamental design change has hit me hard.
Initially I was initializing a list of Product2 using a SOQL statement. But due to a change in requirement I had to change the initialization to Database.getQueryLocator().
When I made this change I didnt realise that I had a dependency for this change (To be frank, at that point of time I didnt realise that there can be a dependency).
Example:
Before:
// Below code does not throw an error.
List<Product2> queriedRecords = [select id,name from product2 limit 10];
queriedRecords.clear();
// Below code does not throw an exception. But when the method is invoked it simply takes you to a "Internal Server error page"
ApexPages.standardSetController productListSetCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryBuildMethod()));;
List<Product2> queriedRecords = new List<Product2>((List<Product2>)productListSetCon.getRecords());
queriedRecords.clear();
That is because (may be) SFDC keeps a cursor open and when you try to clear it, it just says, you are doing something that you shouldnt do !
But I hope SFDC give a clear and informative error message. It would have saved me lot of time finding this guy out !!
All Answers
Hey
I get these from time to time but they usually fix themselves in a few minutes. There's one that I've gotten that is a bug, but that only occurs if you are trying to remove a managed package.
Cheers,
Wes
For me it occurs everytime. I have tested it on both the sandbox and the live org. I suspect that SFDC have recently made a change to VF which is tripping up on this legacy VF code. I have seen other posts which suggest problems connected with output panel but none seem exactly the same.
Stuart
You usually run into these when your code is having run time errors or exceptions...I would
suggest using try catch blocks whereever possible or wherever you have doubts about the code..
I dont understand how I can do that in Visualforce. Although there is a custom controller I dont think that it is getting as far as calling any of its methods. In fact I have just tried to save the VF page and its failing with the following exception java.lang.NumberFormatException but does not tell me which line is causing the error. I now suspect that the problem is caused by an implicit type conversion that was allowed (when it worked) but is no longer allowed.
Stuart
Yeah you won't be able to debug this one, and if you're getting Java exceptions you can be quite sure that something in the underlying system is being weird. I'd say try chase them up on the case you've logged, otherwise I don't think there's much you can do. Sorry man.
Wes
At the moment I am commenting out bits of the VF page to find out which line is causing the problem. I have seen on another thread that an illegal type cast causes an internal server error so I hope that will turn out to be the problem here. Otherwise I am not holding my breath for an SFDC fix.
Stuart
Here is the line that is causing the problem. It is used to iterate a local variable within a repeat block.
<apex:variable var="j" value="{!VALUE(j)+1}"/>
I am guessing that when this code was written the implied type of j was text but that it is now number because the compiler accepts the following:
<apex:variable var="j" value="{j+1}"/>
I faced this problem, and I thought something was going wrong with my VF. But on scratching my head I found that a fundamental design change has hit me hard.
Initially I was initializing a list of Product2 using a SOQL statement. But due to a change in requirement I had to change the initialization to Database.getQueryLocator().
When I made this change I didnt realise that I had a dependency for this change (To be frank, at that point of time I didnt realise that there can be a dependency).
Example:
Before:
// Below code does not throw an error.
List<Product2> queriedRecords = [select id,name from product2 limit 10];
queriedRecords.clear();
// Below code does not throw an exception. But when the method is invoked it simply takes you to a "Internal Server error page"
ApexPages.standardSetController productListSetCon = new ApexPages.StandardSetController(Database.getQueryLocator(queryBuildMethod()));;
List<Product2> queriedRecords = new List<Product2>((List<Product2>)productListSetCon.getRecords());
queriedRecords.clear();
That is because (may be) SFDC keeps a cursor open and when you try to clear it, it just says, you are doing something that you shouldnt do !
But I hope SFDC give a clear and informative error message. It would have saved me lot of time finding this guy out !!
Quick questions:
Is it the case that queryBuildMethod is returning a String?
Are you sure that it's returning any records instead of throwing an error?
How do you know it's barfing on the Clear()? I presume that if you comment it out the rest of the code works?
Best Steve.
Hi Steve,
I get that error if I try to tamper with the List, but I used a System.debug statement to check that the query returned some records. I was able to print them out, but wasnt able to tamper with the list.
Yep, you're right. It makes a certain amount of sense when you realize it's all being passed by reference, but, as you said, it should give a better response than just throwing an internal error.
Either way, I don't think there is anyway around this other than creating your own copy of the list with:
mylist = setController.getrecords().deepclone(true)
Best, Steve.
I am not sure this will help but as I started the thread I feel I should reply. It turned out that the problem that I experienced was caused by Salesforce changing the underlying data type to Double from Integer in a maintenance release.
So much for regression testing eh!