stack overflow error with panache quarkus 3.0.1.Final

231 views
Skip to first unread message

Jignesh Patel

unread,
Apr 29, 2023, 2:27:06 PM4/29/23
to Quarkus Development mailing list
What is wrong with following code why it is going in thee recursive calls. I am wondering is quarkus production ready? Or we are just breaking heads for every small thing.

  Caused by: java.lang.StackOverflowError

at java.base/sun.nio.fs.UnixPath.<init>(UnixPath.java:68)

at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:279)

at java.base/java.io.File.toPath(File.java:2387)

at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1264)

@ApplicationScoped
public class CustomerRepository implements PanacheRepository<Customer> {

private static final Logger logger = Logger.getLogger(CustomerRepository.class);
@Inject
EntityManager entityManager;
/**
* Find Customer data base on customerId
* @param customerId
*/
@Transactional(REQUIRED)
public Customer findByCustomerId(String customerId) throws CustomException {

// TypedQuery<Customer> customerTypedQuery = entityManager.createQuery("From Customer where column=? ",Customer.class);

logger.info("customerId: "+customerId);
//Customer entity =findByCustomerId(customerId);

Customer entity=findByCustomerId(customerId);
if(entity == null){
throw new CustomException("Customer with id of " + customerId + " does not exist.");
}
return entity;
}

return entity;
}

Georgios Andrianakis

unread,
Apr 29, 2023, 2:33:08 PM4/29/23
to Jignesh Patel, Quarkus Development mailing list
First of all, let's address the attitude of this post: Being sarcastic about the quality of the project after hundreds of people have spent countless hours developing features, fixing bugs, improving the usability and so on, so the community can use this project for free, is absolutely not acceptable. 
When one have an issue and hope to get people to look at your issue (again, for free), it's best to be refrain from judgement and just state the facts of the problem.

As to the issue itself, open a GitHub issue and provide a sample application which exhibits the problem.

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/4be72989-7fb9-4c78-9c45-28d20fb48313n%40googlegroups.com.

Jignesh Patel

unread,
Apr 29, 2023, 5:55:39 PM4/29/23
to Quarkus Development mailing list
Yes if I wear my technical hat, I also don't like someone talks bad about the work even the things doesn't work. It is a lot of hard work being placed and a great concept, I myself spend significant time to make it work and there are things did work with the older version of quarkus but not with the newer one. So sarcastic comment is in the context  of newer version, not for the quarkus. So don't read the comment just in terms of plain English. I suspect the panache library did not catch up with the updates. 
The repository is here:
https://github.com/jigneshmpatel/consumer

We are not only using quarkus blocking but even exploring using reactive(which also has issues) and one step further  also trying to explore using with GRPC.  
Eventually at the end of the day business needs to get things done too.

Sanne Grinovero

unread,
Apr 29, 2023, 6:11:27 PM4/29/23
to jignes...@gmail.com, Quarkus Development mailing list

That StackOverflowError is caused because of your code: it's calling itself. Seems totally unrelated to Panache and Quarkus.

Jignesh Patel

unread,
Apr 29, 2023, 7:02:34 PM4/29/23
to Sanne Grinovero, Quarkus Development mailing list
A..h. my blunder. Checking it out further.

Jignesh Patel

unread,
Apr 30, 2023, 5:13:11 AM4/30/23
to Sanne Grinovero, Quarkus Development mailing list
Ok here is the actual problem.

public class CustomerRepository implements PanacheRepository<Customer> {

private static final Logger logger = Logger.getLogger(CustomerRepository.class);
@Inject
EntityManager entityManager;
/**
* Find Customer data base on customerId
* @param customerId
*/
@Transactional(REQUIRED)
    public Customer findByCustomerId(String customerId) throws IcareBillingException {
logger.info("customerId: "+customerId);
Customer entity= find("customerId",customerId).firstResult();
if(entity == null){
throw new IcareBillingException("Customer with id of " + customerId + " does not exist.");
}
return entity;
}
The code was working with quarkus previous version but not anymore.
It seems it is not understanding following line
find("customerId",customerId).firstResult();
And throws following error:

05:11:35 INFO  [co.ic.bi.re.CustomerRepository] (main) customerId: 2020110000107
Hibernate:
    select
        c1_0.ID,
        c1_0.CUSTOMER_ID,
        c1_0.NAME,
        c1_0.PARENT_ID,
        c1_0.STATUS
    from
        CUSTOMER c1_0
    where
        c1_0.CUSTOMER_ID=? limit ?

java.lang.ClassCastException: class java.lang.Character cannot be cast to class java.lang.String (java.lang.Character and java.lang.String are in module java.base of loader 'bootstrap')

Georgios Andrianakis

unread,
Apr 30, 2023, 5:29:39 AM4/30/23
to Jignesh Patel, Sanne Grinovero, Quarkus Development mailing list
As mentioned in the first reply, open an issue please and attach a sample application that worked with Quarkus 2.x and does not now 

Jignesh Patel

unread,
Apr 30, 2023, 7:11:15 AM4/30/23
to gand...@redhat.com, Sanne Grinovero, Quarkus Development mailing list
ok I can still post the code, if you keep insisting
But I found the culprit. The version 3 does not like @Enumerated, if I remove then it works. Let me know if there is a workaround?

@Builder
@AllArgsConstructor
@Entity
@NoArgsConstructor
@Getter
@Setter
@ToString
@Table(name = "CUSTOMER")
//@EqualsAndHashCode(callSuper=false)
public class Customer{

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "ID", nullable = false, length = 11)
private Integer id;


@Column(name="CUSTOMER_ID", length = 50, unique=true, nullable = false)
private String customerId;

@Column(name = "NAME", length = 50, nullable =false)
private String name;

@Enumerated(EnumType.STRING)
@Column(name = "STATUS",columnDefinition = "enum ('A', 'I') default 'A'", nullable = false, length = 1)
private StatusEnum status
;


@JoinColumn(name = "PARENT_ID", referencedColumnName = "ID", nullable = true)
@ManyToOne(fetch = FetchType.LAZY)
private Customer parentId;



}
public enum StatusEnum {
A,I,R,N,P,E
}

You received this message because you are subscribed to a topic in the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/quarkus-dev/7BrNOtzWAHs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CALeTM-nhqYVtce9rbH6iSR4D5QWZETQ1iyzo6%3D%3Dcef-d0a8MtA%40mail.gmail.com.

Jignesh Patel

unread,
Apr 30, 2023, 11:51:17 AM4/30/23
to gand...@redhat.com, Sanne Grinovero, Quarkus Development mailing list
further down, remove length=1 and it works.
@Enumerated(EnumType.STRING)    
@Column(name = "STATUS",columnDefinition = "enum ('A', 'I') default 'A'", nullable = false, length = 1)
private StatusEnum status;
Reply all
Reply to author
Forward
0 new messages