AnsweredAssumed Answered

Using *.properties file

Question asked by partizano on Aug 4, 2011
Latest reply on Aug 8, 2011 by ronald.van.kuijk
Hi, Activiti Team!

I try to create my own *.properties file and get properties from it.

I have created "loanConfig.properties" file, packed it to separate jar-archive and put to webapps\activiti-rest\WEB-INF\lib\

For getting properties I use following code:

        Properties configFile = new Properties();
        String result = "";
        try {
            //FileInputStream in = new FileInputStream("loanConfig.properties");
            //configFile.load(in);
            configFile.load(ClassLoader.getSystemClassLoader().getResourceAsStream("loanConfig.properties"));
            result = configFile.getProperty("key");
        } catch (IOException e) {
            …
        }

But it doesn't work. Exception is:
 ""      ,"java.lang.NullPointerException"
      ,"java.util.Properties$LineReader.readLine(Properties.java:418)"
      ,"java.util.Properties.load0(Properties.java:337)"
      ,"java.util.Properties.load(Properties.java:325)"
      ,"com.myCompany.core.Helper.getCbs3Url(Helper.java:45)"
      ,"com.myCompany.cbs3export.DBController.<init>(DBController.java:20)"
      ,"com.myCompany.cbs3export.ExportToCbs3.execute(ExportToCbs3.java:34)"
      ,"org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:47)"
      ,"org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:38)"
      ,"org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:104)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:48)"
      ,"org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:45)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:44)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:61)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:111)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36)"
      ,"org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:326)"
      ,"org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:92)"
      ,"org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:49)"
      ,"org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)"
      ,"org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.execute(FlowNodeActivityBehavior.java:36)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessStartInitial.eventNotificationsCompleted(AtomicOperationProcessStartInitial.java:44)"
      ,"org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessStart.eventNotificationsCompleted(AtomicOperationProcessStart.java:44)"
      ,"org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:52)"
      ,"org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:76)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:481)"
      ,"org.activiti.engine.impl.persistence.entity.ExecutionEntity.start(ExecutionEntity.java:280)"
      ,"org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:70)"
      ,"org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:30)"
      ,"org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)"
      ,"org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)"
      ,"org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)"
      ,"org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:69)"
      ,"org.activiti.rest.api.process.ProcessInstancePost.executeWebScript(ProcessInstancePost.java:58)"
      ,"org.activiti.rest.util.ActivitiWebScript.executeImpl(ActivitiWebScript.java:68)"
      ,"org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)"
      ,"org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)"
      ,"org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)"
      ,"org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)"
      ,"javax.servlet.http.HttpServlet.service(HttpServlet.java:717)"
      ,"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)"
      ,"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)"
      ,"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)"
      ,"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)"
      ,"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)"
      ,"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)"
      ,"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)"
      ,"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)"
      ,"org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)"
      ,"org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)"
      ,"org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)"
      ,"java.lang.Thread.run(Thread.java:662)"
      ,"org.springframework.extensions.webscripts.WebScriptException: 07040000 Wrapped Exception (with status template): null"
      ,"org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:742)"

If I use FileInputStream (in my code it is commented), IOException is rasied…

Can you help me?

__
Thanks, Alexander

Outcomes