[Design of JBoss IIOP on JBoss] - Re: CorbaNamingService for EJB3 in AS trunk
by pelam888
Could you please provide some more information as to how you have managed to get your EJB3 bean accessible over IIOP. There seems to be very little complete documentation on how to expose EJB3.0 beans over IIOP in JBoss.
I have the following:
1. A simple Stateless Session Bean, IIOPInvokableBean ,
| @Stateless
| @Remote(IIOPInvokable.class)
| @RemoteBinding(factory=RemoteBindingDefaults.PROXY_FACTORY_IMPLEMENTATION_IOR)
| public class IIOPInvokableBean implements IIOPInvokable {
|
| public void doSomething() {
| System.out.println("IIOPInvokableBean - Invoked doSomething() !");
| }
|
| public String getString() {
| System.out.println("IIOPInvokableBean - Invoked getString() !");
| return "HELLO!";
| }
|
|
| }
|
2. Its remote interface...
| @Remote
| public interface IIOPInvokable extends EJBObject
| {
| public void doSomething();
| public String getString();
| }
|
3. I have REMOVED the jboss.xml from the META-INF folder as you have advised
4. When I deploy the bean to JBoss 5.0.0.Beta3 (and also Jboss 4.2.2), I am presented with the following exception...
| 11:33:19,140 INFO [EJBContainer] STARTED EJB: IIOPInvokableEJB.IIOPInvokableBean ejbName: IIOPInvokableBean
| 11:33:20,625 INFO [EJBContainer] STOPPED EJB: IIOPInvokableEJB.IIOPInvokableBean ejbName: IIOPInvokableBean
| 11:33:20,625 ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:jar=IIOPInvokableEJBPOC.jar,name=IIOPInvokableBean,service=EJB3 state=Create
| java.lang.NullPointerException
| at org.jboss.ejb3.iiop.BeanCorbaServant.<init>(BeanCorbaServant.java:122)
| at org.jboss.ejb3.iiop.IORFactory.start(IORFactory.java:348)
|
Am I missing something or doing something incorrectly? Your assistance is appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138842#4138842
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138842
16 years, 7 months
[Design the new POJO MicroContainer] - Re: JarEntry as VFS root does not return empty vfspath
by mstruk
anonymous wrote :
| IIRC, the path originally was setup lazily, except for the now obsolete jar handler that went through every entry up-front?
|
I'd like to learn more about JarHandler being obsolete ...
anonymous wrote :
| I don't understand why you can't fall back to getParent().getParent().etc.
| at the worst?
|
This is our context URI:
file:/vfs/test/outer.jar!/org/jboss/test/vfs/support
These are parent child relationships for handlers within JarContext:
null
JarHandler (represents: file:/vfs/test/outer.jar)
JarEntryHandler (represents org)
JarEntryHandler (represents jboss)
JarEntryHandler (represents test)
JarEntryHandler (represents vfs)
root = JarEntryHandler (represents support)
JarEntryHandler (represents CommonClass.class)
JarEntryHandler (represents jar1)
JarEntryHandler (represents jar2)
root handler has VF handler representing 'vfs' for its parent. getParent().getParent() returns VF handler representing 'test'.
The solution would be to set root's parent to null.
anonymous wrote :
| I don't remember the code being that difficult, but then I haven't worked on it for a while?
|
I've approached the problem with a simple guideline: make a fix with a minimum amount of code change.
Don't change method signatures, try not to introduce additional fields ...
AbstractVirtualFileHandler gets three pieces of information: VFSContext, parent, name. To properly compose pathName I have to start generating the path at root node. I need to know which node is root and I need to make this check during pathName generation.
The simplest way was - let's use naming convention. Root should always have '', and it makes no sense for any normal file or directory to have '' name so we can test for root like this: isRoot = "".equals(name).
But this fell through because root in this VFS implementation is not '' and shouldn't be forced to be ''.
Ok, next I tried using parent: isRoot = parent == null. But turns out it's not null.
There are ways to fix this - we just set it to null somewhere, but who knows what dragons this will wake up so I saved this approach for later maybe.
Let's use VFSContext then. Let's get root handler from it and see if it's equal to this.
This exposed infinite recursion mines. First VFSContext closed exception that calls toString() that calls getPathName(), then in equals() which again calls getPathName(), the only thing left was == comparison which is not reliable due to unreliable context root retrieval, and serialization/deserialization ...
So this approach fell through as well.
anonymous wrote :
| Sounds like a simple solution, but maybe not so good on memory usage?
|
Ok, I'm trying another thing first - 'set parent to null' approach, that won't require any additional fields. I see two ways of doing it. One is to propagate some extra info based on which each handler can determine - as it's being created - if it is a root handler or not. That approach is processor intensive and requires small changes in many places. Another approach is to introduce setParent(VirtualFileHandler) or setAsContextRoot() method and call it on only one handler as it's assigned to be context root. That approach requires one extra method and one extra call - very elegant. But ... makes handler creation a two-phase process for handlers that become root and makes these handlers mutable. Looking at AbstractVirtualFileHandler I find no reliance on immutability so I don't expect problems.
I'm testing a fix made using this approach, and so far everything is working nicely.
In the end I'll remove more code cleaning out the current quick fix than add new code for a proper solution :)
- marko
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138835#4138835
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138835
16 years, 7 months
[Design the new POJO MicroContainer] - Re: Getting content of XML element
by kabir.khan@jboss.com
Revisiting this, as first implemented by Bill there are pluggable metadata loaders. The simplest case using the "standard" metadata loader is shown here:
| <metadata tag="test" class="org.jboss.test.aop.bean.POJOConstructorTest">
| <constructor expr="POJOConstructorTest()">
| <data>empty</data>
| </constructor>
| <method expr="* another()">
| <data>another()</data>
| </method>
| <field expr="void another(int, int)">
| <data>another(int, int)</data>
| </field>
| </metadata>
|
and
| <metadata tag="introduction-tag" class="org.jboss.test.aop.bean.NoInterceptorsPOJO">
| <class/> <!-- just tagging the class -->
| </metadata>
|
and
| <metadata tag="transaction" class="org.jboss.test.aop.bean.TxPOJO">
| <default>
| <trans-attribute>NotSupported</trans-attribute>
| </default>
| <method name="never">
| <trans-attribute>Never</trans-attribute>
| </method>
| <method name="supports">
| <trans-attribute>Supports</trans-attribute>
| </method>
| </metadata>
|
Although there are a few standard tags within the metadata (default, method, field, constructor), the actual content of these is free-form. E.g. The first example uses the nested element "data" and the third uses the nested element "trans-attribute".
Then we have more complicated things like the following, it uses the org.jboss.aspects.security.SecurityClassMetaDataLoader to parse the xml shown into aop metadata.
| <metadata tag="security" class="org.jboss.test.aop.bean.SecuredPOJO">
| <security-domain>other</security-domain>
| <method-permission>
| <role-name>allowed</role-name>
| <method>
| <method-name>someMethod</method-name>
| </method>
| </method-permission>
| <method-permission>
| <unchecked/>
| <method>
| <method-name>unchecked</method-name>
| </method>
| </method-permission>
| <field-permission>
| <role-name>allowed</role-name>
| <field>
| <field-name>someField</field-name>
| </field>
| </field-permission>
| <field-permission>
| <unchecked/>
| <field>
| <field-name>uncheckedField</field-name>
| </field>
| </field-permission>
| <constructor-permission>
| <unchecked/>
| <constructor>
| <constructor-params/>
| </constructor>
| </constructor-permission>
| <constructor-permission>
| <role-name>allowed</role-name>
| <constructor>
| <constructor-params>
| <constructor-param>int</constructor-param>
| </constructor-params>
| </constructor>
| </constructor-permission>
|
| <exclude-list>
| <description>Methods that connect be used</description>
| <method>
| <method-name>excluded</method-name>
| </method>
| <field>
| <field-name>excludedField</field-name>
| </field>
| <constructor>
| <constructor-params>
| <constructor-param>java.lang.String</constructor-param>
| </constructor-params>
| </constructor>
| </exclude-list>
| </metadata>
|
All the examples are from the AS 5 testsuite, and I think we need to continue supporting this stuff? From base-aspects.xml:
| <!-- custom configuration for AOP Security -->
| <metadata-loader tag="security" class="org.jboss.aspects.security.SecurityClassMetaDataLoader"/>
|
I think the simple cases can be rewritten using Element for the nested data/transaction-attribute elements? They only map onto name/value pairs - the name of the tag being the name, and the content being the value.
The SecurityClassMetaDataLoader needs replacing with something else, but it should be able to parse the style of xml shown. I don't see any other way at the moment than being able to take Element?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138808#4138808
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138808
16 years, 7 months