Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue SPR-12238 not working on IBM java_1.7_64 [SPR-12465] #17071

Closed
spring-projects-issues opened this issue Nov 24, 2014 · 14 comments
Closed
Labels
status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 24, 2014

Chandan opened SPR-12465 and commented

I updated my Spring to 41.2, but it's throwing error about missing method setRemoveOnCancelPolicy in ThreadPoolTaskSchedulerfailing.

I am using IBM provided Java (version java_1.7_64). and my container is Web Sphere. Asked here as well http://stackoverflow.com/questions/27107825/spring-build-4-1-2-is-throwing-error-about-missing-method-setremoveoncancelpolic. Following is the stack trace

org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler org.springframework.web.socket.config.annotation.WebSocketConfigurationSupport.defaultSockJsTaskScheduler()] threw exception; nested exception is java.lang.NoSuchMethodError: org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.setRemoveOnCancelPolicy(Z)V
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1025)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:921)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.jav


Affects: 4.1.2

Reference URL: http://stackoverflow.com/questions/27107825/spring-build-4-1-2-is-throwing-error-about-missing-method-setremoveoncancelpolic

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Could you please double-check whether you upgraded all your Spring Framework modules to 4.1.2? In particular spring-context next to spring-websocket?

Looking at the stacktrace, it seems like the 4.1.2 version of spring-websocket is trying to use the ThreadPoolTaskScheduler class from an older version of spring-context...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 24, 2014

Chandan commented

Yes, all jars are updated. Maven entries
<properties>
<org.springframework-version>4.1.2.RELEASE</org.springframework-version>
<tomcat-version>8.0-SNAPSHOT</tomcat-version>
<spring.integration.version>3.0.0.RELEASE</spring.integration.version>
<spring.security.version>3.2.4.RELEASE</spring.security.version>
</properties>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework-version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${org.springframework-version}</version>
</dependency>

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Do you possibly have older versions of the jars around, brought onto your classpath transitively? The exception clearly indicates a mismatch between the jar versions there...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

This is all the spring related JAR (Have excluded Hibernate, JPA etc. ) --Spring Integration, Spring data JPA and Spring security module are at different version, else all at same version number.

BTW, I have deployed it on tomcat and standard JDK (oracle) -it works there, only issue with IBM Java in Web Sphere container

<properties>
	<org.springframework-version>4.1.2.RELEASE</org.springframework-version>
	<spring.integration.version>3.0.0.RELEASE</spring.integration.version>
	<spring.security.version>3.2.4.RELEASE</spring.security.version>
</properties>

<dependencies>

<!-- Spring Security Starts-->

	<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-web</artifactId>
		<version>${spring.security.version}</version>
	</dependency>

	<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-config</artifactId>
		<version>${spring.security.version}</version>
	</dependency>
	<!-- Spring Security JSP Taglib -->
	<dependency>
		<groupId>org.springframework.security</groupId>
		<artifactId>spring-security-taglibs</artifactId>
		<version>${spring.security.version}</version>
	</dependency>

