[JBoss Seam] - Specifying a global ExceptionHandler/Interceptor
by zappen
Hello!
I would like to know if it is possible to specify a global exception handler/interceptor that takes precedence over any interceptor defined by Seam. What I would like to accomplish is a workaround to the problem that the debug.seam page does not work together with ICEFaces.
My current error is that I don't get any inidications in either server.log or on the console on what the problem might be. The only output I'm getting is the following:
reading exceptions.xml
also I get in the server.log file a line that states that a redirect is performed to the error.xhtml page. However I don't get redirected and I don't get any stack traces on the error that supposedly occurred.
So I thought the since the debug.seam page won't work together with ICEFaces I would build a custom exception interceptor that overrides any other handling in the packages. However I can't seem to find any information on how to do this. With my usual luck it is quite likely that it can not be done at all, or?
I would really appriciate any hints on how to go forward in this issue.
Kind regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997865#3997865
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997865
19 years, 3 months
[JBoss Seam] - Injection / Outjection
by mikepkp17
I still have troubles to understand how this bijection stuff works. What I want to achieve is the following:
I have a SFSB called TestSessionBean:
| @Scope(ScopeType.SESSION)
| @Clustered
| @Name("testSessionBean")
| @Stateful
| public class TestSessionBean implements TestSession, Serializable {
|
| @Logger
| private Log log;
|
| private Session someSession;
|
| private TabItem activeTab;
|
| public TabItem getActiveTab() {
| return activeTab;
| }
|
| public void setActiveTab(TabItem activeTab) {
| this.activeTab = activeTab;
| }
|
| public Session getSomeSession() {
| this.initSomeSession();
| return this.someSession;
| }
|
| private void initSomeSession() {
| ...
| }
|
| @PrePassivate
| @Destroy
| @Remove
| public void passivate() {
| if (this.someSession != null) {
| this.someSession.logout();
| }
| }
|
| @PostActivate
| public void activate() {
| this.initSomeSession();
| }
|
| public String getHello(){
| return "Hello";
| }
|
| }
|
I want to inject this TestSessionBean into another SFSB called TabBean:
| @Stateful
| @Scope(ScopeType.SESSION)
| @Name("foo.bar.TabBean")
| @Clustered
| public class TabBean implements Tab, Serializable {
|
| @In
| public TestSession testSessionBean;
|
| private TabItem activeTab;
|
| private Collection<TabItem> tabs = new Vector<TabItem>();
|
| public Collection getTabs() {
| return tabs;
| }
|
| public TabItem getActiveTab() {
| return activeTab;
| }
|
| public void setActiveTab(TabItem activeTab) {
| this.activeTab = activeTab;
| testSessionBean.setActiveTab(activeTab);
| }
|
| public void setInit(String[] tabArray) {
| for (int i = 0; i < tabArray.length; i++) {
| tabs.add(createTabItem(tabArray.split(";")));
| }
| if (tabs.size() > 0) {
| activeTab = tabs.iterator().next();
| }
|
| }
|
| private TabItem createTabItem(String[] vals) {
| if (vals.length != 4) {
| System.out.println("Wrong tab values inserted!");
| }
| return new TabItemImpl(vals[0], vals[1], vals[2], vals[3], this);
| }
|
| @Destroy
| @Remove
| public void destroy() {
| }
| }
|
The TabBean gets configured with components.xml:
| <components>
| <component name="org.jboss.seam.core.resourceBundle">
| <property name = "bundleNames">
| <value>bundle</value>
| </property>
| </component>
|
| <component name="org.jboss.seam.core.init">
| <property name="debug">true</property>
| <property name="jndiPattern">join2learn/#{ejbName}/local</property>
| </component>
|
| <component name="org.jboss.seam.core.manager">
| <!-- half second wait for conversation lock on concurrent requests -->
| <property name="concurrentRequestTimeout">500</property>
| <!-- 120 second conversation timeout -->
| <property name="conversationTimeout">120000</property>
| <property name="conversationIdParameter">cid</property>
| <property name="conversationIsLongRunningParameter">
| clr
| </property>
| </component>
|
| <component class="org.jboss.seam.core.Ejb"
| installed="false" />
|
| <component class="foo.bar.TabBean"
| name="tabBean">
| <property name="init">
| <value>0;tab.startpage;tab1;startpage</value>
| </property>
| </component>
| </components>
|
My ejb-jar.xml is the seam default one.
My problem is, that I get a NPE in TabBean if I try to invoke a method on the injected TestSessionBean and if I debug this stuff the testSessionBean variable is in fact null.
The TestSessionBean is first accessed in my index.xhtml page with the following call:
| <h:outputLabel value="#{testSessionBean.hello}" />
|
After that call I go to the debug.seam page and both the testSessionBean and the tabBean show up in the Session Context.
When I then click the link on the index page which invokes tabBean.setActiveTab(...) I get the NPE.
I also already tried all combinations of the @In Parameters which also didn't work out.
If I remove the @In and initialize testSessionBean with
| TestSession testSessionBean = (TestSession)Component.getInstance("testSessionBean");
|
everything works but I suppose its not the same as with the @In annotation...
I then added this to the TabBean:
| @In(create=true)
| private FacesMessages facesMessages;
|
and also this is not injected (which should work because FacesMessages is a seam standard component, isn't it?)
I am really stuck on this one, maybe someone can point me in the right direction...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997861#3997861
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997861
19 years, 3 months