Hotswapagent not working spring mvc and weblogic 12c

293 views
Skip to first unread message

vidyasagar sreerama

unread,
May 15, 2017, 2:19:00 AM5/15/17
to HotswapAgent
Hi,

I was trying hotswapagent with a sample spring application with just one controller. I have defined hotswap-agent.properties in src/main/resources folder with single property extraClasspath=target/classes.

I have started weblogic with the following options in setDomainEnv.cmd
set JAVA_OPTIONS=%JAVA_OPTIONS% -XXaltjvm=dcevm -javaagent:%DOMAIN_HOME%\hotswap-agent-1.0.jar

Weblogic starts with proper hotswapagent initialization as shown below. debug port i defined is 8453

HOTSWAP AGENT: 17:33:25.219 INFO (org.hotswap.agent.HotswapAgent) - Loading Hots
wap agent {1.0} - unlimited runtime class redefinition.
HOTSWAP AGENT: 17:33:27.325 INFO (org.hotswap.agent.config.PluginRegistry) - Dis
covered plugins: [Hotswapper, WatchResources, AnonymousClassPatch, ClassInitPlug
in, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomca
t, ZK, Logback, Log4j2, MyFaces, Mojarra, Seam, ELResolver, WildFlyELResolver, O
sgiEquinox, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike,
 JavaBeans]
Listening for transport dt_socket at address: 8453

I am not using Run As -> Run On Server from within Eclipse. I am building the WAR file with eclipse->export WAR and deploying it using the WebLogic console, and then modifying the code by putting application in debug mode.

Here is the log i get when i deploy the application WAR in weblogic via console. I see the spring plugin initialized correctly and registers my controller as well, but I do not see the controller changes which i do in debug mode instantly

