function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chubsubchubsub 

Packaging upload error: Previous load of class failed

Is there any way to find out why the class is failing to load when I go to package an app that needs it?  The class has about 800 lines of code including http callouts and about 80 variables. Could any of this be the reason it is not loading in the package?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
cgosscgoss

Something in your class is referencing something invalid in another class, such as a method that doesn't exist. Usually, when you make a change and save the file, the compile will tell you if there's an error, but not always. Run your tests that cover this class, and you should see the line with the problem.

All Answers

cgosscgoss

Something in your class is referencing something invalid in another class, such as a method that doesn't exist. Usually, when you make a change and save the file, the compile will tell you if there's an error, but not always. Run your tests that cover this class, and you should see the line with the problem.

This was selected as the best answer
chubsubchubsub

You're right, the class has a failure in it.  I'll try and resolve the failure and upload it.  Thanks!

SrinuSrinu

Hi chubsub,

  

   I am also getting same error like what you have went through previously. 

  

  Here is my error description.  


  1.   If I test my all classes and test class in version 23, I got this error for my test case:  line -1, column -1: Previous load of class failed:      knowledgecontroller 
  2.  If i test my all classes and test code in version 24, I got this error for my test case:  System.ListException: List index out of bounds: 0  
  Before my sandbox refreshment, It got 97% test coverage.
 
  Here "knowledgecontroller"  is a controller which already existed (Is that a package?)

  If so, problem with package installation?  Do We need to UnInstall the package and re install it?
  As per the solution You have got, Do I need to find out the problem in corresponding class and should fix it? From my error, I could not find in which line the Error occurs?
 
 Any help would be appreciated..
chubsubchubsub

Is this your package or a package you've installed?  

 

It sounds like the knowledge controller is not passing the unit test with 75% coverage, what coverage are you getting with that controller?  Are there any failures with it?  This List index out of bounds sounds like an issue with a List() method, you may be able to get around it with an if statement.  

 

My issue was with a failure in the class, once I fixed it, I was able to package the app.

SrinuSrinu

Hi Chubsab,

 

  Sory for the delay..

 

  I have solved my error. It is because of test class,  not with package. I thought the error is because of package.

 

  I tried with "Limit 1"  in my test class SOQL, it got worked. 

 

Thanks for ur reply