我最近将一个应用程序从Wildfly迁移到TomEE,并且我的@ApplicationScoped bean方法之一停止了工作。
bean是:
@Named
@ApplicationScoped
public class ImageGetter implements Serializable {
private static final long serialVersionUID = -7111940277712388523L;
@EJB
private ImageService service;
public byte[] getImage(long idP, long idI) {
if (idI != 0)
return service.getImage(idI);
else if (idP != 0)
return service.getImageFromParticipante(idP);
else
return null;
}
}
例外是:
javax.el.MethodNotFoundException: main.ImageGetter@453a5099.getImage /cad/frm_participante.xhtml @38,52 value="#{imageGetter.getImage(participanteBean.id, participanteBean.idI)}"
该方法由OmniFaces o:graphicImage调用,并且在Wildfly上可以正常工作,但我无法在TomEE上使用它。
我的依赖项,以防万一这些有用:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.2</version>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.6.9</version>
</dependency>
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>javax.ejb-api</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.2.10.Final</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
什么可能导致此错误?
更新:通过将特定的Bean从CDI切换到JSF托管Bean,找到了一种解决方法。当JSF管理Bean时,页面将设法找到该方法。