<!-- Spring Security Ends--><!-- Spring core and Spring MVC -->

	<dependency>
		 <groupId>org.springframework</groupId>
		 <artifactId>spring-core</artifactId>
		 <version>${org.springframework-version}</version>
	</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>${org.springframework-version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${org.springframework-version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>${org.springframework-version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>${org.springframework-version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-expression</artifactId>
    <version>${org.springframework-version}</version>
</dependency>

	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-context</artifactId>
		<version>${org.springframework-version}</version>
		<exclusions>
			<exclusion>
				<groupId>commons-logging</groupId>
				<artifactId>commons-logging</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-web</artifactId>
		<version>${org.springframework-version}</version>
	</dependency>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-webmvc</artifactId>
		<version>${org.springframework-version}</version>
	</dependency>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-websocket</artifactId>
		<version>${org.springframework-version}</version>
	</dependency>

<!-- SPRING DATA START-->

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.2.0.RELEASE</version>
</dependency>

<!-- SPRING DATA END -->

<dependency> 
	<groupId>org.aspectj</groupId> 
	<artifactId>aspectjweaver</artifactId> 
	<version>1.6.11</version> 
</dependency>

<!-- SPRING AOP ENDS--->

	<!-- Spring Integration Dependency -->
	<dependency>
		<groupId>org.springframework.integration</groupId>
		<artifactId>spring-integration-core</artifactId>
		<version>${spring.integration.version}</version>
	</dependency>
	<!-- SI dependency Ends -->
	
</dependencies>

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

On review, I still have no idea why you would see such a NoSuchMethodError between Spring jars - since it is clearly referring from spring-websocket to spring-context there, which we always co-release, so they can't be out of sync as long as you're declaring the same Spring version there, which you do as expected.

Your dependency declarations look alright, except maybe for AspectJ which you should really upgrade to 1.7.4 or even 1.8.4 at this point. However, that won't be the cause of that NoSuchMethodError... There is definitely an outdated spring-context jar on your WebSphere classpath; I just wonder where it is hiding?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

Can spring-security be the issue, current release is 3.2.5.RELEASE which has dependencies on 3.2.8 versions of many Jar ..

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

BTW, I confirmed, there is no other APP using spring, in fact its the only app sitting inside WebSphere. Atleast there is no possibility of picking it up outside lib, if it helps I can publish the exact versions from lib folder

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

List of Jars
spring-websocket-4.1.2.RELEASE
spring-webmvc-4.1.2.RELEASE
spring-web-4.1.2.RELEASE
spring-tx-3.1.2.RELEASE
spring-security-web-3.2.5.RELEASE
spring-security-core-3.2.5.RELEASE
spring-security-config-3.2.5.RELEASE
spring-orm-3.1.2.RELEASE
spring-jdbc-3.1.2.RELEASE
spring-expression-3.2.8.RELEASE
spring-data-jpa-1.2.0.RELEASE
spring-data-commons-core-1.4.0.RELEASE
spring-core-4.1.2.RELEASE
spring-context-4.1.2.RELEASE
spring-beans-3.2.8.RELEASE
spring-aop-3.2.8.RELEASE

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

Also tried BOM approach for spring, but no luck
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.1.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

Did some further testing, it's not only for 4.1.2., it for 4.0.6 and above. If I use 4.0.1 or 4.0.2 ..it works perfect and there is no error.
My question is -if it's class path issue and as your guess is its loading from some external path (In my war all libs are at same version) -so why this behavior is for 4.0.6 and above not for 4.0.1 , .2 or .3?

Badly stuck on that, need some pointers to move ahead. Any Idea or checklist which I can perform on Websphere to figure out conflict?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 27, 2014

Juergen Hoeller commented

We introduced that call from WebSocketConfigurationSupport to ThreadPoolTaskScheduler.setRemoveOnCancelPolicy into 4.0.6 as well (see #16537). So if you have an old version of spring-context.jar on your classpath, you'd see the same effect with 4.0.6+, just like with 4.1+.

Generally, an obvious problem is that you have old Spring Framework jars on the classpath. None of those pre-4.1.2 jars should be there: spring-aop-3.2.8, spring-expression-3.2.8, spring-jdbc-3.1.2, spring-orm-3.1.2, spring-tx-3.1.2... Those are all outdated and should point to the 4.1.2 versions instead.

That said, funnily enough, you do have spring-context-4.1.2 on your classpath, so the right version for the actual jar affected here. Nevertheless, your stacktrace clearly indicates a call to an old version of spring-context.jar... You could verify at runtime where the ThreadPoolTaskExecutor class has been loaded from, checking ThreadPoolTaskExecutor.class.getClassLoader() etc.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Chandan commented

I used BOM and now following are the libs exactly on same version

spring-websocket-4.1.2.RELEASE
spring-webmvc-4.1.2.RELEASE
spring-web-4.1.2.RELEASE
spring-tx-4.1.2.RELEASE
spring-orm-4.1.2.RELEASE
spring-jdbc-4.1.2.RELEASE
spring-expression-4.1.2.RELEASE
spring-core-4.1.2.RELEASE
spring-context-4.1.2.RELEASE
spring-beans-4.1.2.RELEASE
spring-aop-4.1.2.RELEASE

Additionally Spring Security Libs (Current GA)
spring-security-web-3.2.5.RELEASE
spring-security-taglibs-3.2.5.RELEASE
spring-security-core-3.2.5.RELEASE
spring-security-config-3.2.5.RELEASE
spring-security-acl-3.2.5.RELEASE

This runs me into another issues,
java.lang.NoSuchMethodError: org/springframework/beans/factory/annotation/InjectionMetadata.needsRefresh(Lorg/springframework/beans/factory/annotation/InjectionMetadata;Ljava/lang/Class;)Z
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:383)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:332)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:840)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:741)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1686)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:746)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)

According to issue reported here http://stackoverflow.com/questions/24674760/org-springframework-beans-factory-annotation-injectionmetadata-needsrefresh , it is again is due to Spring 4.1 dependency ..

Now all the Spring Jars are at same level! Just reiterating, no other app is deployed in container neither WebSphere has any dependency on Spring .. following are my JPA related JARs -but acording to above link it's due to spring 4.* mismatch

DB related JARs
spring-data-jpa-1.2.0.RELEASE
spring-data-commons-core-1.4.0.RELEASE
hibernate-jpa-2.0-api-1.0.1.Final
hibernate-entitymanager-4.1.9.Final
hibernate-core-4.1.9.Final
hibernate-commons-annotations-4.0.1.Final

Since my app is not getting deployed, I am unable to get any details of which class loaders used

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

A personal note: Sorry for your suffering there... This is the first time in a long while that I'm hearing about so much class loader setup pain!

This is a different kind of mismatch now: This time, it's with an old version of spring-beans.jar... Apparently, your new spring-context.jar is being picked up now but an old version of spring-beans is still hiding somewhere and getting picked up in favor of your application-provided spring-beans.jar... To be on the safe side, could you double-check your class loader settings to be PARENT_LAST (or equivalent in the WebSphere world), so that your application-provided jars will override any other jars elsewhere in the server's class loader hierarchy?

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug A general bug label Jan 11, 2019
@rstoyanchev rstoyanchev added status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process and removed status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 11, 2019
@spring-projects-issues
Copy link
Collaborator Author

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: bulk-closed An outdated, unresolved issue that's closed in bulk as part of a cleaning process
Projects
None yet
Development

No branches or pull requests

2 participants