Putting it in the lib directory does not work either. On Tue, Jul 10, 2012 at 9:44 AM, Romain Manni-Bucau [via OpenEJB] < ml-node+s979440n4656210...@n4.nabble.com> wrote:
> can you just check putting the properties file in lib directly (not in a > jar) it works? > > - Romain > > > 2012/7/10 s0dz <[hidden > email]<http://user/SendEmail.jtp?type=node&node=4656210&i=0>> > > > > I tried to create a different class inside of a different jar inside > > OpenEJB just to test with: > > > > static > > { > > System.out.println( "PLAYTIME: "); > > System.out.println( > > Thread.currentThread().getContextClassLoader().getResource( "." ) ); > > } > > > > The system.out is: > > > > PLAYTIME: > > null > > > > On Tue, Jul 10, 2012 at 9:14 AM, Romain Manni-Bucau [via OpenEJB] < > > [hidden email] <http://user/SendEmail.jtp?type=node&node=4656210&i=1>> > wrote: > > > > > hmm > > > > > > didnt try to package it, did you check our default exclusions > prefixes? > > > > > > - Romain > > > > > > > > > 2012/7/10 s0dz <[hidden email]< > > http://user/SendEmail.jtp?type=node&node=4656208&i=0>> > > > > > > > > > > Sry for the delayed response. I am doing something similar. > > > > > > > > InputStream is = null; > > > > Properties properties = new Properties(); > > > > > > > > is = > > Thread.currentThread().getContextClassLoader().getResourceAsStream( > > > > "common.properties" ); > > > > > > > > properties.load( is ); > > > > > > > > But I get this: > > > > > > > > Exception occurred in target VM: > > > > java.lang.NullPointerException > > > > at java.util.Properties$LineReader.readLine(Properties.java:418) > > > > at java.util.Properties.load0(Properties.java:337) > > > > at java.util.Properties.load(Properties.java:325) > > > > *at > > > > com.communitect.framework.PropertyMgr.<clinit>(PropertyMgr.java:82)* > > > > at com.communitect.ejb.protocol.SMTP.<clinit>(SMTP.java:44) > > > > at java.lang.Class.forName0(Native Method) > > > > at java.lang.Class.forName(Class.java:247) > > > > at org.apache.openejb.util.Classes.forName(Classes.java:62) > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.rules.ValidationBase.loadClass(ValidationBase.java:139) > > > > > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.rules.CheckCallbacks.validate(CheckCallbacks.java:65) > > > > > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.rules.ValidationBase.validate(ValidationBase.java:45) > > > > > > > > at > > > > > org.apache.openejb.config.AppValidator.validate(AppValidator.java:96) > > > > at > > > > > > > > org.apache.openejb.config.ValidateModules.deploy(ValidateModules.java:37) > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:321) > > > > > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:792) > > > > > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:668) > > > > > > > > at > > > > > > > > > > > > > > org.apache.openejb.config.ConfigurationFactory.getOpenEjbConfiguration(ConfigurationFactory.java:437) > > > > > > > > at > > > > > > > > > > > > > > org.apache.openejb.assembler.classic.Assembler.getOpenEjbConfiguration(Assembler.java:345) > > > > > > > > at > > > > > > org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:324) > > > > at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144) > > > > at org.apache.openejb.OpenEJB.init(OpenEJB.java:290) > > > > at org.apache.openejb.server.Server.init(Server.java:64) > > > > at org.apache.openejb.server.Main.initServer(Main.java:154) > > > > at org.apache.openejb.server.Main.main(Main.java:128) > > > > 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:597) > > > > at org.apache.openejb.cli.MainImpl.main(MainImpl.java:148) > > > > at org.apache.openejb.cli.Bootstrap.main(Bootstrap.java:103) > > > > > > > > > > > > Line 82: > > > > > > > > properties.load( is ); > > > > > > > > The PropertyMgr.java is in a utility jar we use that contains > business > > > > rules and database classes. > > > > > > > > This works when deployed in Tomcat, but not in OpenEJB. > > > > > > > > > > > > On Tue, Jul 10, 2012 at 3:01 AM, Romain Manni-Bucau [via OpenEJB] < > > > > [hidden email] <http://user/SendEmail.jtp?type=node&node=4656208&i=1>> > > > > wrote: > > > > > > > > > just tried: > > > > > > > > > > final Properties p = new Properties(); > > > > > final InputStream is = > > > > > getClassLoader().getResourceAsStream("common.properties"); > > > > > p.load(is); > > > > > > > > > > and it works > > > > > > > > > > i just did: echo "foo=bar" > lib/common.properties > > > > > > > > > > - Romain > > > > > > > > > > > > > > > 2012/7/10 Romain Manni-Bucau <[hidden email]< > > > > http://user/SendEmail.jtp?type=node&node=4656204&i=0>> > > > > > > > > > > > > > > > > can you share the way you load it (to avoid us to try several > > things > > > > > > before reproducing)? > > > > > > > > > > > > - Romain > > > > > > > > > > > > > > > > > > > > > > > > 2012/7/10 s0dz <[hidden email]< > > > > http://user/SendEmail.jtp?type=node&node=4656204&i=1>> > > > > > > > > > > > > > > > > >> I placed it in the /lib directory. > > > > > >> > > > > > >> It is a static class that loads it on OpenEJB startup. It > works > > in > > > > > tomcat > > > > > >> in this location, but not in OpenEJB. > > > > > >> > > > > > >> On Mon, Jul 9, 2012 at 4:58 PM, Romain Manni-Bucau [via > OpenEJB] < > > > > > >> [hidden email] < > > > http://user/SendEmail.jtp?type=node&node=4656204&i=2 > > > > > > > >> > > > > > wrote: > > > > > >> > > > > > >> > Hi, > > > > > >> > > > > > > >> > where is the file? when do you load it? > > > > > >> > > > > > > >> > - Romain > > > > > >> > > > > > > >> > > > > > > >> > 2012/7/10 s0dz <[hidden email]< > > > > > >> http://user/SendEmail.jtp?type=node&node=4656192&i=0>> > > > > > >> > > > > > > >> > > > > > > >> > > I am working on replacing my company's old school framework > > > with > > > > an > > > > > >> > > ActiveMQ/OpenEJB solution. It has been going smoothly with > > > > > >> re-factoring > > > > > >> > > code and implementing OpenEJB. This was until I ran into a > > > slight > > > > > >> > problem: > > > > > >> > > > > > > > >> > > I cannot figure out how to load in a "custom.properties" > that > > > > > contains > > > > > >> > > various important properties custom to my company's > software. > > > The > > > > > >> .jar > > > > > >> > > that > > > > > >> > > actually does the accessing is working. But it appears the > > > > > >> classloader > > > > > >> > is > > > > > >> > > not finding "custom.properties." > > > > > >> > > > > > > > >> > > Any ideas? > > > > > >> > > > > > > > >> > > Thanks! > > > > > >> > > Garrett > > > > > >> > > > > > > > >> > > -- > > > > > >> > > View this message in context: > > > > > >> > > > > > > > >> > > > > > > >> > > > > > > > > > > > > > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190.html > > > > > >> > > Sent from the OpenEJB User mailing list archive at > Nabble.com. > > > > > >> > > > > > > > >> > > > > > > >> > > > > > > >> > ------------------------------ > > > > > >> > If you reply to this email, your message will be added to > the > > > > > >> discussion > > > > > >> > below: > > > > > >> > > > > > > >> > > > > > > >> > > > > > > > > > > > > > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656192.html > > > > > >> > To unsubscribe from Custom ".properties" file, click here< > > > > > >> > > > > > > >> > . > > > > > >> > NAML< > > > > > >> > > > > > > > > > > > > > > > http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > >> > > > > > > >> > > > > > > >> > > > > > >> > > > > > >> -- > > > > > >> View this message in context: > > > > > >> > > > > > > > > > > > > > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656194.html > > > > > >> Sent from the OpenEJB User mailing list archive at Nabble.com. > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------ > > > > > If you reply to this email, your message will be added to the > > > discussion > > > > > below: > > > > > > > > > > > > > > > > > > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656204.html > > > > > > > > To unsubscribe from Custom ".properties" file, click here< > > > > > > > > > > > > > . > > > > > NAML< > > > > > > > > > > http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > > > > > > > > > > > > > > > > > > -- > > > > View this message in context: > > > > > > > > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656207.html > > > > > > > Sent from the OpenEJB User mailing list archive at Nabble.com. > > > > > > > > > > > > > ------------------------------ > > > If you reply to this email, your message will be added to the > discussion > > > below: > > > > > > > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656208.html > > > > To unsubscribe from Custom ".properties" file, click here< > > > > > > > . > > > NAML< > > > http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > > > > > > > > -- > > View this message in context: > > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656209.html > > > Sent from the OpenEJB User mailing list archive at Nabble.com. > > > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656210.html > To unsubscribe from Custom ".properties" file, click > here<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4656190&code=Z2FycmV0dC5tY3RlYXJAZ21haWwuY29tfDQ2NTYxOTB8MjEwMjIwOTU1Mg==> > . > NAML<http://openejb.979440.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656211.html Sent from the OpenEJB User mailing list archive at Nabble.com.