HotswapProjects / HotswapAgent

Java unlimited redefinition of classes at runtime.
GNU General Public License v2.0
2.36k stars 493 forks source link

HotswapSpringCallback not working properly #259

Open ferluck opened 6 years ago

ferluck commented 6 years ago

Hello team, first of all, awesome work you've been doing with the HotSwapAgent, it is really helpful.

I've been trying to utilize it with an application called Hybris, which makes heavy use of Spring, but I'm facing the following challenge with the Spring module enabled:

ERROR [TaskExecutor-master-63] [AfterSessionCreationListener] Error while handling after session creation event. java.lang.NullPointerException: null at de.hybris.platform.servicelayer.i18n.impl.DefaultI18NService.getCurrentLocale(DefaultI18NService.java:116) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.getStdLocale(ItemModelConverter.java:2045) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$AttributesToLoad.<init>(ItemModelConverter.java:1909) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.load(ItemModelConverter.java:482) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.load(ItemModelConverter.java:1) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.doLoad(DefaultModelService.java:968) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.get(DefaultModelService.java:283) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.getModelForPersistentValue(DefaultModelService.java:1015) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.model.impl.AbstractModelService.toModelLayer(AbstractModelService.java:94) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.model.impl.AbstractModelService$HOTSWAPAGENT_$$FastClassBySpringCGLIB$$f14fe153.invoke(<generated>) ~[coreserver.jar:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.16.RELEASE.jar:4.3.16.RELEASE] at HotswapSpringCallback_1796692748.intercept(HotswapSpringCallback_1796692748.java) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService$HOTSWAPAGENT_$$EnhancerBySpringCGLIB$$e7689e0_3.toModelLayer(<generated>) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.session.impl.DefaultSession.getAttribute(DefaultSession.java:59) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.session.impl.DefaultSessionService.getAttribute(DefaultSessionService.java:179) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.session.impl.DefaultSessionService$HOTSWAPAGENT_$$FastClassBySpringCGLIB$$f29e59d7.invoke(<generated>) ~[coreserver.jar:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.16.RELEASE.jar:4.3.16.RELEASE] at HotswapSpringCallback_1796692748.intercept(HotswapSpringCallback_1796692748.java) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.session.impl.DefaultSessionService$HOTSWAPAGENT_$$EnhancerBySpringCGLIB$$17539315_3.getAttribute(<generated>) ~[coreserver.jar:?] at de.hybris.platform.servicelayer.user.impl.DefaultUserService.getCurrentUser(DefaultUserService.java:131) ~[coreserver.jar:?] at de.hybris.platform.b2b.listeners.AfterSessionCreationListener.executeEvent(AfterSessionCreationListener.java:121) ~[b2bcommerceserver.jar:?] at de.hybris.platform.b2b.listeners.AfterSessionCreationListener.onEvent(AfterSessionCreationListener.java:52) [b2bcommerceserver.jar:?] at de.hybris.platform.b2b.listeners.AfterSessionCreationListener.onEvent(AfterSessionCreationListener.java:1) [b2bcommerceserver.jar:?] at de.hybris.platform.servicelayer.event.impl.AbstractEventListener.onApplicationEvent(AbstractEventListener.java:65) [coreserver.jar:?] at de.hybris.platform.servicelayer.event.impl.AbstractEventListener.onApplicationEvent(AbstractEventListener.java:1) [coreserver.jar:?] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) [spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) [spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393) [spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE] at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347) [spring-context-4.3.16.RELEASE.jar:4.3.16.RELEASE] at de.hybris.platform.spring.ctx.CloseAwareApplicationContext.publishEvent(CloseAwareApplicationContext.java:107) [coreserver.jar:?] at de.hybris.platform.servicelayer.event.impl.SpringEventSender.sendEvent(SpringEventSender.java:33) [coreserver.jar:?] at de.hybris.platform.servicelayer.event.impl.PlatformClusterEventSender.sendEvent(PlatformClusterEventSender.java:60) [coreserver.jar:?] at de.hybris.platform.servicelayer.event.impl.DefaultEventService.publishEvent(DefaultEventService.java:75) [coreserver.jar:?] at de.hybris.platform.servicelayer.internal.jalo.ServicelayerManager.afterSessionCreation(ServicelayerManager.java:229) [coreserver.jar:?] at de.hybris.platform.jalo.JaloSession.notifyExtensionsAfterSessionCreation(JaloSession.java:2318) [coreserver.jar:?] at de.hybris.platform.jalo.JaloSession.createInstance(JaloSession.java:253) [coreserver.jar:?] at de.hybris.platform.jalo.JaloConnection.createSession(JaloConnection.java:752) [coreserver.jar:?] at de.hybris.platform.jalo.JaloConnection.createAnonymousCustomerSession(JaloConnection.java:664) [coreserver.jar:?] at de.hybris.platform.jalo.JaloConnection.createAnonymousCustomerSession(JaloConnection.java:646) [coreserver.jar:?] at de.hybris.platform.jalo.JaloSession.getCurrentSession(JaloSession.java:851) [coreserver.jar:?] at de.hybris.platform.jalo.JaloSession.getCurrentSession(JaloSession.java:825) [coreserver.jar:?] at de.hybris.platform.task.impl.DefaultTaskService.getScheduledItem(DefaultTaskService.java:1432) [processingserver.jar:?] at de.hybris.platform.task.impl.DefaultTaskService.process(DefaultTaskService.java:1483) [processingserver.jar:?] at de.hybris.platform.task.impl.DefaultTaskService.processInTenant(DefaultTaskService.java:1462) [processingserver.jar:?] at de.hybris.platform.task.impl.DefaultTaskService$5.run(DefaultTaskService.java:1341) [processingserver.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152] Exception in thread "TaskExecutor-master-63-TriggerTask [8796093088694]" java.lang.NullPointerException at de.hybris.platform.servicelayer.i18n.impl.DefaultI18NService.getCurrentLocale(DefaultI18NService.java:116) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.getStdLocale(ItemModelConverter.java:2045) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$AttributesToLoad.<init>(ItemModelConverter.java:1909) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.load(ItemModelConverter.java:482) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.load(ItemModelConverter.java:1) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.doLoad(DefaultModelService.java:968) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.get(DefaultModelService.java:283) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService$HOTSWAPAGENT_$$FastClassBySpringCGLIB$$3e704ac8_4.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at HotswapSpringCallback_1796692748.intercept(HotswapSpringCallback_1796692748.java) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService$HOTSWAPAGENT_$$EnhancerBySpringCGLIB$$e7689e0_43.get(<generated>) at de.hybris.platform.task.impl.DefaultTaskService.processTask(DefaultTaskService.java:1563) at de.hybris.platform.task.impl.DefaultTaskService.process(DefaultTaskService.java:1493) at de.hybris.platform.task.impl.DefaultTaskService.processInTenant(DefaultTaskService.java:1462) at de.hybris.platform.task.impl.DefaultTaskService$5.run(DefaultTaskService.java:1341) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

