Java: Enum : NoClassDefFoundError

后端 未结 2 1651
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-15 18:00

I am facing issues while using enum in my J2EE application. I am using enum in a switch case inside my stateless service bean.

During runtime I see following exception

2条回答
  •  一向
    一向 (楼主)
    2021-02-15 18:12

    I ran into a similar issue, and the easy workaround was to define the Enum as public instead of private.

    (Didn't have time to verify, but my hunch is that this causes the class to not be created as Name$1.class but rather something like Name$Enumname.class, which seemed to be the problem)

提交回复
热议问题