I have been having some problems getting HiveMind 1.0 to work inside
of OC4J 9.0.4

I have a very simple session bean that creats a default registry with
RegistryBuilder

Registry r = RegistryBuilder.constructDefaultRegistry();

With Log4J set to DEBUG mode I get the following output

0    [RMICallHandler-6] DEBUG org.apache.hivemind.impl.RegistryBuilder
- Processing modules visible to
[EMAIL PROTECTED]

16   [RMICallHandler-6] DEBUG
org.apache.hivemind.parse.DescriptorParser  - Parsing
jndi:C:\java-lib\hivemind-1.0\hivemind-1.0.jar/META-INF/hivemodule.xml

47   [RMICallHandler-6] ERROR org.apache.hivemind.impl.RegistryBuilder
- Error: null

java.lang.NullPointerException

       at 
org.apache.hivemind.parse.AbstractParser.getLocation(AbstractParser.java:158)

       at 
org.apache.hivemind.parse.DescriptorParser.parse(DescriptorParser.java:1420)

       at 
org.apache.hivemind.impl.RegistryBuilder.processModule(RegistryBuilder.java:216)

       at 
org.apache.hivemind.impl.RegistryBuilder.processModulesResources(RegistryBuilder.java:199)

       at 
org.apache.hivemind.impl.RegistryBuilder.processModules(RegistryBuilder.java:172)

       at 
org.apache.hivemind.impl.RegistryBuilder.constructDefaultRegistry(RegistryBuilder.java:709)

       at org.act.hivemind.test.SessionEJBBean.test(SessionEJBBean.java:31)

       at 
SessionEJB_StatelessSessionBeanWrapper0.test(SessionEJB_StatelessSessionBeanWrapper0.java:96)

       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:324)

       at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)

       at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)

       at 
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)

       at java.lang.Thread.run(Thread.java:534)

63   [RMICallHandler-6] DEBUG
org.apache.hivemind.parse.DescriptorParser  - Parsing
jndi:C:\java-lib\hivemind-1.0\hivemind-lib-1.0.jar/META-INF/hivemodule.xml

63   [RMICallHandler-6] ERROR org.apache.hivemind.impl.RegistryBuilder
- Error: null

java.lang.NullPointerException

       at 
org.apache.hivemind.parse.AbstractParser.getLocation(AbstractParser.java:158)

       at 
org.apache.hivemind.parse.DescriptorParser.parse(DescriptorParser.java:1420)

       at 
org.apache.hivemind.impl.RegistryBuilder.processModule(RegistryBuilder.java:216)

       at 
org.apache.hivemind.impl.RegistryBuilder.processModulesResources(RegistryBuilder.java:199)

       at 
org.apache.hivemind.impl.RegistryBuilder.processModules(RegistryBuilder.java:172)

       at 
org.apache.hivemind.impl.RegistryBuilder.constructDefaultRegistry(RegistryBuilder.java:709)

       at org.act.hivemind.test.SessionEJBBean.test(SessionEJBBean.java:31)

       at 
SessionEJB_StatelessSessionBeanWrapper0.test(SessionEJB_StatelessSessionBeanWrapper0.java:96)

       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:324)

       at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)

       at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)

       at 
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)

       at java.lang.Thread.run(Thread.java:534)

It appears that the DescriptorParser is having problems with the
"jndi:/" URLs.  (It doesn't have any problems parsing hivemodule.xml
files that are not stored in a jar file, in that case they get a
file:/  URL)

I went and grabbed the lastest CVS code and built the project.  It
still has the same problem.

I dove into DescriptorParser.java and tracked the problem to the
parseXML method.  Currently it takes the ExternalForm value from the
resource's URL and uses it to create a SAX InputSource which i'm sure
tries to open an InputStream.  I'm assuming that the InputSource is
having a problem with the jndi:/ style URL string.  I went ahead and
modified parseXML to call openStream on the URL and pass that stream
directly into the InputSource.
    /**
     * Parses a document in the original format: unvalidated XML (with
no document type).
     */
    private void parseXML(Resource resource) throws Exception
    {
        InputStream steam = null;
        URL url = resource.getResourceURL();

        if (url == null)
            throw new
ApplicationRuntimeException(ParseMessages.missingResource(resource),
                    resource, null, null);

        try
        {
            stream = url.openStream();
            InputSource source = new InputSource(stream);
            getSAXParser().parse(source, this);
        }
        catch (Exception ex)
        {
            _parser = null;

            throw ex;
        }
        finally 
        {
            try
            {
                if(stream != null) {
                    stream.close();
                }
            }
            catch(Exception e) {}
        }
    }
built the project,  it passed all the JUnit tests.  Fired it up in
OC4J and now i'm not haveing any problems putting together a registry.

I think this solution should work in other App Servers as well.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to