[Design of EJB 3.0] - Re: EJBTHREE-1423 Test case for @RemoteBinding
by jaikiran
Andrew,
I tested this with jboss-metadata 1.0.0.Beta36. My test cases which work on Remote beans are failing. The ones working with Local beans pass. Here's the exception, i see for all my remote bean test cases:
| testRemoteBindingForSlsb(org.jboss.ejb3.test.proxy.binding.unit.JNDIBindingTestCase) Time elapsed: 1.016 sec <<< ERROR!
| javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Could not create the EJB3 Business Proxy implementing "org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote" for MyStatelessBeanWithBindings]
| at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1337)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:765)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
| at javax.naming.InitialContext.lookup(InitialContext.java:351)
| at org.jboss.ejb3.test.proxy.binding.unit.JNDIBindingTestCase.testRemoteBindingForSlsb(JNDIBindingTestCase.java:184)
| 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:585)
| at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
| at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
| at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
| at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
| at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
| at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
| at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
| at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
| at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
| at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
| at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
| at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
| at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
| at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
| at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:165)
| at org.apache.maven.surefire.Surefire.run(Surefire.java:107)
| 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:585)
| at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:289)
| at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:993)
| Caused by: java.lang.RuntimeException: Could not create the EJB3 Business Proxy implementing "org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote" for MyStatelessBeanWithBindings
| at org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase.createProxyBusiness(SessionProxyFactoryBase.java:235)
| at org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129)
| at org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
| at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161)
| at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
| at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1312)
| at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1329)
| ... 30 more
| Caused by: java.lang.AssertionError: Could not find Advice Stack with name: StatelessSessionClientInterceptors
| at org.jboss.ejb3.proxy.factory.ProxyFactoryBase.getInterceptors(ProxyFactoryBase.java:185)
| at org.jboss.ejb3.proxy.factory.session.stateless.StatelessSessionRemoteProxyFactory.createInvocationHandler(StatelessSessionRemoteProxyFactory.java:147)
| at org.jboss.ejb3.proxy.factory.session.SessionProxyFactoryBase.createProxyBusiness(SessionProxyFactoryBase.java:227)
| ... 36 more
And this exception happens when i lookup the bean using the remote jndi name:
|
| @Test
| public void testRemoteBindingForSlsb() throws Throwable
| {
| // create the bean
| this.sessionContainer = Utils.createSlsb(MyStatelessBeanWithBindings.class);
|
| // bind it to JNDI
| Ejb3RegistrarLocator.locateRegistrar().bind(sessionContainer.getName(), sessionContainer);
|
| List<RemoteBindingMetaData> remoteBindingsMetadata = sessionContainer.getMetaData().getRemoteBindings();
|
| assertNotNull("No RemoteBindingMetadata available", remoteBindingsMetadata);
| // make sure that the remotebinding metadata list has 1 @RemoteBinding information
| assertEquals("RemoteBindingMetadata does not have any RemoteBinding information available", remoteBindingsMetadata.size(), 1);
|
| // Ensure that the RemoteBindingMetaData is created properly with the specified jndiBinding name.
| Iterator<RemoteBindingMetaData> remoteBindingsMetadataIterator = remoteBindingsMetadata.iterator();
| RemoteBindingMetaData remoteBindingMetadata = remoteBindingsMetadataIterator.next();
|
| assertEquals("RemoteBinding JNDI name does not match " + MyStatelessBeanWithBindings.REMOTE_JNDI_NAME, MyStatelessBeanWithBindings.REMOTE_JNDI_NAME, remoteBindingMetadata
| .getJndiName());
|
| // Now ensure that the RemoteBindingMetaData is used for binding the
| // remote interface of the bean.
| Context ctx = new InitialContext();
| String rJndiName = remoteBindingMetadata.getJndiName();
|
| Object remoteBean = ctx.lookup(rJndiName); // fails here with exception
|
| assertNotNull("Remote bean returned from JNDI lookup is null", remoteBean);
| assertTrue("Remote bean returned from JNDI lookup is NOT an instance of " + MyStatelessRemote.class, (remoteBean instanceof MyStatelessRemote));
|
| }
Looks like there's some change related to EJBTHREE-1345 as part of which now atleast one interceptor is mandatory for remote beans?
Let me know, if you want me to update the JIRA (EJBTHREE-1423) with this updated test case. Actually, there hasn't been much changes in these test cases.
A couple of related questions:
1) What exactly are these client interceptors that is being checked for?
2) Why do we mandate these interceptors only for remote proxy and not for local proxy?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171019#4171019
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171019
17 years, 7 months
[Design of JBoss Portal] - Portlet instance Admin
by Vishal Student 123
Hi,
I'm trying to implement the admin preferences. Where the admin can change default values for a portlet instance that will be reflected for everyone viewing that page. Allowing administrators to easily tweak values such as the number of images to display in each column/row for a category portlet for example. This can be done in the admin portlet, but it can be difficult for non-programmers to understand how instances are configured and which instance is displayed on which page. Which is why I also want a admin GUI layout for portlets.
I have seen the thread: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=139028 but i also saw this in the API of 2.6.3:
anonymous wrote :
| There are two different types of preferences:
|
| modifiable preferences - these preferences can be changed by the portlet in any standard portlet mode (EDIT, HELP, VIEW). Per default every preference is modifiable.
| read-only preferences - these preferences cannot be changed by the portlet in any standard portlet mode, but may be changed by administrative modes. Preferences are read-only, if the are defined in the deployment descriptor with read-only set to true, or if the portlet container restricts write access.
|
|
So i went about making preferences read-only and set up a custom view:
| <portlet>
| .....
| <preference>
| <name>numberOfImages</name>
| <value>5</value>
| <read-only>true</read-only>
| </preference>
| <supports>
| <mime-type>text/html</mime-type>
| <portlet-mode>VIEW</portlet-mode>
| <portlet-mode>Admin</portlet-mode>
| </supports>
| </portlet>
| <custom-portlet-mode>
| <name>Admin</name>
| </custom-portlet-mode>
| </portlet-app>
|
allowed my "admin" to edit instance preferences:
| <instance>
| <instance-id>name</instance-id>
| <portlet-ref>name</portlet-ref>
| <security-constraint>
| <policy-permission>
| <action-name>admin</action-name>
| <role-name>Admin</role-name>
| </policy-permission>
| <policy-permission>
| <action-name>view</action-name>
| <unchecked/>
| </policy-permission>
| </security-constraint>
| </instance>
|
But when trying to write to the value i get a error:
| javax.portlet.ReadOnlyException: Key foo cannot be written
|
Also when i am looking at the admin portlet logged in as admin i cannot click on the value for a portlet varible where i can change it. Other preferences in other portlets not mark as "read-only" can be changed.
It's like the admin cannot write to the values. Is there something i am missing? I'm using the same default admin that was set when i downloaded it.
Is there something i need to for admin to write to read only values ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171017#4171017
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171017
17 years, 7 months