I have 5 hello world projects that have the same error:
"description: The requested resource is not available."
I'm using jdk7, tomcat7, maven3.1.1. I always use mvn clean/package.
Here is one of this projects
/WEB-INF/dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<!-- the package is right( checked it twice) -->
<context:component-scan base-package="ua.abond.tutor.controller" />
<!-- without this tag I get "No mapping found for HTTP request with URI [/SecondSite/hello.htm] in DispatcherServlet with name 'dispatcher'" -->
<mvc:default-servlet-handler />
<!-- also tried mvc:annotation-driven and context:annotation-config tags
didnt help too-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/pages/" p:suffix=".jsp">
</bean>
<!-- prefix is right, if I had permission, I would have shared my root screenshot -->
</beans>
/WEB-INF/web.xml
<web-app 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"
version="2.5">
<display-name>SecondSite</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
<!-- also tried /*, *, /dispatcher/*, /dispatcher/*.htm and / -->
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
controller
#Controller
public class Home {
String message = "Welcome to your 1st Maven Spring project !";
#RequestMapping(value = "/hello")//also tried: hello, /hello.htm ... no result
public ModelAndView showMessage() {
System.out.println("from controller");
return new ModelAndView("hello", "message", message);
}
}
and my pages
1)index.jsp
<html>
<head>
<title>Tutorial | Spring</title>
</head>
<body>
<h4>
Click Here
</h4>
</body>
</html>
2)WEB-INF/pages/hello.jsp ------ The page I cant reach
<html>
<head>
<title>Tutorial | Spring</title>
</head>
<body>
<h4>${message}</h4>
</body>
</html>
console
Jan 28, 2014 8:57:15 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Programmes\JRE7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\iis express\PHP\v5.4;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft SQL ;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files (x86)\nodejs\ ;C:\Program Files\Apache Software Foundation\apache-maven-3.1.1\bin;C:\Program Files (x86)\Java\jre7\bin;C:\Users\Alex\AppData\Roaming\npm\;.
Jan 28, 2014 8:57:15 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SecondSite' did not find a matching property.
Jan 28, 2014 8:57:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 28, 2014 8:57:15 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 28, 2014 8:57:15 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 475 ms
Jan 28, 2014 8:57:15 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 28, 2014 8:57:15 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Jan 28, 2014 8:57:16 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 28, 2014 8:57:16 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Jan 28, 2014 8:57:16 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jan 28, 2014 8:57:16 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue Jan 28 20:57:16 EET 2014]; root of context hierarchy
Jan 28, 2014 8:57:16 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
Jan 28, 2014 8:57:17 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 692 ms
Jan 28, 2014 8:57:17 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization started
Jan 28, 2014 8:57:17 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Tue Jan 28 20:57:17 EET 2014]; parent: Root WebApplicationContext
Jan 28, 2014 8:57:17 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
Jan 28, 2014 8:57:17 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 178 ms
Jan 28, 2014 8:57:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 28, 2014 8:57:17 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 28, 2014 8:57:17 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2025 ms
The dispatcher servlet is only configured to handle *.htm files, so when accessing /hello it won't work.
Try this:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
Try with this,
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Put the <mvc:annotation-driven /> in spring configuration.
Related
IN SPRING MVC
in spring mvc. i am unable to get required page,it is not showing error in console also, but it is giving 404 error in browser..
CONSOLE-->Aug 01, 2016 10:26:09 AM
org.apache.catalina.core.AprLifecycleListener init INFO: The APR based
Apache Tomcat Native library which allows optimal performance in
production environments was not found on the java.library.path:
C:\Program
Files\Java\jre1.8.0_101\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\Dell\DW WLAN Card;;;C:\PROGRAM FILES (X86)\INTEL\ICLS
CLIENT\;C:\PROGRAM FILES\INTEL\ICLS
CLIENT\;C:\Windows\SYSTEM32;C:\Windows;C:\Windows\SYSTEM32\WBEM;C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM
FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES
(X86)\INTEL\OPENCL SDK\2.0\BIN\X64;C:\PROGRAM FILES\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\DAL;C:\PROGRAM FILES\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\IPT;C:\PROGRAM FILES (X86)\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\DAL;C:\PROGRAM FILES (X86)\INTEL\INTEL(R)
MANAGEMENT ENGINE COMPONENTS\IPT;C:\Program Files\WIDCOMM\Bluetooth
Software\;C:\Program Files\WIDCOMM\Bluetooth
Software\syswow64;C:\Program Files (x86)\Brackets\command;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files
(x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions
for PHP\;C:\Program Files\Java\jdk1.8.0_101\bin;. Aug 01, 2016
10:26:09 AM org.apache.coyote.AbstractProtocol init INFO: Initializing
ProtocolHandler ["http-bio-8080"] Aug 01, 2016 10:26:09 AM
org.apache.coyote.AbstractProtocol init INFO: Initializing
ProtocolHandler ["ajp-bio-8009"] Aug 01, 2016 10:26:09 AM
org.apache.catalina.startup.Catalina load INFO: Initialization
processed in 838 ms Aug 01, 2016 10:26:09 AM
org.apache.catalina.core.StandardService startInternal INFO: Starting
service Catalina Aug 01, 2016 10:26:09 AM
org.apache.catalina.core.StandardEngine startInternal INFO: Starting
Servlet Engine: Apache Tomcat/7.0.47 Aug 01, 2016 10:26:10 AM
org.apache.catalina.startup.HostConfig deployDescriptor INFO:
Deploying configuration descriptor
D:\Springs\WORK_SPACE.metadata.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\demoMVC.xml
Aug 01, 2016 10:26:10 AM
org.apache.catalina.startup.SetContextPropertiesRule begin WARNING:
[SetContextPropertiesRule]{Context} Setting property 'source' to
'org.eclipse.jst.j2ee.server:demoMVC' did not find a matching
property. Aug 01, 2016 10:26:11 AM
org.apache.catalina.core.ApplicationContext log INFO: No Spring
WebApplicationInitializer types detected on classpath Aug 01, 2016
10:26:12 AM org.apache.catalina.core.ApplicationContext log INFO:
Initializing Spring FrameworkServlet 'dispatcher' Aug 01, 2016
10:26:12 AM org.springframework.web.servlet.DispatcherServlet
initServletBean INFO: FrameworkServlet 'dispatcher': initialization
started Aug 01, 2016 10:26:12 AM
org.springframework.web.context.support.XmlWebApplicationContext
prepareRefresh INFO: Refreshing WebApplicationContext for namespace
'dispatcher-servlet': startup date [Mon Aug 01 10:26:12 IST 2016];
root of context hierarchy Aug 01, 2016 10:26:12 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions INFO: Loading XML bean definitions from
ServletContext resource [/WEB-INF/kool-servlet.xml] Aug 01, 2016
10:26:13 AM
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
initControllerAdviceCache INFO: Looking for #ControllerAdvice:
WebApplicationContext for namespace 'dispatcher-servlet': startup date
[Mon Aug 01 10:26:12 IST 2016]; root of context hierarchy Aug 01, 2016
10:26:13 AM
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
initControllerAdviceCache INFO: Looking for #ControllerAdvice:
WebApplicationContext for namespace 'dispatcher-servlet': startup date
[Mon Aug 01 10:26:12 IST 2016]; root of context hierarchy Aug 01, 2016
10:26:13 AM org.springframework.web.servlet.DispatcherServlet
initServletBean INFO: FrameworkServlet 'dispatcher': initialization
completed in 1599 ms Aug 01, 2016 10:26:13 AM
org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["http-bio-8080"] Aug 01, 2016 10:26:13 AM
org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["ajp-bio-8009"] Aug 01, 2016 10:26:13 AM
org.apache.catalina.startup.Catalina start INFO: Server startup in
4303 ms
index.jsp
<html>
<body>
<form action="add" method="post">
<input type="text" name="t1">
<input type="text" name="t2">
<input type="submit">
</form>
</body>
</html>
controller.java
package com.test;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
#Controller
public class addController {
#RequestMapping("/add")
#ResponseBody
public String add()
{
return "display.jsp";
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- webapp/WEB-INF/web.xml -->
<web-app 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_3_0.xsd"
version="3.0">
<display-name>Archetype Created Web Application</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class> org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/kool-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
test-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package="com.test" />
<mvc:annotation-driven />
</beans>
Looks like you are calling a page display.jsp which does not exists. change display.jsp to index.jsp in your controller and it should work, or change the view name index.jsp to display.jsp.
I created spring config where applicationContext has all 'heavy' beans and
servlet context only controllers. My problem is that applicationContext with all 'big' beans is loaded twice. What I am doing wrong?
I read this and this but not helps:
my web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-conf/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-conf/dispatcher.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
applicationContext.xml
<context:annotation-config/>
<context:component-scan base-package="kkl.server.error" />
<context:component-scan base-package="kkl.server.services" />
<context:component-scan base-package="kkl.server.log" />
<context:component-scan base-package="kkl.server.model" />
<context:component-scan base-package="kkl.server.security" />
<context:component-scan base-package="kkl.server.utils" />
<context:component-scan base-package="kkl.server.validation" />
<!-- ///////////////// properties ///////////////////// -->
<context:property-placeholder
location="classpath:spring-conf/properties/application.properties"
order='0' ignore-resource-not-found="false" />
<context:property-placeholder
location="classpath:spring-conf/properties/local.properties" order='-1'
ignore-unresolvable='true' ignore-resource-not-found="true"/>
<import resource="classpath:spring-conf/spring-aop_and_transactions.xml" />
<import resource="classpath:spring-conf/spring-security.xml" />
<import resource="classpath:spring-conf/spring-database.xml" />
dispatcher.xml
<context:annotation-config />
<mvc:annotation-driven>
<mvc:message-converters>
<bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper">
<bean class="kkl.fireRpg.server.controllers.utils.json.JsonObjectMapper" />
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<!-- ///////////////// scanned packages //////////////////// -->
<context:component-scan base-package="kkl.server.controllers" />
Update
After when I comment every thing in applicationContext and in web.xml (without listener and context-param) my tomcat output looks like this:
`maj 24, 2016 1:13:54 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:firerpg' did not find a matching property.
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jan 23 2015 11:56:07 UTC
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.18.0
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files (x86)\Java\jdk1.8.0_60\jre
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_60-b27
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\endorsed
maj 24, 2016 1:13:54 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
maj 24, 2016 1:13:54 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.8.0_60\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre1.8.0_60/bin/client;C:/Program Files (x86)/Java/jre1.8.0_60/bin;C:/Program Files (x86)/Java/jre1.8.0_60/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Bitvise SSH Client;D:\programy\java\apache-maven-3.3.9\bin;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\programy\java\eclipseluna\eclipse;;.
maj 24, 2016 1:13:55 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
maj 24, 2016 1:13:55 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
maj 24, 2016 1:13:55 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
maj 24, 2016 1:13:55 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
maj 24, 2016 1:13:55 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 676 ms
maj 24, 2016 1:13:55 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
maj 24, 2016 1:13:55 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.18
maj 24, 2016 1:13:59 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
maj 24, 2016 1:13:59 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
maj 24, 2016 1:13:59 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
maj 24, 2016 1:13:59 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue May 24 01:13:59 CEST 2016]; root of context hierarchy
maj 24, 2016 1:13:59 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-conf/applicationContext.xml]
maj 24, 2016 1:13:59 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/local.properties]
maj 24, 2016 1:13:59 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/application.properties]
maj 24, 2016 1:13:59 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 655 ms
maj 24, 2016 1:14:00 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [265] milliseconds.
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\docs
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\docs has finished in 31 ms
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\examples
maj 24, 2016 1:14:00 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
maj 24, 2016 1:14:00 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\examples has finished in 375 ms
maj 24, 2016 1:14:00 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\firerpg
maj 24, 2016 1:14:03 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
maj 24, 2016 1:14:03 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
maj 24, 2016 1:14:03 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
maj 24, 2016 1:14:04 AM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Tue May 24 01:14:04 CEST 2016]; root of context hierarchy
maj 24, 2016 1:14:04 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-conf/applicationContext.xml]
maj 24, 2016 1:14:04 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/local.properties]
maj 24, 2016 1:14:04 AM org.springframework.context.support.PropertySourcesPlaceholderConfigurer loadProperties
INFO: Loading properties file from class path resource [spring-conf/properties/application.properties]
maj 24, 2016 1:14:04 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 561 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\firerpg has finished in 3,932 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\host-manager
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\host-manager has finished in 16 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\manager
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\manager has finished in 16 ms
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\ROOT
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\programy\java\apache-tomcat-8.0.18-windows-x86\apache-tomcat-8.0.18\webapps\ROOT has finished in 15 ms
maj 24, 2016 1:14:04 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
maj 24, 2016 1:14:04 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
maj 24, 2016 1:14:04 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 9413 ms`
this line:
INFO: Loading XML bean definitions from class path resource [spring- conf/applicationContext.xml]
shows twice.
I fight a lot with this problem. I disabled almost everything but it still exist.
Then I back to my eclipse tomcat config where I set up 'use real installtion'.
After when I change setting to use 'use workspace metadata' problem disappears.
I am using eclipse luna release 2 and tomcat 8
I hope this will spare someones time.
UPDATE
After few tries I see that eclipse is breaking my tomcat installation.
(I tried on a new one to be sure).When I set up 'use real installation'
problem occurs again. After this, it still exist even when I run tomcat without eclipse.
Solution is: delete yours tomcat installation.Setup a new one and never change 'use workspace metadata'
I have created Spring Web service and deployed in the Weblogic service . I got below logs:
Jun 19, 2014 9:21:29 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jun 19, 2014 9:21:30 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Thu Jun 19 21:21:30 IST 2014]; root of context hierarchy
Jun 19, 2014 9:21:31 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#3b14dd4: defining beans []; root of factory hierarchy
Jun 19, 2014 9:21:31 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 2041 ms
Jun 19, 2014 9:21:32 PM org.springframework.ws.transport.http.MessageDispatcherServlet initServletBean
INFO: FrameworkServlet 'test-ws': initialization started
Jun 19, 2014 9:21:32 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'test-ws-servlet': startup date [Thu Jun 19 21:21:32 IST 2014]; parent: Root WebApplicationContext
Jun 19, 2014 9:21:32 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/test-ws-servlet.xml]
Jun 19, 2014 9:21:32 PM org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping afterPropertiesSet
INFO: Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
Jun 19, 2014 9:21:32 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#213f529: defining beans [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionResolver#0,org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver#0,getCptSkuDetailsWebService,getSkuDetailsWebService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,skuDetails,skuDetailsSchema,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#3b14dd4
Jun 19, 2014 9:21:33 PM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet
INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
Jun 19, 2014 9:21:33 PM org.springframework.ws.transport.http.MessageDispatcherServlet initServletBean
INFO: FrameworkServlet 'test-ws': initialization completed in 1167 ms
But when I try to hit the URL cant able to find the WSDL saying 404 .
Please find the web.xml
<servlet>
<servlet-name>test-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>test-ws</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>test-ws</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Please find the test-ws-servlet.xml file
<bean id="testDetails"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schema" ref="testDetailsSchema" />
<property name="portTypeName" value="GetTestServicePortType" />
<property name="locationUri" value="/testDetailsService/" />
</bean>
<bean id="testDetailsSchema" class="org.springframework.xml.xsd.SimpleXsdSchema">
<property name="xsd" value="/schemas/TestDetails.xsd" />
</bean>
URL i used is :
http://localhost:7001/<projectName>/<locationUri>/<beanid>.wsdl
Please help me in this case. I can understand from logs that WSDL has been generated, if my understanding is wrong please help in that.
Also please help me in finding the WSDL. Is the URL I am using to access the WSDL is correct ?
Should work like this
http://localhost:7001/<projectName>/<locationUri>.wsdl
beanid is redundant, because one locationUri presumes only one WebService, so only one WSDL.
See here: https://docs.spring.io/spring-ws/docs/current/reference/#tutorial-publishing-wsdl
I am new to spring web services.I am doing an interceptor on the sage.xml (otherwse, known as spring-ws-servlet.xml) in my project by using eclipse.
Without the interceptors and it's handler. The web services work fine, but once added the interceptor the error was prompt.
I have no idea why it is prompting errors.I suspected the libraries problem. I can't figure it out can anyone help me with this?
The following is the error message.
Apr 30, 2014 2:27:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.4.8.
Apr 30, 2014 2:27:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Apr 30, 2014 2:27:48 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1e 11 Feb 2013)
Apr 30, 2014 2:27:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:27:48 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:27:48 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1173 ms
Apr 30, 2014 2:27:48 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 30, 2014 2:27:48 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Apr 30, 2014 2:27:48 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Java\apache-tomcat-7.0.52\conf\Catalina\localhost\task4.xml
Apr 30, 2014 2:27:51 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Apr 30, 2014 2:27:51 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Wed Apr 30 14:27:51 SGT 2014]; root of context hierarchy
Apr 30, 2014 2:27:51 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/config/sage.xml]
Apr 30, 2014 2:27:51 PM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Apr 30, 2014 2:27:51 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1655d7e: defining beans [govUserEndpoint,govUserInterfaceImplementation,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,final,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#0,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#1,callbackHandler,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Apr 30, 2014 2:27:52 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#1655d7e: defining beans [govUserEndpoint,govUserInterfaceImplementation,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,final,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#0,org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#1,callbackHandler,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
Apr 30, 2014 2:27:52 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#1': Cannot create inner bean 'wss4jSecurityInterceptor' of type [org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wss4jSecurityInterceptor' defined in ServletContext resource [/WEB-INF/config/sage.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/xml/security/Init
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:616)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:670)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1839)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wss4jSecurityInterceptor' defined in ServletContext resource [/WEB-INF/config/sage.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/xml/security/Init
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
... 30 more
Caused by: java.lang.NoClassDefFoundError: org/apache/xml/security/Init
at org.apache.ws.security.WSSConfig.setXmlSecIgnoreLineBreak(WSSConfig.java:400)
at org.apache.ws.security.WSSConfig.init(WSSConfig.java:420)
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:455)
at org.apache.ws.security.WSSecurityEngine.getWssConfig(WSSecurityEngine.java:142)
at org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor.afterPropertiesSet(Wss4jSecurityInterceptor.java:496)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 33 more
Caused by: java.lang.ClassNotFoundException: org.apache.xml.security.Init
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 40 more
Apr 30, 2014 2:27:52 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Apr 30, 2014 2:27:52 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/task4] startup failed due to previous errors
Apr 30, 2014 2:27:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\docs
Apr 30, 2014 2:27:52 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\examples
Apr 30, 2014 2:27:54 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\host-manager
Apr 30, 2014 2:27:55 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\manager
Apr 30, 2014 2:27:56 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Java\apache-tomcat-7.0.52\webapps\ROOT
Apr 30, 2014 2:27:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:27:56 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:27:56 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8494 ms
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:39:57 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-apr-8009"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-apr-8080"]
Apr 30, 2014 2:39:57 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-apr-8009"]
The libraries I have are,
aopalliance-1.0.jar
commons-collections-3.2.jar
commons-lang-2.5.jar
commons-logging-1.1.1.jar
spring-aop-3.1.1.RELEASE.jar
spring-asm-3.1.1.RELEASE.jar
spring-aspects-3.1.1.RELEASE.jar
spring-beans-3.1.1.RELEASE.jar
spring-context-3.1.1.RELEASE.jar
spring-context-support-3.1.1.RELEASE.jar
spring-core-3.1.1.RELEASE.jar
spring-expression-3.1.1.RELEASE.jar
spring-oxm-3.1.1.RELEASE.jar
spring-web-3.0.5.RELEASE.jar
spring-webmvc-3.0.5.RELEASE.jar
spring-ws-core-2.0.0.RELEASE.jar
spring-ws-security-2.1.4.RELEASE .jar
spring-xml-2.0.0.RELEASE.jar
stax-api-1.0-2.jar
wsdl4j-1.6.1.jar
wss4j-1.6.13.jar
XmlSchema-1.4.3.jar
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<!--
Spring-ws-configuraion file.
-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/sage.xml
</param-value>
</context-param>
<!--
Loads the Spring web application context, using the files defined above.
-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--
Define the Spring WS Servlet. The 'transformWsldLocations' param means
that any WSDLs generated are context-aware and contain the correct
path to their exposed port types. The 'contextConfigLocation' param
with an empty value means that the Spring context won't try to load
a file called webservices-servlet.xml
-->
<servlet>
<servlet-name>webservices</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webservices</servlet-name>
<url-pattern>*.wsdl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>webservices</servlet-name>
<url-pattern>/endpoints/*</url-pattern>
</servlet-mapping>
</web-app>
My sage.xml (spring-ws-servlet.xml)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd ">
<!-- Here point to your interface and implementation package -->
<context:component-scan base-package="org.example.service" />
<!-- Here is the name for the web address -->
<bean id="final"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"
lazy-init="true">
<property name="schemaCollection">
<bean
class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="inline" value="true" />
<property name="xsds">
<list>
<!-- Here point to schemas folder of the operation service XSD!! -->
<value>schema/GovUserOperationService.xsd</value>
</list>
</property>
</bean>
</property>
<property name="portTypeName" value="GovUserServices" />
<property name="serviceName" value="GovUserService" />
<property name="locationUri" value="/endpoints" />
</bean>
<sws:interceptors>
<bean
class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor" />
<bean id="wss4jSecurityInterceptor"
class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationCallbackHandler" ref="callbackHandler" />
<property name="validationActions" value="UsernameToken" />
</bean>
</sws:interceptors>
<bean id="callbackHandler"
class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
<property name="users">
<props>
<prop key="admin">password</prop>
</props>
</property>
</bean>
</beans>
I new about Spring, i'm trying to create a simple project but i can't figure it out!
I have java JDK 7 up to date.
Apache Tomcat 7 up to date.
Spring 3 framework / Eclipse JUNO 4 integrated.
HERE
it is my project structure (sorry for the external link bur i have not 10 reputation points)
My web.xml file:
<?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">
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
My servlet-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Scans within the base package of the application for #Components to configure as beans -->
<!-- #Controller, #Service, #Configuration, etc. -->
<context:component-scan base-package="controller" />
<!-- Enables the Spring MVC #Controller programming model -->
<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
My HomeController.java file:
package controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Handles requests for the application home page.
*/
#Controller
public class HomeController {
#RequestMapping(value = "/home")
public String home() {
System.out.println("HomeController: Passing through...");
return "home";
}
}
My problem is that when i call the servlet from the browser (for instance in that way):
http://localhost:8080/SpringMVC/home
i have a HTTP 400 error - description The requested resource is not available.
I suspect is a libraries problem but i put all the Spring libraries (and much more) in WEB-INF/lib. In the Eclipse project obviously i add everything in the classpath.
I paste the Tomcat's localhost log:
*
apr 13, 2013 3:44:43 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
apr 13, 2013 3:44:43 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
apr 13, 2013 3:44:47 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
apr 13, 2013 3:44:47 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
apr 13, 2013 3:44:47 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache#189b904')
*
and the Tomcat strERR log:
*
2013-04-13 15:44:46 Commons Daemon procrun stderr initialized
apr 13, 2013 3:44:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Windows Live\Shared;C:\Program Files\Autodesk\Backburner\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;;.
apr 13, 2013 3:44:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
apr 13, 2013 3:44:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 397 ms
apr 13, 2013 3:44:47 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
apr 13, 2013 3:44:47 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.39
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\.metadata
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\docs
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\host-manager
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\manager
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\Servers
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\SpringMVC
apr 13, 2013 3:44:47 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
apr 13, 2013 3:44:47 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
apr 13, 2013 3:44:47 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 540 ms
*
I'm EXHAUSTED, i'm since yesterday to fight with this project, please help me! :)
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</context-param>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
This might probably cause due to lack of needed libraries.Following is a list of libraries which spring includes in it's template project(library versions might differ).
When moving forward you might experience that copying libraries is painful and there must be a better way to do this.
I have prepared a blog post on ,how to easily setup a springMVC project with the help of spring toolsuit plugin for eclipse.Hope it will be a very helpful reference for you.
What is actually in "C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\SpringMVC" directory? Does it have webapp directory structure?
It seems that Tomcat does not detect your appServlet(org.springframework.web.servlet.DispatcherServlet) according to stdErr log.
If you deploy your SpringMVC app correctly, you should see the following messages in the log file:
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
...
...
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 725 ms
9 times out of 10, when I see the 404 error with Spring MVC, its usually because I fat-fingered the view name/path returned by my Controller.
Based on your code structure everything looks perfect.
Still if I were you, I would check the System.out.println() value to see whether the controller is really invoked or not and then I will make sure the location of home.jsp is correct.
Try changing the request mapping of controller method to :
#Controller
public class HomeController {
#RequestMapping(value = "home")
public String home() {
System.out.println("HomeController: Passing through...");
return "home";
}
}
Remove / from /home.
Also your web.xml does not seem to have context listener.
<context-param>
<param-name>contextConfigLocation</param-name><param-value>
/WEB-INF/spring/appServlet/spring-security.xml,
/WEB-INF/spring/appServlet/hibernate-config.xml
</param-value>
</context-param>
<!-- you seem to be missing this -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>