Here is the stacktrace!

java.lang.NullPointerException
        at 
org.apache.cocoon.mysamples.flow.java.MyPersist.doInsertTest(MyPersist.java:80)
        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 
org.apache.cocoon.components.flow.java.JavaInterpreter.callFunction(JavaInterpreter.java:173)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:139)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.buildPipeline(ConcreteTreeProcessor.java:193)
        at 
org.apache.cocoon.components.source.impl.SitemapSource.init(SitemapSource.java:333)
        at 
org.apache.cocoon.components.source.impl.SitemapSource.<init>(SitemapSource.java:215)
        at 
org.apache.cocoon.components.source.impl.SitemapSourceFactory.getSource(SitemapSourceFactory.java:65)
        at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at 
org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143)
        at $Proxy3.getSource(Unknown Source)
        at 
org.apache.excalibur.source.impl.AbstractSourceResolver.resolveURI(AbstractSourceResolver.java:146)
        at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at 
org.apache.avalon.excalibur.component.ComponentProxyGenerator$ComponentInvocationHandler.invoke(ComponentProxyGenerator.java:143)
        at $Proxy14.resolveURI(Unknown Source)
        at 
org.apache.cocoon.components.CocoonComponentManager.resolveURI(CocoonComponentManager.java:558)
        at 
org.apache.cocoon.environment.AbstractEnvironment.resolveURI(AbstractEnvironment.java:554)
        at 
org.apache.cocoon.environment.AbstractEnvironment.resolveURI(AbstractEnvironment.java:541)
        at 
org.apache.cocoon.sitemap.ContentAggregator.setup(ContentAggregator.java:290)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:385)
        at 
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.setupPipeline(AbstractCachingProcessingPipeline.java:718)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:501)
        at 
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:453)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:144)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
        at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:118)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:47)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.MatchNode.invoke(MatchNode.java:108)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:143)
        at 
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:69)
        at 
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:235)
        at 
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:177)
        at 
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:254)
        at org.apache.cocoon.Cocoon.process(Cocoon.java:699)
        at 
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1154)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
        at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
        at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
        at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
        at 
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
        at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
        at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
        at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
        at java.lang.Thread.run(Thread.java:534)

-----Original Message-----
From: Carlos Chávez [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 17, 2008 4:34 PM
To: users@cocoon.apache.org; [EMAIL PROTECTED]
Subject: RE: using OJB for multiple insert

Hi.

Please post the stacktrace.

Cheers.
Carlos Chávez.

Мария Григорьева Escribio :-)
> Hello, it doesn't work...
> It's strange, but depts are still null...
> Maybe I should change smth in bean:
>
> package org.apache.cocoon.ojb.mysamples;
>
> import java.io.Serializable;
>
> public class Dept implements Serializable {
>
>       private int deptno;
>       private String dname;
>       private String loc;
>       public int getDeptno() {
>               return deptno;
>       }
>       public void setDeptno(int deptno) {
>               this.deptno = deptno;
>       }
>       public String getDname() {
>               return dname;
>       }
>       public void setDname(String dname) {
>               this.dname = dname;
>       }
>       public String getLoc() {
>               return loc;
>       }
>       public void setLoc(String loc) {
>               this.loc = loc;
>       }
>
>
> }
>
> -----Original Message-----
> From: Carlos Chávez [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 17, 2008 9:08 AM
> To: users@cocoon.apache.org
> Subject: Re: using OJB for multiple insert
>
> Мария Григорьева Escribio :-)
>> Hello!
>>
>> I'm using OJB!!!
>>
>> The problem is:
>>
>> I want to make a test on insert.
>>
>>
>>
>> Here is my sample-function:
>>
>>
>>
>> public void doInsertTest() {
>>
>>                 Dept[] depts = null;
>>
>>                 for (int i = 0; i < 5; i++) {
>>
>>                                depts[i].setDeptno(i);
>>
>>                                depts[i].setDname("Hello");
>>
>>                 }
>>
>>                 Object deptObj = depts;
>>
>>                 for (int i = 0; i < depts.length; i++) {
>>
>>             Dept dept = (Dept) deptObj;
>>
>>             broker.store(dept);
>>
>>         }
> Hi There.
>
> try: Dept[] depts = new Dept[5];
>
> or
>
> for (int i=1; i<=5; i++) {
>   Dept dept = new Dept();
>
>   dept.setDeptno(i);
>   dept.setDname("Hello - " + i);
>   broker.store(dept);
> }
>
> something like that.
>
> Cheers.
> Carlos Chávez.
>
>>
>>         long time = System.currentTimeMillis();
>>
>>                 sendPage("screens/test-template", new
>> VarMap().add("test",
>> time));
>>
>>     }
>>
>>
>>
>> But I've got java.lang.NullPointerException:
>>
>>
>>
>> Depts are staying null!
>>
>>
>>
>>
>>
>> What should I do?
>>
>> How to pass an array to this function?
>>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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


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

Reply via email to