English 中文(简体)
• 如何在生活阶段打电话
原标题:How to call EJB in PhaseListener
  • 时间:2012-04-08 08:01:39
  •  标签:
  • jsf
  • ejb

我使用共同财产基金2和EJB3.1, 所有这些都部署在玻璃鱼3.1。

当设置一个名为MyInterceptor的班级时,该班正在实施Listener阶段,即不能撤销其内部的EJB远程接口。

它注意到“NullPointerException......”

public class MyInterceptor implements PhaseListener {

@EJB(name="AuthorizationEJB", 
            beanInterface=AuthorizationService.class,
            mappedName="corbaname:iiop:localhost:3700#ejb/AuthorizationEJB")
public AuthorizationService authorizationService;

....

} 

当我打电话给许可服务时,这会造成NullPointerException错误。

怎样才能确定它?

预先感谢

问题回答

在第二份共同提案中和之前,“生活”阶段的支持者不幸没有注射目标(因此,你可以注射)。 你们可以通过日本国民发展研究所进行方案调查。

在《共同财产法》2.2中,所有共同财产法(包括生活阶段)都是注射目标,但现在可能不会帮助你。

与你的问题无关,但我不肯定你在你的说明中通过具体说明<条码>beanInterface而重新努力实现的目标。 很可能,你不需要<条码>,即,如果你是当地人,你也不需要<条码>。

Yeah in web filter you could have just used plain @EJB. Maximimum you needed to add beanName if you had two beans implement same AuthorizationService interface.

Servlet filter is per request, I don t think you need to do security stuff at a certain phase from JSF s lifecycle (which is a more granular level than the whole http request).

For normal lookup you can do:

AuthorizationService.class.cast(new InitialContext().lookup("corbaname:iiop:localhost:3700#ejb/AuthorizationEJB")).dosomestuff();

a) try鱼。





相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...