[JBoss Seam] - Re: Validation messages
by CptnKirk
Yep. It makes sense, it would be nice if you could override the validation message at the <s:validate> level. This has long been a complaint of JSF, and one that I believe will be fixed in JSF 2.0. JBoss will start using the 1.2 RI in 4.2, and that may allow some jsf-ext work to be used, including maybe support for what you're looking for.
Until then, ask Gavin real nice for a <s:validate message="my message"> feature.
Note though that NotNull is a special case in JSF. I believe that JSF will always handle required fields via its required=true mechanism so NotNull isn't a great example of using Hibernate Validator.
Also, Seam provides EL and context aware markup in JSF resource bundles. I don't know if it extends this capability to Hibernate Validator resource bundles, I'd assume not.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037127#4037127
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037127
19 years
[JBoss Portal] - Re: Access userPrincipal from Servlet
by Antoine_h
by the way, you have an example of downloading a file in the CMSAdmin portlet. It is for downloading an export of the CMS.
may be things there.
The HttpSession, which is seen by the servlet, is not the same as the portletSession that is used by the portlet.
what you can do is set the principal from the portlet, into the HttpSession, before to show the link, and then get it in the servlet. (with an attribute of the session).
Search in the forum post for HttpSession and httpservletrequest. I have posted code to get those from the portlet.
This is not a nice way.
A clean way is to get the Principal from the security domain of the portal.
you can see an example of this done in the JbossIntegrationFilter filter that is provided with Acegi.
It does something similar. Just to adapt in your servlet.
See the code at :
http://acegisecurity.org/multiproject/acegi-security-jboss/xref/org/acegi...
or download the Acegi Security source to get the java file.
You may also use a security constraint in the web.xml to let the user access to the servlet only if he is authenticated.
look at the CMSAdmin portlet, to see how the servlet is setup, and add some security constraint (related to the corresponding prefix in the url...).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037125#4037125
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037125
19 years
[EJB 3.0] - EJB3 MDB One Implementation Multiple Deployments
by jlowcock
I have a use case where the same MessageDriven bean needs to be deployed twice to listen to more than one Topic.
The code for the bean is:
@MessageDriven
( activationConfig=
{
@ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener")
}
)
public class JmsConnectorBean
implements MessageListener
{
public void onMessage(Message msg)
{
System.out.println(msg);
}
}
Other than repeating the code the only correct way that I can see to satisfy the use case is to use the ejb-jar.xml deployment descriptor which is as follows:
<message-driven>
<ejb-name>JmsConnectorBean</ejb-name>
<ejb-class>com.agilyx.adaptive.jms.JmsConnectorBean</ejb-class>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>topic/onique/adaptive/notifier</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
<message-driven>
<ejb-name>JmsDemoConnectorBean</ejb-name>
<ejb-class>com.agilyx.adaptive.jms.JmsConnectorBean</ejb-class>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Topic</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>topic/onique/adaptive/notifier</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
This also works well. However if there is not a descriptor for the MDB with the same default name as that in the implementation class the deployment fails with the following trace:
16:25:29,640 WARN [ServiceController] Problem starting service jboss.j2ee:jar=adaptive-server-ejb.jar,name=JmsConnectorBean,service=EJB3
org.jboss.deployment.DeploymentException: Required config property RequiredConfigPropertyMetaData@180e7a4[name=destinationType descriptions=[DescriptionMetaData@1a51364[language=en]]] for messagingType 'javax.jms.MessageListener' not found in activation config [] ra=jboss.jca:service=RARDeployment,name='jms-ra.rar'
at org.jboss.resource.deployment.ActivationSpecFactory.createActivationS
pec(ActivationSpecFactory.java:95)
at org.jboss.resource.deployment.RARDeployment.createActivationSpec(RARD
eployment.java:254)
at org.jboss.resource.deployment.RARDeployment.internalInvoke(RARDeploym
ent.java:218)
at org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBea
nSupport.java:156)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
64)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.ejb3.JmxClientKernelAbstraction.invoke(JmxClientKernelAbstr
action.java:44)
at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.createActivatio
nSpec(JBossMessageEndpointFactory.java:285)
at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.start(JBossMess
ageEndpointFactory.java:189)
at org.jboss.ejb3.mdb.MessagingContainer.startProxies(MessagingContainer
.java:185)
at org.jboss.ejb3.mdb.MessagingContainer.start(MessagingContainer.java:1
51)
at org.jboss.ejb3.mdb.MDB.start(MDB.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWra
pper.java:102)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
upport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
eanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy258.start(Unknown Source)
at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java
:96)
at org.jboss.ejb3.Ejb3Deployment.registerEJBContainer(Ejb3Deployment.jav
a:281)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:328)
at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanS
upport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
eanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
ler.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy37.start(Unknown Source)
at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
or.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
BeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor
.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(Intercepto
rServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInte
rceptor.java:92)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.
start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterce
ptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy38.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractIntercept
or.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelM
BeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
tScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
canner.java:610)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
loop(AbstractDeploymentScanner.java:274)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
run(AbstractDeploymentScanner.java:225)
So it seems that there must be one and one only descriptor with the same name as the implementation class to correctly pick up and apply the deployment decriptors.
So my question is whether this is a bug or am I misunderstanding what or how to deploy with ejb0jar.xml ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037124#4037124
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037124
19 years