[EJB/JBoss] - Re: Business Interface Pattern + Generics == EJB Spec Violat
by jaikiran
Consider this:
public interface AddressBeanBusinessInterface <E extends Exception>
| {
| ...
| public void delete( final Long key ) throws E, UnknownIdDeviation;
|
| public interface AddressBeanRemote extends EJBObject, AddressBeanBusinessInterface<RemoteException>
| {
| // empty - see the business interface for the remote EJB methods
| ...
and
public interface AnotherInterface extends AddressBeanBusinessInterface<NullPointerException>
| {
| // empty - see the business interface for the remote EJB methods
|
So there 2 interfaces which extend the AddressBeanBusinessInterface. One expects to throw a NullPointerException and the other a RemoteException. So what should the compiler "replace" the E in AddressBeanBusinessInterface? It doesn't. All it does is marks the method to throw an Exception (as marked by E extends Exception):
public interface AddressBeanBusinessInterface <E extends Exception>
| {
| ...
| public void delete( final Long key ) throws Exception, UnknownIdDeviation;
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241797#4241797
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241797
16 years, 9 months
[Management, JMX/JBoss] - Binding Twiddle only with localhost
by sramhu
Hi All
We are in need to bind the twiddle locally. By which we will be able to invoke it only in the local machine and the remote access thro twiddle will be blocked.
I googled and got the below link to do wat i needed
see "*Binding the JMX invoker to localhost - HIGHLY RECOMMENDED:* " in
http://kbase.redhat.com/faq/docs/DOC-5477
When i tried the above mentioned steps and started the server, i get this deployment exception.
--- MBeans waiting for other MBeans ---
ObjectName: jboss.admin:service=PluginManager
State: CONFIGURED
I Depend On:
jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory
Depends On Me:
jboss.web.deployment:war=web-console.war,id=-653617
ObjectName: jboss.web.deployment:war=web-console.war,id=-653617
State: NOTYETINSTALLED
I Depend On:
jboss.admin:service=PluginManager
ObjectName: jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory
State: CONFIGURED
I Depend On:
jboss:service=invoker,type=jrmp,host=localhost
jboss.jmx:type=adaptor,name=Invoker
jboss:service=Naming
Depends On Me:
jboss.admin:service=PluginManager
jboss.jmx:type=adaptor,name=MBeanProxyRemote,protocol=jrmp
ObjectName: jboss.jmx:type=adaptor,name=MBeanProxyRemote,protocol=jrmp
State: CONFIGURED
I Depend On:
jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss:service=invoker,type=jrmp,host=localhost
State: NOTYETINSTALLED
Depends On Me:
jboss.jmx:type=adaptor,name=Invoker,protocol=jrmp,service=proxyFactory
Twiddle was not working from both local and remote
Only after reverting we the changes, twiddle was accessible form both local and remote. Need an aaproach so the twiddle is alllowed only when it is invoked from local machine.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241786#4241786
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241786
16 years, 9 months
[JNDI/Naming/Network] - Re: Getting DB connection from jboss pool via JNDI
by amayen
Ok, thanks for clarifying Peter!
The reason I believe that this is an anti-pattern comes from reading some sources on the internet like the following:
http://www.jboss.org/community/wiki/ConfigDataSources
In clause "Configuring a DataSource for remote usage" it is said that:
anonymous wrote : This results in the DataSource being bound under the JNDI name "GenericDS" instead of the default of "java:/GenericDS" which restricts the lookup to the same VM as the jboss server.
|
|
|
| Note: JBoss does not recommend using this feature on a production environment. It requires accessing a connection pool remotely and this is an anti-pattern as connections are not serializable. Besides, transaction propagation is not supported and it could lead to connection leaks if the remote clients are unreliable (i.e crashes, network failure). If you do need to access a datasource remotely, JBoss recommends accessing it via a remote session bean facade.
So I'm still a little bit in the dark of why the project I'm working on now, seemed to be working without use-java-context and without using remote session bean facades as indicated in the qoute. Its a little mistery till now to me.
Is having Tomcat and JBoss in a separate process so uncommon?
I'm considering testing to use the embedded tomcat, maybe that helps.
Kind regards, Anatol
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241783#4241783
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241783
16 years, 9 months
[JBoss Messaging] - MessagingException when deploying ear
by nbhatia
I am getting the following MessagingException when I deploy my ear. I am using JBoss Messaging 2.0.0.BETA3. Any idea why this could be happening? (The same ear on another machine with JBM 2.0.0.BETA1 is working just fine.)
| org.jboss.deployers.spi.DeploymentException: Endpoint activation failed ra=jboss.jca:service=RARDeployment,name='jms-ra.rar' activationSpec=org.jboss.messaging.ra.inflow.JBMActivationSpec(ra=org.jboss.messaging.ra.JBMResourceAdapter@673a6164 destination=queue/exchange.to.bfseam.fix.queue destinationType=javax.jms.Queue tx=true durable=false user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000)
| at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
| at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.activate(JBossMessageEndpointFactory.java:346)
| at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.start(JBossMessageEndpointFactory.java:212)
| at org.jboss.ejb3.mdb.MessagingContainer.startProxies(MessagingContainer.java:224)
| at org.jboss.ejb3.mdb.MessagingContainer.lockedStart(MessagingContainer.java:176)
| at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:884)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
| at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
| at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
| at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
| at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
| at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
| at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
| at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
| at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
| at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
| at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
| at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
| at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
| at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
| at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
| at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
| at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
| at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
| at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
| at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
| at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
| at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
| at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
| at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
| at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
| at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
| at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
| at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
| at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
| at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: javax.resource.ResourceException: unable to start Activation
| at org.jboss.messaging.ra.inflow.JBMActivation.start(JBMActivation.java:273)
| at org.jboss.messaging.ra.JBMResourceAdapter.endpointActivation(JBMResourceAdapter.java:139)
| at org.jboss.resource.deployers.RARDeployment.endpointActivation(RARDeployment.java:330)
| at org.jboss.resource.deployers.RARDeployment.internalInvoke(RARDeployment.java:284)
| at org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBeanSupport.java:156)
| at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
| at org.jboss.ejb3.JmxClientKernelAbstraction.invoke(JmxClientKernelAbstraction.java:58)
| at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.activate(JBossMessageEndpointFactory.java:342)
| ... 59 more
| Caused by: MessagingException[errorCode=2 message=Unable to connect to server using configuration org-jboss-messaging-core-remoting-impl-invm-InVMConnectorFactory?jbm-remoting-invm-serverid=0]
| at org.jboss.messaging.core.client.impl.ConnectionManagerImpl.createSession(ConnectionManagerImpl.java:294)
| at org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:962)
| at org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:706)
| at org.jboss.messaging.ra.JBMResourceAdapter.createSession(JBMResourceAdapter.java:1261)
| at org.jboss.messaging.ra.inflow.JBMActivation.setupSession(JBMActivation.java:359)
| at org.jboss.messaging.ra.inflow.JBMActivation.setup(JBMActivation.java:306)
| at org.jboss.messaging.ra.inflow.JBMActivation.start(JBMActivation.java:269)
| ... 67 more
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241779#4241779
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241779
16 years, 9 months
[Security & JAAS/JBoss] - Custom Principal class problem. SessionContext always return
by misqu23
Hi
I need to store in the principal class not only name of the principal but also id from database. So I have created my own login module which inherits from the jboss DatabaseServerLoginModule. In the method getUsersPassword I also get the id of the user from the db. Here is the code snipet :
| password = rs.getString(1);
| password = convertRawPassword(password);
| if (trace)
| log.trace("Obtained user password");
| Long id = rs.getLong(2);
| if (getIdentity() instanceof SmartOfficePrincipal) {
| log.info("Setting id to the principal");
| ((SmartOfficePrincipal)getIdentity()).setId(id);
| }
|
In login-config.xml I have configured login module to use my own principal implementation.
login-config.xml :
| <application-policy name="smartoffice">
| <authentication>
| <login-module code="org.jboss.security.ClientLoginModule" flag="required">
| <module-option name="restore-login-identity">true</module-option>
| </login-module>
| <login-module code="com.foo.SmartOfficeDatabaseLoginModule" flag="required">
| <module-option name="principalClass">com.foo.SmartOfficePrincipal</module-option>
| <module-option name="dsJndiName">java:/smartofficeDS</module-option>
| <module-option name="principalsQuery">SELECT PASSWORD,ID FROM SMR_USERS_ASSIGN WHERE LOGIN=?</module-option>
| <module-option name="rolesQuery">SELECT ROLES.ROLE, 'Roles' FROM SMR_USER_ROLES AS ROLES,
| SMR_USERS_ASSIGN AS USERS WHERE USERS.LOGIN = ? AND ROLES.
| USER_ID = USERS.ID</module-option>
| <module-option name="hashAlgorithm">MD5</module-option>
| <module-option name="unauthenticatedIdentity">anonymous</module-option>
| </login-module>
| </authentication>
| </application-policy>
|
My principal class :
| public class SmartOfficePrincipal extends SimplePrincipal implements Serializable {
|
| private static final long serialVersionUID = 2079488098348121376L;
|
| private Long id;
|
| public SmartOfficePrincipal(String name) {
| super(name);
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| public Long getId() {
| return id;
| }
|
| @Override
| public int hashCode() {
| final int prime = 31;
| int result = super.hashCode();
| result = prime * result + ((id == null) ? 0 : id.hashCode());
| return result;
| }
|
| @Override
| public boolean equals(Object obj) {
| if (this == obj)
| return true;
| if (!super.equals(obj))
| return false;
| if (getClass() != obj.getClass())
| return false;
| SmartOfficePrincipal other = (SmartOfficePrincipal) obj;
| if (id == null) {
| if (other.id != null)
| return false;
| } else if (!id.equals(other.id))
| return false;
| return true;
| }
| }
|
Everything works fine I can login to the application but when I try to get the callerPrincipal from the SessionContext object I get SimplePrincipal instance.
I can't cast to SmartOfficePrincipal.
Also when I try to get principal in the entitylistener using the following statement :
| Principal principal = SecurityAssociation.getPrincipal();
|
I get the instance of SimplePrincipal class. I need user id because in entity listener i would like to set the user who have last modify object or created.
So I don't have to remember to set up this by hand in the code.
Also in my aspects I prefer to use the user id.
What am I doing wrong ?
Thanks a lot.
Martin
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4241774#4241774
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4241774
16 years, 9 months