[jboss-user] [Microcontainer] - can't read resource from the classpath??

jeff.yuchang do-not-reply at jboss.com
Wed May 20 06:57:58 EDT 2009


Hi all,

I've created a deployer for jboss identity, which is listening on the -jboss-idm.xml file.

It has two deployer classes, one is the deployer that IDMVFSParsingDeployer, which extends AbstractVFSParsingDeployer, the other is IDMSimpleVFSRealDeployer that extends AbstractSimpleVFSRealDeployer.

The work that deployer need to be done is simple.

1. IDMVFSParsingDeployer just need to listening on the -jboss-idm.xml, and then turn this xml file into javabean object(Metadata).

2. IDMSimpleVFSRealDeployer will get the config file from the javabean object(metadata), and then use the jboss identity API to start its service.

So in the jboss5.0.1.GA/server/default/deployer, it will have a idm-deployer.
in its deploy folder, it has idm folder that only contains three files.


  | default-jboss-idm.xml
  | jboss.idm.cfg.xml
  | jboss.idm.hibernate.cfg.xml
  | 

In the IDMVFSParsingDeployer, I am using the vsfile.openStream to read the default-jboss-idm.xml, it works great.. 

the default-jboss-idm.xml is following

  | <?xml version="1.0" encoding="UTF-8"?>
  | <jboss-idm-deployer xmlns="urn:jboss:identity:idm:deployer:v1_0_alpha"
  |                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |                 xsi:schemaLocation="urn:jboss:identity:idm:deployer:v1_0_alpha identity-deployer.xsd">
  | 	<JNDIName>java:/identitySessionFactory</JNDIName>
  | 	<idmConfigFile>jboss.idm.cfg.xml</idmConfigFile>
  | 	<initializers>
  | 		<hibernateInitializerType>
  | 			<doChecking>true</doChecking>
  | 		</hibernateInitializerType>
  | 	</initializers>
  | </jboss-idm-deployer>

so I can read the idmConfigFile property from here, but the question is, now I invoke the 


  | JAXB2IdentityConfiguration.createConfigurationMetaData("jboss.idm.cfg.xml")

It will tell me it can't find the jboss.idm.cfg.xml resource.

the code for the JAXB2IdentityConfiguration.createConfigurationMetaData is:


  |       ClassLoader classLoader = SecurityActions.getContextClassLoader();
  |       InputStream inputStream = classLoader.getResourceAsStream(configResource);
  |       if (inputStream == null)
  |       {
  |          throw new IllegalArgumentException("Resource "+configResource+" does not exist");
  |       }
  |       return createConfigurationMetaData(inputStream);
  | 

So I am wondering whether because the lib was in the deployer/idm-deployer folder, and then can't access the resources in the deploy/idm/ directory?

Or I did something wrong in other places?

Thoughts?


Thanks
Jeff

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4232188#4232188

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4232188



More information about the jboss-user mailing list