Re: Struts 2.5.x to 6.4.0

Lukasz Lenart <[email protected]> Sun, 26 Jan 2025 07:29:29 +0100
Newsgroups gmane.comp.jakarta.struts.user
Message-ID <CAMopvkM7N9Bv6WgCdjAB6Vgm4f2gCxt3qMG=A8aoTGTVM_DDrQ@mail.gmail.com>
czw., 23 sty 2025 o 17:51 jw1474674 <[email protected]> napisał(a):
> Hi, I’m facing issues upgrading struts versions.
> In particular with a custom StrutsTypeConverter.
>
> The custom converter has a @PersistenceContext annotation for the
> EntityManager which used to work.
>
> The entityManager is used to find class types for conversion.
>
> But now I am getting an NPE in the overridden convertFromString as the
> entityManager is null, ie isn’t being injected.
>
> I’ve tried different ways of injecting the entityManager, field injections
> constructor injection. Autowired, etc, but none of the injections seem to
> work here anymore.
>
> The @PersistenceContext annotation is working elsewhere to inject the
> entityManager though.
>
> Any help would be appreciated.

Do you use Spring to inject this?


Cheers
Łukasz