As an additional note, hotswap continues to work normally. Anybody faced this yet?

Regards,

Fernando

siddhartha-bagwal commented 6 years ago

Hi Fernando,

I am also facing exactly same issues did you find any solution ?

Environment : Hybris 5.2 Java 1.7 Agent version : hotswap-agent-1.3.0. DCEVM : DCEVM-full-7u79-installer.jar

Logs :

java.lang.NullPointerException at de.hybris.platform.servicelayer.i18n.impl.DefaultI18NService.getCurrentLocale(DefaultI18NService.java:117) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.getStdLocale(ItemModelConverter.java:1709) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter$AttributesToLoad.(ItemModelConverter.java:1573) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.load(ItemModelConverter.java:379) at de.hybris.platform.servicelayer.internal.converter.impl.ItemModelConverter.load(ItemModelConverter.java:1) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.doLoad(DefaultModelService.java:836) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService.get(DefaultModelService.java:267) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService$HOTSWAPAGENT_$$FastClassBySpringCGLIB$$3e704ac8_2.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at HotswapSpringCallback_1796692748.intercept(HotswapSpringCallback1796692748.java) at de.hybris.platform.servicelayer.internal.model.impl.DefaultModelService$HOTSWAPAGENT$$EnhancerBySpringCGLIB$$f19d0518_15.get() at de.hybris.platform.servicelayer.type.daos.impl.DefaultTypeDao.findTypeByCode(DefaultTypeDao.java:84) at de.hybris.platform.servicelayer.type.impl.DefaultTypeService.getTypeForCode(DefaultTypeService.java:157) at de.hybris.platform.solrfacetsearch.solr.impl.DefaultSolrCoresService.typeExists(DefaultSolrCoresService.java:206) at de.hybris.platform.solrfacetsearch.solr.impl.DefaultSolrCoresService.getAllCoreRecords(DefaultSolrCoresService.java:128) at de.hybris.platform.solrfacetsearch.solr.impl.DefaultSolrCoresService$1.afterTenantStartUp(DefaultSolrCoresService.java:291) at de.hybris.platform.core.AbstractTenant.executeStartupNotifyIfNecessary(AbstractTenant.java:846) at de.hybris.platform.core.AbstractTenant.executeInitsIfNecessary(AbstractTenant.java:1252) at de.hybris.platform.core.Registry.assureTenantStarted(Registry.java:591) at de.hybris.platform.core.Registry.activateTenant(Registry.java:632) at de.hybris.platform.core.Registry.setCurrentTenant(Registry.java:476) at de.hybris.platform.core.Registry.activateMasterTenant(Registry.java:539) at de.hybris.platform.core.Registry.startup(Registry.java:420) at de.hybris.platform.spring.HybrisContextLoaderListener.startRegistry(HybrisContextLoaderListener.java:181) at de.hybris.platform.spring.HybrisContextLoaderListener.loadParentContext(HybrisContextLoaderListener.java:97) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:303) at de.hybris.platform.spring.HybrisContextLoaderListener.initWebApplicationContext(HybrisContextLoaderListener.java:82) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) 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$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

