Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Hotswap in Eclipse
Hotswap in Eclipse [message #189051] Thu, 09 December 2004 10:39 Go to next message
Eclipse UserFriend
Originally posted by: rajeshvenkatesan.rediffmail.com

I am currently using Eclipse 3.0 with JDK1.4.2_02.

When I compile my application(Swing) with Eclipse and then start
debugging, the hotswap of Eclipse works perfectly.

However when I remote debug some code in my weblogic server, hotswap
always fails. I am not making any schema change in my class (no new vars,
methods).

However, if I initiate the build using an ANT build file for my project
and then configure the ANT builder in eclipse, Hot Swap works fine!!

I see that there seems to be quite some difference in the class files
generated by Eclipse and that generated by ANT even in terms of size. For
eg. ANT class file is 76KB in size whereas Eclipse class files are 104 KB
in size.

Is there anyway to tweak the compiler setting of Eclipse to behave as ANT
or a normal Javac behaves so that HotSwap will work?
Re: Hotswap in Eclipse [message #189060 is a reply to message #189051] Thu, 09 December 2004 10:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.news.gmx.net

"Rajesh Venkatesan" <rajeshvenkatesan@rediffmail.com> schrieb im
Newsbeitrag news:cp9a04$s3g$1@www.eclipse.org...
> I am currently using Eclipse 3.0 with JDK1.4.2_02.
>
> When I compile my application(Swing) with Eclipse and then start
> debugging, the hotswap of Eclipse works perfectly.
>
> However when I remote debug some code in my weblogic server, hotswap
> always fails. I am not making any schema change in my class (no new
vars,
> methods).

Did you make sure that the weblogic server actually uses those classes
build by eclipse? If you're remote debugging chances are, that it does
not.

Kind regards

robert

> However, if I initiate the build using an ANT build file for my project
> and then configure the ANT builder in eclipse, Hot Swap works fine!!
>
> I see that there seems to be quite some difference in the class files
> generated by Eclipse and that generated by ANT even in terms of size.
For
> eg. ANT class file is 76KB in size whereas Eclipse class files are 104
KB
> in size.
>
> Is there anyway to tweak the compiler setting of Eclipse to behave as
ANT
> or a normal Javac behaves so that HotSwap will work?
>
>
>
Re: Hotswap in Eclipse [message #189066 is a reply to message #189060] Thu, 09 December 2004 12:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rajeshvenkatesan.rediffmail.com

Hi Robert,

Thanks for the reply....

As I have explained, if the code is compiled with the ANT builder, Eclipse
is able to do the swap. If the class has not yet been loaded by the JVM,
This will exactly be the message, and not "Schema change not implemented".
The class that is used by the server (the fact that I am actually remote
debugging the class means it has to be loaded!) was again built by ANT.
However, this should not ideally cause a problem because class files
should not have Schema Changes when there arent any, whether they are
generated by Eclipse or by any other Compiler. Infact the only change I
did was to add a System.out statement!


Regards
Rajesh V


Robert Klemme wrote:


> "Rajesh Venkatesan" <rajeshvenkatesan@rediffmail.com> schrieb im
> Newsbeitrag news:cp9a04$s3g$1@www.eclipse.org...
>> I am currently using Eclipse 3.0 with JDK1.4.2_02.
>>
>> When I compile my application(Swing) with Eclipse and then start
>> debugging, the hotswap of Eclipse works perfectly.
>>
>> However when I remote debug some code in my weblogic server, hotswap
>> always fails. I am not making any schema change in my class (no new
> vars,
>> methods).

> Did you make sure that the weblogic server actually uses those classes
> build by eclipse? If you're remote debugging chances are, that it does
> not.

> Kind regards

> robert

>> However, if I initiate the build using an ANT build file for my project
>> and then configure the ANT builder in eclipse, Hot Swap works fine!!
>>
>> I see that there seems to be quite some difference in the class files
>> generated by Eclipse and that generated by ANT even in terms of size.
> For
>> eg. ANT class file is 76KB in size whereas Eclipse class files are 104
> KB
>> in size.
>>
>> Is there anyway to tweak the compiler setting of Eclipse to behave as
> ANT
>> or a normal Javac behaves so that HotSwap will work?
>>
>>
>>
Re: Hotswap in Eclipse [message #189217 is a reply to message #189066] Fri, 10 December 2004 13:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.news.gmx.net

"Rajesh Venkatesan" <rajeshvenkatesan@rediffmail.com> schrieb im
Newsbeitrag news:cp9hg5$k2p$1@www.eclipse.org...
> Hi Robert,
>
> Thanks for the reply....
>
> As I have explained, if the code is compiled with the ANT builder,
Eclipse
> is able to do the swap. If the class has not yet been loaded by the JVM,
> This will exactly be the message, and not "Schema change not
implemented".
> The class that is used by the server (the fact that I am actually remote
> debugging the class means it has to be loaded!) was again built by ANT.
> However, this should not ideally cause a problem because class files
> should not have Schema Changes when there arent any, whether they are
> generated by Eclipse or by any other Compiler. Infact the only change I
> did was to add a System.out statement!

But you likely did change the compiler when building with ant. And that
usually leads to a change in the class file version.

I'm not sure whether I was clear enough about my earlier question. Let me
rephrase it: did you make sure that the weblogic server actually uses the
class file version built by eclipse? Maybe your ant script does some kind
of installation (i.e. copying of class files into the weblogic server)
which is not done when building with eclipse. Just a guess though.

Regards

robert

>
>
> Regards
> Rajesh V
>
>
> Robert Klemme wrote:
>
>
> > "Rajesh Venkatesan" <rajeshvenkatesan@rediffmail.com> schrieb im
> > Newsbeitrag news:cp9a04$s3g$1@www.eclipse.org...
> >> I am currently using Eclipse 3.0 with JDK1.4.2_02.
> >>
> >> When I compile my application(Swing) with Eclipse and then start
> >> debugging, the hotswap of Eclipse works perfectly.
> >>
> >> However when I remote debug some code in my weblogic server, hotswap
> >> always fails. I am not making any schema change in my class (no new
> > vars,
> >> methods).
>
> > Did you make sure that the weblogic server actually uses those classes
> > build by eclipse? If you're remote debugging chances are, that it
does
> > not.
>
> > Kind regards
>
> > robert
>
> >> However, if I initiate the build using an ANT build file for my
project
> >> and then configure the ANT builder in eclipse, Hot Swap works fine!!
> >>
> >> I see that there seems to be quite some difference in the class files
> >> generated by Eclipse and that generated by ANT even in terms of size.
> > For
> >> eg. ANT class file is 76KB in size whereas Eclipse class files are
104
> > KB
> >> in size.
> >>
> >> Is there anyway to tweak the compiler setting of Eclipse to behave as
> > ANT
> >> or a normal Javac behaves so that HotSwap will work?
> >>
> >>
> >>
>
>
Re: Hotswap in Eclipse [message #896465 is a reply to message #189217] Wed, 18 July 2012 13:05 Go to previous messageGo to next message
Roman Yurin is currently offline Roman YurinFriend
Messages: 4
Registered: July 2012
Junior Member
Hi, I have same problem. I build my project with maven, which use javac. Then project run on tomcat. I coonect with remote debugger from eclipse. Then I change some code into method and call save. Eclipse try execute hot swap, but fails with "can not change scheme" error or "Class modifiers change not implemented". The reason is that the classes, worked in the runtime and the class created from hot swap have made by different compilers. Therefore, hot swap always fails. How i can change compiler used for hot swap, from jdt compiler to javac?
Re: Hotswap in Eclipse [message #896517 is a reply to message #896465] Wed, 18 July 2012 16:02 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Given how hotswap is integrated with JDT/Debug and thus the Eclipse Java Compiler it is probably much easier to align builds so that the JDT compiler is always used. Consider adding s.t. like this to your pom:
	    <plugin>
		<artifactId>maven-compiler-plugin</artifactId>
		<configuration>
		    <source>1.6</source>
		    <target>1.6</target>
		    <compilerId>jdt</compilerId>
		</configuration>
	    </plugin>


OTOH, I'm not sure what schema difference would occur actually. While compilers have some freedom at the instruction level, the class schema should be identical. Are you sure you use the some compliance levels for both compilers, creating class files of the same version?

HTH,
Stephan
Re: Hotswap in Eclipse [message #896565 is a reply to message #896517] Wed, 18 July 2012 22:56 Go to previous messageGo to next message
Roman Yurin is currently offline Roman YurinFriend
Messages: 4
Registered: July 2012
Junior Member
I am sure, I copile my project for 1.6 java, run on Open JDK 1.6. Here's a snippet from the pom file.
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<configuration>
	  <source>1.6</source>
	  <target>1.6</target>
	  <encoding>utf-8</encoding>
	</configuration>
</plugin>

I also tried to connect (remoute) to the same server from JDeveloper (use javac 1.6) and hot swap work successful. This confirms that the problem is the difference between compilers. I found a similar description of the problem: stackoverflow.com/questions/6495959/use-the-eclipse-compiler-in-a-maven-component] and thinkinginsoftware.blogspot.com/2010/02/hot-code-replace-failed-scheme-change.html. Then I tried to use a different compiler on the side of maven to eliminate the discrepancy. Here is an example:
      <plugin>
		<artifactId>maven-compiler-plugin</artifactId>
		<configuration>
		    <source>1.6</source>
		    <target>1.6</target>
		    <compilerId>eclipse</compilerId>
		    <encoding>utf-8</encoding>
		    <optimize>true</optimize>
		</configuration>
		<dependencies>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-compiler-eclipse</artifactId>
				<version>1.9.1</version>
			</dependency>
		</dependencies>
	  </plugin>

But, errors occurred: "Plugin execution not covered by lyfecycle configureation". And the compiler has to detect errors "mast override a superclass method". The error occurs wherever there are override annotation, and in those places where it is installed correctly bugs.eclipse.org/bugs/show_bug.cgi?id=370983. I found a link github.com/jbosstools/m2e-jdt-compiler that can solve these problems, but I could not find documentation about the m2e-jdt-compiler

[Updated on: Thu, 19 July 2012 05:15]

Report message to a moderator

Re: Hotswap in Eclipse [message #896579 is a reply to message #896565] Thu, 19 July 2012 00:35 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
The m2e's lifecycle error should offer a quick fix that lets you discover/install the necessary connector, here m2e-jdt-compiler. After installing you should not need to do more on this front, the error should automatically disappear.

As you mention a difference in "must override a superclass method" this indicates that still you have a difference between 1.5 and 1.6 compilation. Make sure not only the pom but also the Eclipse compiler settings specify 1.6.

best,
Stephan
Re: Hotswap in Eclipse [message #896597 is a reply to message #896579] Thu, 19 July 2012 05:06 Go to previous messageGo to next message
Roman Yurin is currently offline Roman YurinFriend
Messages: 4
Registered: July 2012
Junior Member
Compiliance level was set at 1.6 as well as in eclipse and maven
If you mean Window->Preferences->Java->Compiler: Compiler compiliance level = 1.6 and use default compiliance settings checked (This is the default etslipse setting).

[Updated on: Thu, 19 July 2012 05:12]

Report message to a moderator

Re: Hotswap in Eclipse [message #896619 is a reply to message #896597] Thu, 19 July 2012 07:33 Go to previous message
Roman Yurin is currently offline Roman YurinFriend
Messages: 4
Registered: July 2012
Junior Member
I install m2e-jdt-compiler, build project with
      <plugin>
		<artifactId>maven-compiler-plugin</artifactId>
		<configuration>
		    <source>1.6</source>
		    <target>1.6</target>
		    <compilerId>eclipse</compilerId>
		    <encoding>utf-8</encoding>
		    <optimize>true</optimize>
		</configuration>
		<dependencies>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-compiler-eclipse</artifactId>
				<version>1.9.1</version>
			</dependency>
		</dependencies>
	  </plugin>


But the error "Hot code replace failed - Class modifiers change not implemented". still occurs when the hot swap. I work with complex multi-module project and message appears when an error does not understand the cause of the problem. How can I see what is happening at a low level when invoke a hot swap or even be a detailed description of the error with the name of the class in which there was a problem?

I compared the compiled classes in the building and replacement with bite code reader. Version jf class, modifiers on classes and methods, the number of methods are the same. Differs only in the number of variables of stack. It may be a problem at all in that class that I've changed?

[Updated on: Thu, 19 July 2012 07:41]

Report message to a moderator

Previous Topic:how to compile an AST tree?
Next Topic:Annotation Processor Completions
Goto Forum:
  


Current Time: Thu Mar 28 08:31:34 GMT 2024

Powered by FUDForum. Page generated in 0.03396 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top