May 15, 2017 11:39:15 AM org.springframework.web.context.ContextLoader initWebAp
plicationContext
INFO: Root WebApplicationContext: initialization started
May 15, 2017 11:39:16 AM org.springframework.context.support.AbstractApplication
Context prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon May 15 11:39:16 I
ST 2017]; root of context hierarchy
HOTSWAP AGENT: 11:39:16.407 INFO (org.hotswap.agent.config.PluginRegistry) - Plu
gin 'org.hotswap.agent.plugin.spring.SpringPlugin' initialized in ClassLoader 'w
eblogic.utils.classloaders.ChangeAwareClassLoader@6e58ad8e finder: weblogic.util
s.classloaders.CodeGenClassFinder@15bb9930 annotation: CounterWebApp@CounterWebA
pp.war'.
HOTSWAP AGENT: 11:39:16.416 INFO (org.hotswap.agent.plugin.spring.SpringPlugin)
- Spring plugin initialized - Spring core version '4.1.1.RELEASE'
May 15, 2017 11:39:16 AM org.springframework.beans.factory.xml.XmlBeanDefinition
Reader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-di
spatcher-servlet.xml]
HOTSWAP AGENT: 11:39:17.107 INFO (org.hotswap.agent.plugin.spring.SpringPlugin)
- Registering basePackage com.mkyong.controller
May 15, 2017 11:39:17 AM org.springframework.beans.factory.annotation.AutowiredA
nnotationBeanPostProcessor <init>
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowirin
g
May 15, 2017 11:39:18 AM org.springframework.web.servlet.handler.AbstractHandler
MethodMapping registerHandlerMethod
INFO: Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],cu
stom=[]}" onto public java.lang.String com.mkyong.controller.BaseController.welc
ome(org.springframework.ui.ModelMap)
May 15, 2017 11:39:18 AM org.springframework.web.servlet.handler.AbstractHandler
MethodMapping registerHandlerMethod
INFO: Mapped "{[/{name}],methods=[GET],params=[],headers=[],consumes=[],produces
=[],custom=[]}" onto public java.lang.String com.mkyong.controller.BaseControlle
r.welcomeName(java.lang.String,org.springframework.ui.ModelMap)
May 15, 2017 11:39:19 AM org.springframework.web.servlet.mvc.method.annotation.R
equestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for @ControllerAdvice: Root WebApplicationContext: startup date [M
on May 15 11:39:16 IST 2017]; root of context hierarchy
May 15, 2017 11:39:19 AM org.springframework.web.servlet.mvc.method.annotation.R
equestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for @ControllerAdvice: Root WebApplicationContext: startup date [M
on May 15 11:39:16 IST 2017]; root of context hierarchy
May 15, 2017 11:39:19 AM org.springframework.web.context.ContextLoader initWebAp
plicationContext
INFO: Root WebApplicationContext: initialization completed in 3442 ms
May 15, 2017 11:39:19 AM org.springframework.web.servlet.FrameworkServlet initSe
rvletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization started
May 15, 2017 11:39:19 AM org.springframework.context.support.AbstractApplication
Context prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'mvc-dispatcher-servlet': s
tartup date [Mon May 15 11:39:19 IST 2017]; parent: Root WebApplicationContext
HOTSWAP AGENT: 11:39:19.530 INFO (org.hotswap.agent.plugin.spring.SpringPlugin)
- Spring plugin initialized - Spring core version '4.1.1.RELEASE'
May 15, 2017 11:39:19 AM org.springframework.beans.factory.xml.XmlBeanDefinition
Reader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/mvc-di
spatcher-servlet.xml]
HOTSWAP AGENT: 11:39:19.598 INFO (org.hotswap.agent.plugin.spring.SpringPlugin)
- Registering basePackage com.mkyong.controller
May 15, 2017 11:39:19 AM org.springframework.beans.factory.annotation.AutowiredA
nnotationBeanPostProcessor <init>
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowirin
g
May 15, 2017 11:39:19 AM org.springframework.web.servlet.handler.AbstractHandler
MethodMapping registerHandlerMethod
INFO: Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],cu
stom=[]}" onto public java.lang.String com.mkyong.controller.BaseController.welc
ome(org.springframework.ui.ModelMap)
May 15, 2017 11:39:19 AM org.springframework.web.servlet.handler.AbstractHandler
MethodMapping registerHandlerMethod
INFO: Mapped "{[/{name}],methods=[GET],params=[],headers=[],consumes=[],produces
=[],custom=[]}" onto public java.lang.String com.mkyong.controller.BaseControlle
r.welcomeName(java.lang.String,org.springframework.ui.ModelMap)
May 15, 2017 11:39:19 AM org.springframework.web.servlet.mvc.method.annotation.R
equestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for @ControllerAdvice: WebApplicationContext for namespace 'mvc-di
spatcher-servlet': startup date [Mon May 15 11:39:19 IST 2017]; parent: Root Web
ApplicationContext
May 15, 2017 11:39:19 AM org.springframework.web.servlet.mvc.method.annotation.R
equestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for @ControllerAdvice: WebApplicationContext for namespace 'mvc-di
spatcher-servlet': startup date [Mon May 15 11:39:19 IST 2017]; parent: Root Web
ApplicationContext
May 15, 2017 11:39:19 AM org.springframework.web.servlet.FrameworkServlet initSe
rvletBean
INFO: FrameworkServlet 'mvc-dispatcher': initialization completed in 446 ms

I tried by adding autoHotswap=true and autoHotswap.port=8453 properties in hotswap-agent.properties file, but still i do not see the changes while in debug mode.

I have spent lot of time on this sample project, but could not get it running. If this is successful, i can give a try on my enterprise real projects which are build and deployed to weblogic with ANT scripts.

Any help is greatly appreciated.

Thanks,
Sagar

vladimir dvorak

unread,
May 15, 2017, 12:50:19 PM5/15/17
to HotswapAgent
Do you see redefinitions on JVM level using jvm opt -XX:TraceRedefineClasses=1 ?
Reply all
Reply to author
Forward
0 new messages