HOTSWAP AGENT: 16:39:31.049 INFO (org.hotswap.agent.plugin.spring.SpringPlugin) - Spring plugin initialized - Spring core version '3.2.8.RELEASE' ERROR [Task-master-poll] [HybrisApplicationEventMulticaster]

Thanks, Siddhartha

leantunes commented 6 years ago

Hello @ferluck, any updates on this issue? I'm facing the same problem here.

alans-ciant commented 6 years ago

Hello, any update or solution? I'm facing the same problem too...

Environment : Hybris 6.5 Java 1.8 Agent version : hotswap-agent-1.3.0. DCEVM : DCEVM-8u181-installer

amstallion93 commented 6 years ago

I am seeing same issue .

Environment: Hybris 6.6 Java 1.8 Agent version : hotswap-agent-1.3.0 DCEVM : DCEVM-8u152-installer

archit123 commented 6 years ago

We are in a production environment with Hybris. I recently suggested DCEVM alternative to save time and boost productivity.

However, a team of 6 hybris developers have reported the same issue mentioned this thread Following are the specs:

  1. Hybris 6.6
  2. jdk 8u121
  3. Agent version: hotswap-agent-1.3.0
  4. DCEVM : DCEVM-8u181-installer-build2

Please let us know if anyone has any thoughts around it. Thanks!

ChintalaVenkat commented 6 years ago

Hello I am facing same issue..if any one have the solution could you please share it.

abadano commented 5 years ago

Hello Guys, I was facing the issue decribed above (using Windows OS) and I resolved the issue following this guide: https://blogs.sap.com/2018/11/01/hotswap-with-hybris-a-free-open-source-alternative-to-jrebel/

Please notice the parameter that you need to pass in the tomcat.debugjavaoptions property and notice last advice at the end of the article:

  1. Do not provide the absolute path to Javaagent, instead use {platformhome}. Absolute path to jar file may cause problems on Windows. (JavaAgent is set in Step 4).