Wednesday, January 22, 2014

org.springframework.ws.client.WebServiceTransportException Not Found 404

SEVERE: Servlet.service() for servlet [appServlet] in context with path [/smdealer] threw exception org.springframework.ws.client.WebServiceTransportException: Not Found [404]

Problem :


We come across this common exception when using web services with spring.

Exception I Encountered Was :


###################################################################################################################

SEVERE: Servlet.service() for servlet [appServlet] in context with path [/smdealer] threw exception
org.springframework.ws.client.WebServiceTransportException: Not Found [404]
 at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:624)
 at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:548)
 at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:499)
 at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:348)
 at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:342)
 at com.tracfone.udp.delegate.impl.AgentServiceImpl.authenticate(AgentServiceImpl.java:69)
 at com.tracfone.udp.security.CustomAuthenticationProvider.authenticate(CustomAuthenticationProvider.java:41)
 at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
 at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174)
 at org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthenticatio

###################################################################################################################

Solution :


This exception was caused when i was using incorrect uri for the web service for authentication. The environment variable was invalid. I just updated the environment variable in uri and it worked fine.

Example :


- Pointing the correct URI for the service worked for me.

Similar Exception :

     
- org.springframework.ws.client.WebServiceTransportException: Not Found [404]
- No endpoint mapping found for ....
- Servlet.service() for servlet in context with path threw exception


Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds

Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

Problem :


We come across this common exception when start / restart tomcat web server and it doesn't start in default 45 seconds.

Exception I Encountered Was :


###################################################################################################################

Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

###################################################################################################################

Solution :


Generally this exception is caused when Tomcat Server doesnt start within the default server startup time which is 45 second. To resolve this you can increase the server timeout settings as explained below.

Example :


- Double click on the server in eclipse
- In Overview tab select Timeouts
- For Start (in seconds) increase the time in seconds appropriately
- Save and restart the server
- This should resolve the exception.

Similar Exception :

     
- Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds
- If the server requires more time, try increasing the timeout in the server editor


ERROR: org.springframework.web.context.ContextLoader - Context initialization failed

ERROR: org.springframework.web.context.ContextLoader - Context initialization failed

Problem :


We come across this common exception when using Java Spring application.

Exception I Encountered Was :


###################################################################################################################

ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
###################################################################################################################

Solution :


This exception was caused when i did not add the maven dependencies to the build path. I was using eclipse with maven, so had to include the maven dependencies in the build path as explained below.

Example :


- Adding Maven dependencies in project web deployment assembly : 
          
  • Open project properties(example: In project explorer right Click on project name to select "Properties").
  • Select "Deployment Assembly".
  • Click "Add..." button on the right navigation.
  • Select "Java Build Path Entries" from menu of Directive Type and then click "Next".
  • Select "Maven Dependencies" from Java Build Path Entries menu and then click "Finish".
  • Now the "Maven Dependencies" should be added to the Web Deployment Assembly.
- When using Eclipse WDT and using unmodified and previously working project :
  • If Tomcat is running Stop it
  • Open the "Servers" view: Window then select "Show view" and then select "Other" > Server > Servers
  • Right Click on the Tomcat Server and then select "Clean Tomcat Work Directory".
  • Right Click on the Tomcat Server and then select "Clean"
  • Restart the Tomcat Server
The above solution should resolve the exception.

Similar Exception :

     
- ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

java.lang.ClassFormatError: Duplicate method name signature in class file

java.lang.ClassFormatError: Duplicate method name&signature in class file

Problem :


We come across this common exception when using eclipse.

Exception I Encountered Was :


###################################################################################################################

java.lang.ClassFormatError: Duplicate method name signature in class file

###################################################################################################################

Solution :


This exception was caused when i was importing maven project in my eclipse. After importing the project and starting the server i came across this common exception. Please see the below explanation to resolve the exception.


Example :


When trying to import a already existing Maven project, select / browse the appropriate folder. Then click on finish rather than clicking the next button.

Clicking the next button created a different package structure which actually caused the exception "java.lang.ClassFormatError".

Similar Exception :

     

- java.lang.ClassFormatError: Duplicate method name signature in class file


org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...... Initialization of bean failed


org.springframework.beans.factory.BeanCreationException: Error creating bean with name

Problem :


We come across this common exception when using spring and the properties file is not updated for the values defined in the common view interceptor file.

Exception I Encountered Was :


###################################################################################################################

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 
'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': 
Initialization of bean failed; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#1': 
Cannot create inner bean 
'CommonViewInterceptor' of type [com.udp.interceptor.CommonViewInterceptor]while setting constructor argument; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'CommonViewInterceptor#1':
Injection of autowired dependencies failed; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Could not autowire field: private java.lang.String com.udp.interceptor.CommonViewInterceptor.UrlSimActivation;
nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'url.sim.activation'

###################################################################################################################

Solution :


This exception was caused when i did not add "url.sim.activation" property to the properties file. Since the Common view interceptor could not find a definite value for "url.sim.activation" in properties i was getting this exception.

Example :


- Just add a property value called "url.sim.activation" and give a relevant URL and restart the server


Similar Exception :

     

- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0'
- Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException
- java.lang.IllegalArgumentException

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Problem :


We come across this common exception when spring libraries are not found by the compiler.

Exception I Encountered Was :


#########################################################################################

SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Jan 20, 2014 12:17:38 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.request.RequestContextListener
java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestContextListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Jan 20, 2014 12:17:38 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

#########################################################################################

Solution :


This exception was caused when i did'nt add the maven dependencies to the build path. I was using eclipse with maven, so had to include the maven dependencies in the build path as explained below.



Example :


- Adding Maven dependencies in project web deployment assembly : 
          
  • Open project properties(example: In project explorer rightClick on project name to select "Properties").
  • Select "Deployment Assembly".
  • Click "Add..." button on the right navigation.
  • Select "Java Build Path Entries" from menu of Directive Type and then click "Next".
  • Select "Maven Dependencies" from Java Build Path Entries menu and then click "Finish".
  • Now the "Maven Dependencies" should be added to the Web Deployment Assembly.
- When using Eclipse WDT and using not modified and project which was working earlier :
  • If Tomcat is running Stop it
  • Open the "Servers" view: Window then select "Show view" and then select "Other" > Server > Servers
  • Right Click on the Tomcat Server and then select "Clean Tomcat Work Directory".
  • Right Click on the Tomcat Server and then select "Clean"
  • Restart the Tomcat Server
The above solution should resolve the exception.



Similar Exception :

     

- java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 



cannot find the tag library descriptor for http //java.sun.com/jsp/jstl/core

cannot find the tag library descriptor for http //java.sun.com/jsp/jstl/core

Problem :


We come across this common exception when we are using jsp's with tag libraries.

Exception I Encountered Was :


#########################################################################################

cannot find the tag library descriptor for http //java.sun.com/jsp/jstl/core

#########################################################################################

Solution :


This exception was caused when i did not add the jstl.jar to my class path. I was using maven, so had to include it in my dependency and update web.xml file as explained below.



Example :


- General class path : 
configure the exact path in the Environment Variable for classpath
- Maven Dependency :
<dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> <scope>compile</scope> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> <scope>compile</scope> </dependency>
- Web.xml :
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

Similar Exception :

     

- cannot find the tag library descriptor for http //java.sun.com/jsp/jstl/core