I am trying to setup my application to receive files using Spring Integration (version 2.2.0.RELEASE).
When I start Tomcat (where application is deployed), I get the following error message. Anyone has an idea why?
SEVERE: Error configuring application listener of class com.xxxx.aaa.web.mvc.context.CccccContextListener
java.lang.NoClassDefFoundError: com/xxxx/bbb/application/core/exception/unchecked/InvalidFormatException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4079)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: com.xxxx.bbb.application.core.exception.unchecked.InvalidFormatException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
... 20 more
I believe the error message above is a red herring. Before adding the spring integration dependency to the pom file and having the ftp config file, Tomcat was starting successfully.
I use Java6 and Tomcat6. My FTP config file is:
<?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:int="http://www.springframework.org/schema/integration"
xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-2.2.xsd
http://www.springframework.org/schema/integration/ftp
http://www.springframework.org/schema/integration/ftp/spring-integration-ftp-2.2.xsd">
<int:channel id="ftpChannel">
<int:queue/>
</int:channel>
<bean id="ftpClientFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="localhost" />
<property name="port" value="21" />
<property name="username" value="user" />
<property name="password" value="password" />
</bean>
<int-ftp:inbound-channel-adapter
id="ftpInbound"
channel="ftpChannel"
filename-pattern="*.csv"
session-factory="ftpClientFactory"
auto-create-local-directory="true"
delete-remote-files="true"
remote-directory="/"
local-directory="C:/folder/IN">
<int:poller fixed-rate="1000" max-messages-per-poll="15"/>
</int-ftp:inbound-channel-adapter>
</beans>
I added dependency in the pom file as follows :
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-ftp</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
Actually Spring Integration requires Spring core version 3.0.5 at least whereas I had it set to 3.0.2. Once I upgraded spring core to 3.0.5, it worked.
Related
I am developing an application that uses spring framework (4.3.2). I have configured the dispatcher servlet (annotation driven) and configured the transaction manager and connection related beans(i am using JpaRepository to access the database). If i use #Transactional inside my TransactionComponent (that gets the JpaRepository autowired), after building the app i am not able to publish the project in tomcat. I am getting error like below :
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina3].StandardHost[localhost].StandardContext[/accounting]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot#281cbe0e]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4958)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5088)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 10 more
Caused by: java.lang.IllegalArgumentException: The main resource set specified [xxfxxxxfxxxxx\target\OxybinMerchantAccountingService-1.0-SNAPSHOT] is not valid
at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:723)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:684)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
... 13 more
21-Sep-2016 18:52:09.918 SEVERE [localhost-startStop-4] org.apache.catalina.startup.HostConfig.deployDescriptor Error deploying configuration descriptor C:\apache-tomcat-8.0.36\conf\Catalina3\localhost\accounting.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina3].StandardHost[localhost].StandardContext[/accounting]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:587)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1798)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
If i remove #Transactional, the project works fine. please find my dispatcher servlet and web.xml below
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee.xsd
">
<context:component-scan base-package="com.oxybin.oxybinmerchantaccountingservice" />
<jpa:repositories base-package="com.oxybin.oxybinmerchantaccountingservice.abstracts.repositories" />
<mvc:annotation-driven />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<!-- This makes /META-INF/persistence.xml is no longer necessary -->
<property name="packagesToScan" value="com.oxybin.oxybinmerchantaccountingservice.entities" />
<!-- JpaVendorAdapter implementation for Hibernate EntityManager.
Exposes Hibernate's persistence provider and EntityManager extension interface -->
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
</props>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/bnbbjj" />
<property name="username" value="jkkj" />
<property name="password" value="kjkjk" />
</bean>
and web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="payroll" version="3.1">
<display-name>OxybinTraderAccountingService</display-name>
<persistence-unit-ref>
<persistence-unit-ref-name>persistence/OxybinMerchantPU</persistence-unit-ref-name>
<persistence-unit-name>OxybinMerchantPU</persistence-unit-name>
</persistence-unit-ref>
<welcome-file-list>
<welcome-file></welcome-file>
</welcome-file-list>
<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>/</url-pattern>
</servlet-mapping>
</web-app>
This is kind of my first attempt at spring, please let me know if i am not configured everything properly. i am using tomcat.
This means something is wrong with your application configuration or startup.
I think the problem can from the empty welcome file.
There is always information about that in the logs - check logs/catalina.out and figure out what is wrong.
I'm using JDeveloper and Weblogic 12c(12.1.3) and I want to create a job with XML using Spring Batch. When I deploy the project It shows me and error. I need to use this IDE because of some restrictions in my job, also, without using maven.
I've seen several example and I think my XML it's fine. I think the problem is related to weblogic (I had a similar issue) because I made the same test with the same project structure and libraries using Netbeans IDE and GlassFish Open Source Edition 4.1.1, and it works.
The libraries
aopalliance-1.0.jar
com.ibm.jbatch-tck-spi-1.0.jar
commons-logging-1.1.3.jar
hsqldb-2.3.3.jar
javax.batch-api-1.0.jar
jettison-1.2.jar
spring-aop-4.0.5.RELEASE.jar
spring-batch-core-3.0.5.RELEASE.jar
spring-batch-infrastructure-3.0.5.RELEASE.jar
spring-beans-4.0.5.RELEASE.jar
spring-context-4.0.5.RELEASE.jar
spring-core-4.0.5.RELEASE.jar
spring-expression-4.0.5.RELEASE.jar
spring-jdbc-4.0.5.RELEASE.jar
spring-retry-1.1.0.RELEASE.jar
spring-tx-4.0.5.RELEASE.jar
spring-web-4.0.5.RELEASE.jar
spring-webmvc-4.0.5.RELEASE.jar
xmlpull-1.1.3.1.jar
xpp3_min-1.1.4c.jar
xstream-1.4.7.jar
The error
<org.springframework.web.servlet.FrameworkServlet> <FrameworkServlet> <initServletBean> <Context initialization failed>
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobLauncherController': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.batch.core.Job batch.JobLauncherController.job; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'job': Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
My application context XML is this:
testBatch-servlet.xml
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
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-3.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="batch"/>
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/"/>
<beans:property name="suffix" value=".jsp"/>
</beans:bean>
<beans:bean id="transactionManager"
class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"></beans:bean>
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="oracle.jdbc.OracleDriver"/>
<beans:property name="url" value="jdbc:oracle:thin:#//localhost:1521/xe"/>
<beans:property name="username" value="system"/>
<beans:property name="password" value="1234"/>
</beans:bean>
<beans:bean id="jobRepository" class="org.springframework.batch.core.repository.support.SimpleJobRepository">
<beans:constructor-arg>
<beans:bean class="org.springframework.batch.core.repository.dao.MapJobInstanceDao"/>
</beans:constructor-arg>
<beans:constructor-arg>
<beans:bean class="org.springframework.batch.core.repository.dao.MapJobExecutionDao"/>
</beans:constructor-arg>
<beans:constructor-arg>
<beans:bean class="org.springframework.batch.core.repository.dao.MapStepExecutionDao"/>
</beans:constructor-arg>
<beans:constructor-arg>
<beans:bean class="org.springframework.batch.core.repository.dao.MapExecutionContextDao"/>
</beans:constructor-arg>
</beans:bean>
<beans:bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<beans:property name="jobRepository" ref="jobRepository"/>
<beans:property name="taskExecutor">
<beans:bean class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>
</beans:property>
</beans:bean>
<beans:bean id="myTasklet" class="batch.MyTasklet"></beans:bean>
<job id="job" job-repository="jobRepository">
<step id="test" >
<tasklet ref="myTasklet"/>
</step>
</job>
</beans:beans>
any ideas?
This is a workaround if I don't want to touch my weblogic.xml, but I can't use the new features of Spring Batch.
I have to use Spring Batch 2.2.7 to work with Weblogic 12.1.3, I created again a project with maven to find the dependencies. So the dependencies should be as follows:
aopalliance-1.0.jar
commons-logging-1.1.3.jar
jettison-1.1.jar
spring-aop-3.2.9.RELEASE.jar
spring-batch-core-2.2.7.RELEASE.jar
spring-batch-infrastructure-2.2.7.RELEASE.jar
spring-beans-3.2.9.RELEASE.jar
spring-context-3.2.9.RELEASE.jar
spring-core-3.2.9.RELEASE.jar
spring-expression-3.2.9.RELEASE.jar
spring-retry-1.0.2.RELEASE.jar
spring-tx-3.2.9.RELEASE.jar
spring-web-3.2.9.RELEASE.jar
spring-webmvc-3.2.9.RELEASE.jar
xpp3_min-1.1.4c.jar
xstream-1.3.jar
I hope there is a supported version of Spring Batch soon. I found that Weblogic already supports Spring but I don't know in what level.
I think you must use Filtering Classloading including the version of Spring you need.
http://docs.oracle.com/cd/E12839_01/web.1111/e13706/classloading.htm
If it is a war file then add true to weblogic.xml
That version is supported in WLS 12.1.3 :
WLS 12.1.3 Spring Framework versions 3.0.x, 3.1.x, and 4.0.x (note that version 3.2.x is not supported) (not-supported doesn't mean won't work).
I would like to perform authentification with SPNEGO. I use:
spring-core-3.1.0.RELEASE.jar
spring-security-core-3.1.0.RELEASE.jar
spring-security-kerberos-core-1.0.0.M2.jar
package codec from spring
core security 3.0.7 (https://jira.springsource.org/browse/SES-98)
tomcat
My Config file looks like the following. When I try to authentificate with the above libraries I got the following exception.
Had someone the same problem and handled it?
Config file (taken from spring security kerberos example):
<?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:sec="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<!-- This configuration uses SPNEGO by default, but one could also use a form if he directly goes to /login.html -->
<sec:http entry-point-ref="spnegoEntryPoint" use-expressions="true">
<sec:intercept-url pattern="/secure/**" access="isAuthenticated()" />
<sec:custom-filter ref="spnegoAuthenticationProcessingFilter"
position="BASIC_AUTH_FILTER" />
<sec:form-login login-page="/login.html" default-target-url="/secure/index.jsp"/>
</sec:http>
<bean id="spnegoEntryPoint"
class="org.springframework.security.extensions.kerberos.web.SpnegoEntryPoint" />
<bean id="spnegoAuthenticationProcessingFilter"
class="org.springframework.security.extensions.kerberos.web.SpnegoAuthenticationProcessingFilter">
<property name="authenticationManager" ref="authenticationManager" />
</bean>
<sec:authentication-manager alias="authenticationManager">
<sec:authentication-provider ref="kerberosServiceAuthenticationProvider" /> <!-- Used with SPNEGO -->
<sec:authentication-provider user-service-ref="dummyUserDetailsService"/> <!-- Used with form login -->
</sec:authentication-manager>
<bean id="kerberosServiceAuthenticationProvider"
class="org.springframework.security.extensions.kerberos.KerberosServiceAuthenticationProvider">
<property name="ticketValidator">
<bean
class="org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator">
<property name="servicePrincipal" value="HTTP/xxx.xx.xx.xx#XX-XXX.XXX.XX" />
<!-- Setting keyTabLocation to a classpath resource will most likely not work in a Java EE application Server -->
<!-- See the Javadoc for more information on that -->
<property name="keyTabLocation" value="file:/home/xxxxx/conf/krb5/krb5.keytab" />
<property name="debug" value="true" />
</bean>
</property>
<property name="userDetailsService" ref="dummyUserDetailsService" />
</bean>
<!-- This bean definition enables a very detailed Kerberos logging -->
<bean
class="org.springframework.security.extensions.kerberos.GlobalSunJaasKerberosConfig">
<property name="debug" value="true" />
</bean>
<!--
Just returns the User authenticated by Kerberos and gives him the
ROLE_USER
-->
<bean id="dummyUserDetailsService"
class="org.springframework.security.extensions.kerberos.sample.DummyUserDetailsService" />
</beans>
Exception which I got:
org.springframework.security.authentication.BadCredentialsException: Kerberos validation not succesfull
at org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator.validateTicket(SunJaasKerberosTicketValidator.java:69)
at org.springframework.security.extensions.kerberos.KerberosServiceAuthenticationProvider.authenticate(KerberosServiceAuthenticationProvider.java:86)
at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
at org.springframework.security.extensions.kerberos.web.SpnegoAuthenticationProcessingFilter.doFilter(SpnegoAuthenticationProcessingFilter.java:131)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.ha.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:219)
at org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:333)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.security.PrivilegedActionException: GSSException: Failure unspecified at GSS-API level (Mechanism level: Invalid argument (400) - Cannot find key of appropriate
type to decrypt AP REP - RC4 with HMAC)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator.validateTicket(SunJaasKerberosTicketValidator.java:67)
... 29 more
Caused by: GSSException: Failure unspecified at GSS-API level (Mechanism level: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC)
at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:778)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:342)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:285)
at sun.security.jgss.spnego.SpNegoContext.GSS_acceptSecContext(SpNegoContext.java:871)
at sun.security.jgss.spnego.SpNegoContext.acceptSecContext(SpNegoContext.java:544)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:342)
at sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:285)
at org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator$KerberosValidateAction.run(SunJaasKerberosTicketValidator.java:146)
at org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator$KerberosValidateAction.run(SunJaasKerberosTicketValidator.java:136)
... 32 more
Caused by: KrbException: Invalid argument (400) - Cannot find key of appropriate type to decrypt AP REP - RC4 with HMAC
at sun.security.krb5.KrbApReq.authenticate(KrbApReq.java:273)
at sun.security.krb5.KrbApReq.<init>(KrbApReq.java:144)
at sun.security.jgss.krb5.InitSecContextToken.<init>(InitSecContextToken.java:108)
at sun.security.jgss.krb5.Krb5Context.acceptSecContext(Krb5Context.java:761)
... 40 more
I found the problem.
Spring-security-kerbos requires path to keytab file as "Resource String" (details: http://static.springsource.org/spring/docs/3.0.x/reference/resources.html).
When I set path as "file:/home/xxxxx/conf/krb5/krb5.keytab" then application runs but I think that it can't open the file later and Kerberos cant load any key. Unfortunately Log from Kerberos is not so clear.
When I set path as "/home/xxxxx/conf/krb5/krb5.keytab" I got the following exception
Caused by: java.io.FileNotFoundException: ServletContext resource [/home/xxxxx/conf/krb5/krb5.keytab] cannot be resolved to URL because it does not exist
Solution for this issue can be the fix in the file SunJaasKerberosTicketValidator.java:
private String keyTabLocation;
LoginConfig loginConfig = new LoginConfig(keyTabLocation, servicePrincipal, debug);
instead of:
private Resource keyTabLocation;
LoginConfig loginConfig = new LoginConfig(keyTabLocation.getURL().toExternalForm(), servicePrincipal, debug);
With this fix everything works. We can set path to file in format "/home/xxxxx/conf/krb5/krb5.keytab"
If someone knows more details about it, please write it here.
At least Java 7 is not (or, my version is not) able to handle the "file:" prefix: See this link. I had to make the same modification to Spring sources as you did. Thanks, this was helpful. Wasted half a week on trying different configurations.
I am trying to connect to MySQL db using JPA and Spring. I am new to Spring.
I have added this to my config file where all the beans are defined:
<jee:jndi-lookup id="myEmf" jndi-name="hello-world"/>
<bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myEmf"/>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
</bean>
Also Here is my persistence.xml, my persistence unit name is "hello-world".
<persistence-unit name="hello-world" transaction-type="RESOURCE_LOCAL">
org.hibernate.ejb.HibernatePersistence
When I try to instantiate the object, it throws me error.
Thanks,
Sara.
Update, error:
2012/08/28 23-25-56,993:8a4cd57fec4d0:ERR:ERROR[Error parsing XML: XML InputStream(1) A pseudo attribute name is expected.] 2012-08-28
23:25:56,994 ERROR
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sara].[jsp]:704]
: Servlet.service() for servlet jsp threw exception
javax.persistence.PersistenceException: Unable to configure
EntityManagerFactory at
org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
at
org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at com.paypal.sara.sara.web.sample.mvc.Main.getPoints(Main.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599) at
org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:314) at
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145) at
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
at
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190)
I found out what the problem was! Such a simple one but took my time.
I had <?xml version="1.0" encoding="UTF-8"> instead I should have had <?xml version="1.0" encoding="UTF-8"?>.
Thanks for your time.
i have a problem with a small spring project, it worked fine until i tried to add the Validation framework
So i addedd adding the jar: spring-modules-validation0.8.jar
And the following in 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 -->
<!-- Enable annotation-based validation using Bean Validation Framework -->
<!-- Using these instead of vld namespace to prevent Eclipse from complaining -->
<bean id="configurationLoader"
class="org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader"/>
<bean id="validator" class="org.springmodules.validation.bean.BeanValidator" mvc:configurationLoader-ref="configurationLoader"/>
<!-- Load messages -->
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource"
mvc:basenames="errors"/>
<!-- Scans within the base package of the application for #Components to configure as beans -->
<!-- #Controller, #Service, #Configuration, etc. -->
<context:component-scan base-package="controllers" />
<!-- Enables the Spring MVC #Controller programming model -->
<mvc:annotation-driven />
</beans>
it now throws:
javax.servlet.ServletException: Servlet.init() for servlet appServlet threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:655)
root cause
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionDecorator for attribute [configurationLoader-ref]
Offending resource: ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
org.springframework.beans.factory.parsing.FailFastProblemReporter.fatal(FailFastProblemReporter.java:59)
org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:68)
org.springframework.beans.factory.parsing.ReaderContext.fatal(ReaderContext.java:55)
org.springframework.beans.factory.xml.NamespaceHandlerSupport.findDecoratorForNode(NamespaceHandlerSupport.java:119)
org.springframework.beans.factory.xml.NamespaceHandlerSupport.decorate(NamespaceHandlerSupport.java:97)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateIfRequired(BeanDefinitionParserDelegate.java:1372)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateBeanDefinitionIfRequired(BeanDefinitionParserDelegate.java:1351)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.decorateBeanDefinitionIfRequired(BeanDefinitionParserDelegate.java:1339)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:261)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:154)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:133)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:458)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:388)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
java.lang.Thread.run(Thread.java:655)
I have tried to follow the stacktrace but i cannot find the BeanDefinitionDecorator
Do you have any hints?
Thank you
The spring module validation configurations you have in the servlet-context.xml seem to be the same with the contact-servlet.xml found in this tutorial with the only difference being the namespace of the configurationLoader-ref. Have a look in this tutorial to see the further setup, it has worked for me.