I made a simple test and it dosen't work.  @RunWith(SpringRunner.class) @SpringBootTest @ContextConfiguration(classes = {SIConfiguration.class, ExceptionTypeRouter.class}) public class ExceptionTypeRouterTest {      @Autowired     @Qualifier("inDefaultChannel")     private DirectChannel in;      @Test     public void fistRouteTest() {          in.send(new GenericMessage&lt;&gt;("ready!"));      } }   @Configuration @Slf4j public class ExceptionTypeRouter {      @Bean     @Qualifier("inDefaultChannel")     public DirectChannel inDefaultChannel() {         return MessageChannels                 .direct()                 .get();     }      @Bean     @Qualifier("directErrorChannel")     public DirectChannel directErrorChannel() {         return MessageChannels                 .direct()                 .get();     }      @Bean     public ErrorMessageExceptionTypeRouter errorMessageExceptionTypeRouter() {         ErrorMessageExceptionTypeRouter router = new ErrorMessageExceptionTypeRouter();         router.setChannelMapping(IOException.class.getName(), "directErrorChannel");         router.setChannelMapping(NullPointerException.class.getName(), "directErrorChannel");         router.setDefaultOutputChannel(outDefaultChannel());          return router;     } }       The proplem is somwhere here. Caze this.getApplicationContext() is null.   private Class&lt;?&gt; resolveClassFromName(String className) {         try {             return ClassUtils.forName(className, this.getApplicationContext().getClassLoader());         } catch (ClassNotFoundException var3) {             throw new IllegalStateException("Cannot load class for channel mapping.", var3);         }     }   Error log:     org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'errorMessageExceptionTypeRouter'   defined in integration.exceptiondemo.configuration.router.ExceptionTypeRouter: Bean instantiation via factory method     failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.   integration.router.ErrorMessageExceptionTypeRouter]: Factory method 'errorMessageExceptionTypeRouter' threw exception; nested     exception is java.lang.NullPointerException
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
Given a filesystem path, is there a shorter way to extract the filename without its extension? Display Animated GIF Elementary central binomial coefficient estimates How to prove that $\quad\displaystyle\frac{4^{n}}{\sqrt{4n}}&lt;\binom{2n}{n}&lt;\frac{4^{n}}{\sqrt{3n+1}}\quad$ for all $n$ &gt; 1 ?     Does anyone know any better elementary estimates?   Attempt.  We have $$\frac1{2^n}\binom{2n}{n}=\prod_{k=0}^{n-1}\frac{2n-k}{2(n-k)}=\prod_{k=0}^{n-1}\left(1+\frac{k}{2(n-k)}\right).$$ Then we have $$\left(1+\frac{k}{2(n-k)}\right)&gt;\sqrt{1+\frac{k}{n-k}}=\frac{\sqrt{n}}{\sqrt{n-k}}.$$ So maybe, for the lower bound, we have $$\frac{n^{\frac{n}{2}}}{\sqrt{n!}}=\prod_{k=0}^{n-1}\frac{\sqrt{n}}{\sqrt{n-k}}&gt;\frac{2^n}{\sqrt{4n}}.$$ By Stirling, $n!\approx \sqrt{2\pi n}\left(\frac{n}{e}\right)^n$, so the lhs becomes $$\frac{e^{\frac{n}{2}}}{(2\pi n)^{\frac14}},$$ but this isn't $&gt;\frac{2^n}{\sqrt{4n}}$. What is the most ruby-ish way of accessing nested hash values at arbitrary depths? I watched this movie when I was a kid and never discovered it again.  It’s about a boy whose father left him after his divorce from the mother, the kid enters a world somehow where he has a big sword he needs to keep searching for precious stones to fill it with. it has certain holes that look like each stone shape! I also remember the kid going to eat with his mythical (dragon-like friend), and he gets stuck in the restaurant because the crazy restaurant lady won’t let him leave without finishing huge amounts of food!  The kid also gets bullied so I’m guessing the the swords journey is to teach the kid how to deal with all of this... Where did Magister Illyrio Mopatis get the dragon eggs from? Clearing Recently used coordinate reference systems using QGIS? After using some non usual SRC for demonstration purpose, I wish to clear my  "Recently used coordinate reference systems" list for the sake of praticity.  Is it possible?   I am using QGIS 2.10.1. Partition a set into subsets of size $k$ Problem about angle in isosceles triangle Update Manager is constantly offering me updates (e.g. security fixes, updates from PPAs).  How can I tell my Ubuntu installation to automatically download and install updates whenever they become available? How to exclude jars generated by maven war plugin? I'm wondering if it's possible to hide a folder without renaming it with a dot on the Desktop.  Ubuntu 12.04  Thanks In the example below, an error is caused by \begin{align} and \end{align} but I do not see why:  \documentclass{book} \usepackage{amsmath} \newenvironment{subalign}{\begin{subequations}\begin{align}}{\end{align}\end{subequations}} \begin{document} \begin{subalign}      a&amp;=b\\     &amp;=b \end{subalign} \end{document} Fusion: Why deuterium and tritium? I would like to know why scientists try to use deuterium and tritium for  and not just the ordinary  ${}^1H$? I can't change materials I was making a scene in blender and I wanted to change the texture from "Material_1" to "Material_2". It lets me change it but when I go to rendered view the part looks the same. can someone please help me How to calculate square root or cube root? I was reading Richard Feynman biography when I read that one time he was able to calculate the  cube root of large number in his brain by just using simple facts of everyday life. So my question is there a way to calculate square root or cube root by using just a pen a paper, I mean a systematic way not by trial and error. Software gvSIG OA Digital Edition 2010 have tools topology for finding pseudo nodes in linear geometry. I set cluster tolerance 0.00002 and maximum number of errors -10000 for 20000 link count linear geometry. But unsuccessful result.   Are there any solutions that find pseudo nodes in free GIS software?   I need to layer pseudo nodes (one solution to this problem - to use tools topology of ArcInfo, but priority for me is to use free software). Linear geometry created several users in QGIS 1.8.0 in PostGIS (v. 2.0.1) database.  Add new image: 12 linear features with three pseudo nodes in A (line 4/5), B (line 6/7), C (line 9/10). Pseudo nodes should be points instead - two linear features with intersection in one point (node) should be one linear feature (line 4/5 - line 4, ...).  Is it possible to make a request in PostGIS, which will result in a layer of pseudo nodes?  Add new image of examples pseudo nodes: if I receive for linear layer point layer pseudo nodes (blue rects) I corrected following errors in linear layer: A - add missing geometry, B - snapped line in intersection, C - remove pseudo node. iOS App stuck in 'Loading...' I tried downloading Tumblr yesterday but it never completed. At the moment I have an App icon stuck at 'Loading...'.  I have tried restarting the iPhone (holding down both home and side buttons at the same time) and I have also tried shutting down the iPhone (holding the side button and swiping).  I have also tried deleting it as usual (holding the icon down and choosing delete but it doesn't go away).  Any ideas on what I can do to get rid of this icon? I use a very custom style (not mine) and very frequently I get a heading  on the bottom of a page and the next paragraph on the top of the next page. Sometimes this paragraph may be a list or similar. The same is true for listings and the listing description.   Is there a general way how I can adjust the "badness" of these events? Or can I adjust when a section heading would be on the last, say, 3cm of a page it should go to the next page? Or can I say, if a *listing description" is on the top 3cm of a page pull 5 more listing lines from the last page onto this page?   The style I use does not use standard structure tags and environments. But lets call them section, subsection, listing and I will try to migrate them to my lingo. Why are the shebang parts of the following elementary scripts not working:  $ cat hello.sh #! /bin/sh echo Hello $ ./hello.sh bash: ./hello.sh: /bin/sh^M: bad interpreter: No such file or directory  $ cat hello.py #! /usr/bin/env python3 print("Hello") $ ./hello.py : No such file or directory   whereas calling the interpreter manually is working:  $ sh hello.sh Hello $ python3 hello.py Hello