[JBoss Seam] - Re: ClassCastException: org.jboss.seam.jsf.SeamApplication11
by titou09
cool, but the questions behind my problem were:
1) do you have to use MyFaqes instead of the JSF implementation of WAS (Is it your case)?
2) Indeed, if you put all your code in the war, seam works, but this is not acceptable to us. We have to separate our sevices/managers/model classes into a "utility" jar and have the war depends on it, and only have classes related to presentation in the war (view controllers/backing beans). This seems to not be possible if you want to uses seam annotation in any class in the utility jar, as jboss-seam.jar must be placed in the ear file directly has any other framework jar (log4j, etc..). and as you point it out, this does not work
A workaround is to have an utility jar for the "business" classes and deploy it under the war WEB-INF/lib directory....arghh
See my other posts in tha forum on that topic.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046669#4046669
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046669
18 years, 11 months
[EJB/JBoss] - any idea to inject a ejb to tapestry?
by phoenix.zhp
hi, I use tapestry as web tier and want get a slsb in this tier. this is my code:
public abstract class Home extends BasePage {
// @EJB
// Calculator bean;
public String getResult() {
// Double message = bean.calculate(11, 22, 0.08, 44);
// return message.toString();
InitialContext ctx = null;
Calculator bean = null;
try {
ctx = new InitialContext();
bean = (Calculator) ctx
.lookup("ejb3TapestryJboss/CalculatorBean/local");
} catch (NamingException e) {
e.printStackTrace();
}
Double message = bean.calculate(22, 22, 0.08, 22);
return "ok! " + message.toString();
}
}
When I use JNDI's lookup, as showed above, it works. But when I want to inject a slsb to this page, as the commented code showed, it get nothing. No bean is injected. do I misues this annotation? and how can I inject a bean to tapestry? or I can only do this in servlet? By the way, I use jbossAs 5 beta2 as the server.
Thanks for your help in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046666#4046666
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046666
18 years, 11 months
[Clustering/JBoss] - Re: Sever Failover
by bstansberry@jboss.com
Best thing to do is to have a look at the 4.2 codebase, cluster module, package org.jboss.ha.singleton. HASingletonElectionPolicy is the interface; HASingletonElectionPolicySimple is the default implementation.
What you do is you deploy your policy as an mbean. Your policy can take whatever config attributes you want; just expose them in the mbean interface. Then in the mbean descriptor for the HASingletonController you inject the policy. E.g.:
| <server>
| <!-- First the service being controlled -->
| <mbean code="org.jboss.ha.singleton.examples.HASingletonMBeanExample"
| name="jboss.examples:service=HASingletonMBeanExample_1">
| </mbean>
|
| <mbean code="org.jboss.ha.singleton.PreferredMasterHASingletonElectionPolicy"
| name="jboss.examples:service=HASingletonMBeanExample-HASingletonElectionPolicy_1">
| <attribute name="PreferredServer">foo:1099</attribute>
| </mbean>
|
| <mbean code="org.jboss.ha.singleton.HASingletonController"
| name="jboss.examples:service=HASingletonMBeanExample-HASingletonController_1">
|
| <depends optional-attribute-name="ClusterPartition"
| proxy-type="attribute">jboss:service=DefaultPartition</depends>
| <depends>jboss.examples:service=HASingletonMBeanExample_1</depends>
| <depends optional-attribute-name="ElectionPolicy"
| proxy-type="attribute">jboss.examples:service=HASingletonMBeanExample-HASingletonElectionPolicy_1</depends>
| <attribute name="TargetName">jboss.examples:service=HASingletonMBeanExample_1</attribute>
| <attribute name="TargetStartMethod">startSingleton</attribute>
| <attribute name="TargetStopMethod">stopSingleton</attribute>
| <attribute name="TargetStopMethodArgument">true</attribute>
| </mbean>
| </server>
Your election policy will have a ref to the HAPartition passed into it as an arg to pickSingleton when it needs to decide if it is the master. From that you can determine who the members are. You then compare the value of your PreferredServer attribute to the addresses in the view. If one matches, return that member. If none match, delegate to HASingletonElectionPolicySimple (which should be the superclass of your policy).
The tricky bit is "PreferredServer" is a string, while the members are objects of type ClusterNode. As the JIRA says, we need to come up with a good, user-friendly way to compare those.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046661#4046661
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046661
18 years, 11 months