-
1. Re: Where should I put user property files?
marc.fleury Jan 5, 2002 11:14 AM (in response to garymarsh)try
Thread.currentThread().getContextClassLoader().getResource(<your file>);
and make sure to put the file at the root of your jar.
marcf -
2. Re: Where should I put user property files?
garymarsh Jan 5, 2002 12:48 PM (in response to garymarsh)mark fleury;
I tried your suggestion and it still doesn't find the file.
here is my code :
public void readInStream( String propFileName )throws IOException
{
log.debug("in readInStream() : propFileName = "+propFileName);
URL url = Thread.currentThread().getContextClassLoader().getResource("/"+propFileName);
if( url == null )
log.debug("URL for propFile is null");
else
log.debug("URL for propFile is "+ url.toString());
InputStream in = url.openStream();
if( in == null )
{
log.debug("InStream = null");
throw new IOException("InStream is Null in readInStream.");
}
Properties p = new Properties();
p.load( in );
in.close();
System.setProperties(p);
}
==========
here is the log output.
[PropertyReader] in readInStream() : propFileName = Paye.properties
[PropertyReader] URL for propFile is null
[Default] null
[Client] TRANSACTION ROLLBACK EXCEPTION:null
Embedded Exception
null; nested exception is:
javax.ejb.EJBException: null
Embedded Exception
null
[Client] java.lang.NullPointerException
[Client] at com.paye.payroll.ClientBean.ejbCreate(ClientBean.java:146)
[Client] at java.lang.reflect.Method.invoke(Native Method)
[Client] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:204)
[Client] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:616)
[Client] at java.lang.reflect.Method.invoke(Native Method)
[Client] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:843)
[Client] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:231)
[Client] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:154)
[Client] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)
[Client] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
[Client] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
[Client] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
[Client] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)
[Client] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
[Client] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
[Client] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:372)
[Client] at java.lang.reflect.Method.invoke(Native Method)
[Client] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
[Client] at sun.rmi.transport.Transport$1.run(Transport.java:152)
[Client] at java.security.AccessController.doPrivileged(Native Method)
[Client] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
[Client] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
[Client] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
[Client] at java.lang.Thread.run(Thread.java:484)
Any suggestions??
Gary -
3. Re: Where should I put user property files?
garymarsh Jan 5, 2002 12:55 PM (in response to garymarsh)Mark;
I found that if I removed the "/" from in front of the file name your suggestion worked.
thanks,
Gary -
4. Re: Where should I put user property files?
henneschen Apr 5, 2002 10:42 AM (in response to garymarsh)I have the same problem, but your solution only gives the path to the directory of the starting call. e. g. C:/JBoss-2.4.4_Tomcat-4.0.1/jboss/bin/ and not the deployment directory.