1

I have the following code and it generate the java.lang.NoSuchMethodError: com.misyn.aia.camb.coims.common.dto.ManageReportDto.setAgencyTotals(Ljava/util/List;)V error ONLY AFTER DEPLOYED IN THE SERVER (openSUSE Leap v15.0/ java 1.8).

I run the same .jar in the local environment (Windows 10/ jave 1.8) and it works fine.

All other dtos with lombok annotated also works perfectly fine.

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class ManageReportDto implements Serializable {

    private String row;
    private String total;
    private List<String> agencyTotals = new ArrayList<>();
    private List<String> bancaTotals = new ArrayList<>();
    private String percentage;
    private List<String> courier = new ArrayList<>();

}

project versions is as,

  • maven v3.6.3
  • spring boot v2.1.6
  • lombok v1.18.8
Reshan
  • 59
  • 1
  • 6
  • "All the dtos with lombok annotated also works perfectly fine" Ehm .. according to your explanation, there is a dto missing methods, doesn't sound like 'works perfectly fine'. If you use lombok in IntelliJ, you need the lombok plugin. Maybe it's something like that, some configuration that is missing, and your server isn't compatible with lombok? – Stultuske Sep 25 '20 at 07:02
  • 2
    Check the CLASSPATH of the server. There might be dependecy jars in wrong version or even jars with same classes as your jar. – Michal Sep 25 '20 at 07:21
  • @Stultuske Sorry,It's my mistake. I updated the question now. I don't think it's an Intellij problem. Problem is in the running system in the server I guess. how can I find server compatibility ? and if it is so how does it work for other dtos ? I think it is not a compatibility issue. – Reshan Sep 25 '20 at 07:52
  • @Michal you mean lombok dependency? I check and there is no other dependency for lombok. and please note all other functions in the system with Lombok annotated dtos are working fine. – Reshan Sep 25 '20 at 08:00
  • 2
    If it is only one dto, chance is that the dto class (ManageReportDto) is twice on the classpath. – Michal Sep 25 '20 at 08:02
  • @ReshanPubudu I know it isn't an IntelliJ issue, I just pointed out that in some configurations the lombok dependency isn't sufficient – Stultuske Sep 25 '20 at 08:22
  • @Michal is correct. that's not a lombok issue. another old dependency with ManageReportDto was there in my classpath. That has caused the problem. After cleaning and re-deployment,everything is working as expected. – Reshan Sep 28 '20 at 17:02

1 Answers1

0

Compile your code and then use a decompiler to find out if your code has GETTER and SETTER methods.

JAVA decompiler: http://java-decompiler.github.io/

It will help you to find out if GETTER and SETTER methods were generated or not.

Also, you can refer to below stackoverlow link too in regards to your IDE configuration.

Lombok is not generating getter and setter

Aashish
  • 7
  • 2
  • he made it clear that it is on the server he gets the error, that it works locally. I doubt it's IDE config-related. – Stultuske Sep 25 '20 at 07:27
  • It depends on how he runs the application and how he builds and deploys it. Depending upon that, we might have different problem scenarios. Also, lombok is needed only compile time not at run time. So, it seems like that running the application and build and deployment is different. – Aashish Sep 25 '20 at 07:37
  • I agree that building and deployment is not the same. But: had his IDE not compiled the code, he couldn't have tested it locally. I would also assume there is some form of CI cycle between the whole developing/deploying phases which would have mentioned compile time issues – Stultuske Sep 25 '20 at 07:42
  • @Aashish how can the same jar file work differently in a different server? I deployed the same jar that worked fine locally, but once deployed it still had the same issue (didn't work) – Reshan Sep 25 '20 at 08:23
  • and @Aashish I decompiled the code and generated getter setters are correct. – Reshan Sep 25 '20 at 08:28