Re: Error trying to commit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri May 23 2003 - 19:39:04 EDT

  • Next message: Andrus Adamchik: "Re: problem setting 1: n relationship"

    Adrian,

    following the stack trace of this exception, I suspect that there are
    some issues with DataNode settings. I am adding a better assertion code
    to cayenne now (to get informative message instead of
    NullPointerException), but for now could you verify a few things :

    1. Are there any warnings when you save your DataMap in the Modeler?
    Like "DataMap not linked to any DataNodes" ?
    2. Is there a DataNode configured at all?
    3. If there is, did you select OracleAdapter in DBAdapter dropdown?
    (Otherwise you would see a warning "DataNode has no DbAdapter").

    If this doesn't help, I will need to take a look at your Cayenne XML
    files.

    Andrus

    On Friday, May 23, 2003, at 05:03 PM, Marconetto, Adrian Eduardo (A.)
    wrote:

    > Hi, I´m really new using Cayenne.
    > I´m just trying the product, using a web application.
    >  
    > I think I've set up everything as stated in the docs. Then I ussed the
    > modeler to create my classes and stored them in the same package of
    > the servlet. Then I added the primary key support to the related
    > tables in my database (Oracle 9i).
    >  
    > The following code is in the doPost method of my servlet.
    >  
    > **Init method of my servlet:
    >  
    >    public void init(ServletConfig config) throws ServletException
    >    {
    >       super.init(config);
    >     // disable logging configuration attempts by Cayenne
    >      
    > org.objectstyle.cayenne.conf.Configuration.setLoggingConfigured(true);
    >     //configure log4j 
    >       BasicConfigurator.configure();
    >    }
    >
    > **In the doPost method I have this Cayenne related relevant code:
    >
    >  
    >
    >    DataContext ctxt
    > =BasicServletConfiguration.getDefaultContext(request.getSession());
    >
    >    BkbTmpConsulta consulta = (BkbTmpConsulta)
    > ctxt.createAndRegisterNewObject("BkbTmpConsulta");
    >    consulta.setBtcNroConsulta("1234");
    >   
    >    // commit to the database
    >    // using log level of WARN to show the query execution
    >    ctxt.commitChanges(Level.WARN);
    >
    >  
    >
    > But when I run the above I get:
    >
    >  
    >
    > java.lang.NullPointerException
    > at
    > org.objectstyle.cayenne.access.util.PrimaryKeyHelper.createPermIdsForOb
    > jEntity(PrimaryKeyHelper.java:137)
    > at
    > org.objectstyle.cayenne.access.ContextCommit.createPrimaryKeys(ContextC
    > ommit.java:517)
    > at
    > org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:
    > 139)
    > at
    > org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.ja
    > va:725)
    > at myPackage.MyServlet.doPost(FordXmlRec.java:70)
    > at myPackage.MyServlet.doGet(FordXmlRec.java:53)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
    > ationFilterChain.java:247)
    > at
    > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
    > terChain.java:193)
    > at
    > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
    > ve.java:243)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:566)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 472)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    > at
    > org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
    > ve.java:190)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:566)
    > at
    > org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.j
    > ava:246)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:564)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 472)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    > at
    > org.apache.catalina.core.StandardContext.invoke(StandardContext.java:23
    > 47)
    > at
    > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
    > a:180)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:566)
    > at
    > org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherV
    > alve.java:170)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:564)
    > at
    > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav
    > a:170)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:564)
    > at
    > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:46
    > 8)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:564)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 472)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    > at
    > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
    > .java:174)
    > at
    > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.j
    > ava:566)
    > at
    > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
    > 472)
    > at
    > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    > at
    > org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.
    > java:1027)
    > at
    > org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java
    > :1125)
    > at java.lang.Thread.run(Thread.java:536)
    >
    > Can any one help me?, I´m really stuck with it.
    >  
    > Thanks
    >
    > Adrián Marconetto
    >



    This archive was generated by hypermail 2.0.0 : Fri May 23 2003 - 19:38:27 EDT