Questions tagged [illegalstateexception]

About java.lang.IllegalStateException, a general-purpose exception defined in the Java API.

A java.lang.IllegalStateException is a Java RuntimeException that:

Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.

In particular, this exception is often used when the object the method is invoked on is currently in a state where this method should not be called. For instance, Effective Java writes (Item 60, page 248):

Another commonly reused exception is IllegalStateException. This is generally the exception to throw if the invocation is illegal because of the state of the receiving object. For example, this would be the exception to throw if the caller attempted to use some object before it had been properly initialized.

1120 questions
567
votes
35 answers

IllegalStateException: Can not perform this action after onSaveInstanceState with ViewPager

I'm getting user reports from my app in the market, delivering the following exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at…
369
votes
33 answers

getting exception "IllegalStateException: Can not perform this action after onSaveInstanceState"

I have a Live Android application, and from market i have received following stack trace and i have no idea why its happening as its not happening in application code but its getting caused by some or the other event from the application…
dcool
  • 4,039
  • 3
  • 16
  • 14
150
votes
18 answers

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

I'm using the support library for my app. In my FragmentActivity I'm using an AsyncTask for downloading data from internet. In the onPreExecute() method I add a Fragment and in the onPostExecute() method I remove it again. When the orientation is…
110
votes
9 answers

java.lang.IllegalStateException: Cannot (forward | sendRedirect | create session) after response has been committed

This method throws java.lang.IllegalStateException: Cannot forward after response has been committed and I am unable to spot the problem. Any help? int noOfRows = Integer.parseInt(request.getParameter("noOfRows")); String chkboxVal = ""; …
81
votes
6 answers

What's the intended use of IllegalStateException?

This came up in a discussion with a colleague today. The Javadocs for Java's IllegalStateException state that it: Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application…
Andrew McNamee
  • 1,705
  • 1
  • 13
  • 11
72
votes
11 answers

Spring/Java error: namespace element 'annotation-config' ... on JDK 1.5 and higher

I have Spring/Java App that is compiled with Compiler compliance level 1.5. I have a new Linux setup where I downloaded Apache Tomcat 8.0.8. I downloaded JDK 8u5. I set the path in bash as follows: PATH=$PATH:$HOME/jdk1.8.0_05/bin export PATH Java…
user3665944
  • 723
  • 1
  • 5
  • 4
64
votes
7 answers

Fatal crash: Focus search returned a view that wasn't able to take focus

My application keeps crashing when I type something in a EditText, but this does not happen always only in some cases. I am running my app on a Samsung Galaxy Tab 2 10.1 WiFI & 3G (GT-P5100) with Android 4.0.4 (ICS). I use the stock Keyboard. This…
ObAt
  • 2,337
  • 3
  • 24
  • 44
56
votes
11 answers

Fragment already added IllegalStateException

I use this method on my container Activity to show a BFrag public void showBFrag() { // Start a new FragmentTransaction FragmentTransaction fragmentTransaction = mFragmentMgr.beginTransaction(); if(mBFrag.isAdded()) { …
49
votes
21 answers

SEVERE: ContainerBase.addChild: start:org.apache.catalina.LifecycleException: Failed to start error

I encountered this error when I tried to run my application in Tomcat. I already checked the version of tomcat and java home. Both use java 6. Is there a missing jar? Or is it my web xml? I'm not using any maven tool. SEVERE:…
james goooseling
  • 771
  • 1
  • 6
  • 7
48
votes
3 answers

What is IllegalStateException?

I am trying to use the following Fastload API connection ... etc is perfect. I know exactly where it fails ........... System.out.println(" Streaming " + dataFile); pstmtFld.setAsciiStream(1, dataStream, -1); // This line fails …
Borat Sagddiev
  • 807
  • 5
  • 14
  • 28
47
votes
5 answers

Adding causes java.lang.IllegalStateException: Cannot create a session after the response has been committed

I'm facing the following exception in a very simple JSF 2 page after adding : java.lang.IllegalStateException: Cannot create a session after the response has been committed at…
Pier Luigi
  • 7,871
  • 9
  • 36
  • 46
41
votes
10 answers

IllegalStateException: The application's PagerAdapter changed the adapter's content without calling PagerAdapter#notifyDataSetChanged

I'm using the ViewPager example with ActionBar tabs taken from the Android documentation here. Unfortunately, as soon as I call the addTab method, the application crashes with the following exception: IllegalStateException: The application's…
38
votes
4 answers

Rendering issue in XML preview : Unable to locate mode 0

After updating the android studio exception occured during rendering. Exception raised during rendering: Unable to locate mode 0 java.lang.IllegalStateException: Unable to locate mode 0 at android.view.DisplayInfo.findMode(DisplayInfo.java:458) at…
Aman Jain
  • 2,975
  • 1
  • 20
  • 35
37
votes
5 answers

java.lang.IllegalStateException:Could not find backup for factory javax.faces.application.ApplicationFactory

I'm using this : Tomcat 7.0 JSF 2.0 JRE 7 but when trying to run my application, I got the following exception: java.lang.IllegalStateException: Could not find backup for factory javax.faces.application.ApplicationFactory. at…
Benjamin Gimet
  • 707
  • 1
  • 9
  • 16
36
votes
3 answers

Could not find method in parent or ancestor context

I've been dealing with this problem for awhile and have looked at all the relevant questions I could find, such as: this one, this one, and this one. Could you help me correct this error? It's the only one being thrown by the logcat.…
McLemore
  • 605
  • 1
  • 6
  • 15
1
2 3
74 75