error while querying for document : Value '0000-00-00' can not be represented as java.sql.Timestamp

View: New views
5 Messages — Rating Filter:   Alert me  

error while querying for document : Value '0000-00-00' can not be represented as java.sql.Timestamp

by Bart Van den Abeele-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I have made a document via de daisy-api.  I have done something wrong because when i query for the document i get an error.  I tried to remove the document via
the document-tasks, but this would not work.  I also get an error (see bottom).  It is both caused by the same exception :
Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
 .  How can i fix this?  I work with version 2.0.1 and an upgrade is no option.  This is very urgent!

mvg,
Bart

Error :
org.mozilla.javascript.WrappedException: Wrapped org.outerj.daisy.repository.RepositoryException: Error loading document 48572-ddpittem. (#1)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1693)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:204)
        at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3085)
        at script(:1)
        at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
        at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
        at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
        at org.outerj.daisy.doctaskrunner.serverimpl.TaskRunner.run(TaskRunner.java:96)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.outerj.daisy.repository.RepositoryException: Error loading document 48572-ddpittem.
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.load(LocalDocumentStrategy.java:84)
        at org.outerj.daisy.repository.commonimpl.CommonRepository.getDocument(CommonRepository.java:190)
        at org.outerj.daisy.repository.serverimpl.LocalCommonRepository.getDocument(LocalCommonRepository.java:69)
        at org.outerj.daisy.repository.commonimpl.RepositoryImpl.getDocument(RepositoryImpl.java:123)
        at org.outerj.daisy.repository.commonimpl.RepositoryImpl.getDocument(RepositoryImpl.java:134)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:145)
        ... 9 more
Caused by: org.outerj.daisy.repository.RepositoryException: Error loading document.
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadDocumentInTransaction(LocalDocumentStrategy.java:123)
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.load(LocalDocumentStrategy.java:63)
        ... 18 more
Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
        at com.mysql.jdbc.ResultSet.getNativeTimestamp(ResultSet.java:4166)
        at com.mysql.jdbc.ResultSet.getNativeConvertToString(ResultSet.java:3419)
        at com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:4033)
        at com.mysql.jdbc.ResultSet.getNativeDate(ResultSet.java:3533)
        at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1839)
        at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1817)
        at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1865)
        at org.apache.commons.dbcp.DelegatingResultSet.getDate(DelegatingResultSet.java:183)
        at org.outerj.daisy.repository.serverimpl.model.LocalSchemaStrategy$5.getValue(LocalSchemaStrategy.java:1496)
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadFields(LocalDocumentStrategy.java:295)
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadFields(LocalDocumentStrategy.java:254)
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadVariant(LocalDocumentStrategy.java:159)
        at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadDocumentInTransaction(LocalDocumentStrategy.java:115)
        ... 19 more


 **** DISCLAIMER ****
 http://www.schaubroeck.be/maildisclaimer.htm
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: error while querying for document : Value '0000-00-00' can not be represented as java.sql.Timestamp

by Paul Focke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bart

Did you try scripting the repository using javascript?
More on the subject here
http://daisycms.org/daisydocs-2_3/373-cd/375-cd/153-cd.html

Your script should look something like

importPackage(Packages.org.outerj.daisy.repository);
importClass(Packages.org.outerj.daisy.repository.clientimpl.RemoteRepositoryManager);

var repositoryManager = new RemoteRepositoryManager("http://localhost:9263",
new Credentials("guest", "guest"));

var repository = repositoryManager.getRepository(new Credentials("testuser", "testuser"));
repository.deleteDocument('48572-ddpittem');

Run the script using daisy-js which is found in the bin directory of the binary release.
I'm not 100% if this will work since I didn't check if the document gets fetched before it's deleted. Anyway it's worth a try.

What's really curious is how the '0000-00-00' value got there in the first place. Stuff to think about.

Paul

On Wed, Aug 5, 2009 at 5:59 PM, Bart Van den Abeele <bvda@...> wrote:
Hi all,

I have made a document via de daisy-api.  I have done something wrong because when i query for the document i get an error.  I tried to remove the document via the document-tasks, but this would not work.  I also get an error (see bottom).  It is both caused by the same exception : Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
.  How can i fix this?  I work with version 2.0.1 and an upgrade is no option.  This is very urgent!

mvg,
Bart

Error : org.mozilla.javascript.WrappedException: Wrapped org.outerj.daisy.repository.RepositoryException: Error loading document 48572-ddpittem. (#1)
       at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1693)
       at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
       at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:204)
       at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3085)
       at script(:1)
       at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
       at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
       at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
       at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
       at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
       at org.outerj.daisy.doctaskrunner.serverimpl.TaskRunner.run(TaskRunner.java:96)
       at java.lang.Thread.run(Unknown Source)
Caused by: org.outerj.daisy.repository.RepositoryException: Error loading document 48572-ddpittem.
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.load(LocalDocumentStrategy.java:84)
       at org.outerj.daisy.repository.commonimpl.CommonRepository.getDocument(CommonRepository.java:190)
       at org.outerj.daisy.repository.serverimpl.LocalCommonRepository.getDocument(LocalCommonRepository.java:69)
       at org.outerj.daisy.repository.commonimpl.RepositoryImpl.getDocument(RepositoryImpl.java:123)
       at org.outerj.daisy.repository.commonimpl.RepositoryImpl.getDocument(RepositoryImpl.java:134)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:145)
       ... 9 more
Caused by: org.outerj.daisy.repository.RepositoryException: Error loading document.
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadDocumentInTransaction(LocalDocumentStrategy.java:123)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.load(LocalDocumentStrategy.java:63)
       ... 18 more
Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
       at com.mysql.jdbc.ResultSet.getNativeTimestamp(ResultSet.java:4166)
       at com.mysql.jdbc.ResultSet.getNativeConvertToString(ResultSet.java:3419)
       at com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:4033)
       at com.mysql.jdbc.ResultSet.getNativeDate(ResultSet.java:3533)
       at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1839)
       at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1817)
       at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1865)
       at org.apache.commons.dbcp.DelegatingResultSet.getDate(DelegatingResultSet.java:183)
       at org.outerj.daisy.repository.serverimpl.model.LocalSchemaStrategy$5.getValue(LocalSchemaStrategy.java:1496)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadFields(LocalDocumentStrategy.java:295)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadFields(LocalDocumentStrategy.java:254)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadVariant(LocalDocumentStrategy.java:159)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadDocumentInTransaction(LocalDocumentStrategy.java:115)
       ... 19 more


**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: error while querying for document : Value '0000-00-00' can not be represented as java.sql.Timestamp

by Bart Van den Abeele-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I solved it by modifying the value in thefields table in the database.

Grtz,
Bart

Paul Focke wrote:
Bart

Did you try scripting the repository using javascript?
More on the subject here
http://daisycms.org/daisydocs-2_3/373-cd/375-cd/153-cd.html

Your script should look something like

importPackage(Packages.org.outerj.daisy.repository);
importClass(Packages.org.outerj.daisy.repository.clientimpl.RemoteRepositoryManager);

var repositoryManager = new RemoteRepositoryManager("http://localhost:9263",

                                             new Credentials("guest", "guest"));

var repository = repositoryManager.getRepository(new Credentials("testuser", "testuser"));

repository.deleteDocument('48572-ddpittem');

  
Run the script using daisy-js which is found in the bin directory of the binary release.
I'm not 100% if this will work since I didn't check if the document gets fetched before it's deleted. Anyway it's worth a try.

What's really curious is how the '0000-00-00' value got there in the first place. Stuff to think about.

Paul

On Wed, Aug 5, 2009 at 5:59 PM, Bart Van den Abeele <bvda@...> wrote:
Hi all,

I have made a document via de daisy-api.  I have done something wrong because when i query for the document i get an error.  I tried to remove the document via the document-tasks, but this would not work.  I also get an error (see bottom).  It is both caused by the same exception : Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
.  How can i fix this?  I work with version 2.0.1 and an upgrade is no option.  This is very urgent!

mvg,
Bart

Error : org.mozilla.javascript.WrappedException: Wrapped org.outerj.daisy.repository.RepositoryException: Error loading document 48572-ddpittem. (#1)
       at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1693)
       at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
       at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:204)
       at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3085)
       at script(:1)
       at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
       at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
       at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
       at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
       at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
       at org.outerj.daisy.doctaskrunner.serverimpl.TaskRunner.run(TaskRunner.java:96)
       at java.lang.Thread.run(Unknown Source)
Caused by: org.outerj.daisy.repository.RepositoryException: Error loading document 48572-ddpittem.
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.load(LocalDocumentStrategy.java:84)
       at org.outerj.daisy.repository.commonimpl.CommonRepository.getDocument(CommonRepository.java:190)
       at org.outerj.daisy.repository.serverimpl.LocalCommonRepository.getDocument(LocalCommonRepository.java:69)
       at org.outerj.daisy.repository.commonimpl.RepositoryImpl.getDocument(RepositoryImpl.java:123)
       at org.outerj.daisy.repository.commonimpl.RepositoryImpl.getDocument(RepositoryImpl.java:134)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:145)
       ... 9 more
Caused by: org.outerj.daisy.repository.RepositoryException: Error loading document.
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadDocumentInTransaction(LocalDocumentStrategy.java:123)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.load(LocalDocumentStrategy.java:63)
       ... 18 more
Caused by: java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
       at com.mysql.jdbc.ResultSet.getNativeTimestamp(ResultSet.java:4166)
       at com.mysql.jdbc.ResultSet.getNativeConvertToString(ResultSet.java:3419)
       at com.mysql.jdbc.ResultSet.getNativeString(ResultSet.java:4033)
       at com.mysql.jdbc.ResultSet.getNativeDate(ResultSet.java:3533)
       at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1839)
       at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1817)
       at com.mysql.jdbc.ResultSet.getDate(ResultSet.java:1865)
       at org.apache.commons.dbcp.DelegatingResultSet.getDate(DelegatingResultSet.java:183)
       at org.outerj.daisy.repository.serverimpl.model.LocalSchemaStrategy$5.getValue(LocalSchemaStrategy.java:1496)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadFields(LocalDocumentStrategy.java:295)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadFields(LocalDocumentStrategy.java:254)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadVariant(LocalDocumentStrategy.java:159)
       at org.outerj.daisy.repository.serverimpl.LocalDocumentStrategy.loadDocumentInTransaction(LocalDocumentStrategy.java:115)
       ... 19 more


**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy


_______________________________________________ daisy community mailing list Professional Daisy support: http://outerthought.org/en/services/daisy/support.html mail to: daisy@... list information: http://lists.cocoondev.org/mailman/listinfo/daisy

**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: error while querying for document : Value '0000-00-00' can not be represented as java.sql.Timestamp

by Bruno Dumon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Aug 6, 2009 at 8:39 AM, Bart Van den Abeele<bvda@...> wrote:
> Hi,
>
> I solved it by modifying the value in thefields table in the database.

Can you share the code fragment which resulted in the creation of this document?

--
Bruno Dumon
Outerthought ~ http://outerthought.org/
Daisy ~ http://www.daisycms.org/
Kauri ~ http://www.kauriproject.org/
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: error while querying for document : Value '0000-00-00' can not be represented as java.sql.Timestamp

by Bart Van den Abeele-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We made our own framework around the daisy-api.  I'll post i bit.  I hope it helps.  I had this dateformatter : public static DateFormat fm = new SimpleDateFormat("dd/MM/yyyy"); .  The date that caused the problem : 12/03/20074 .  Notice that the year is 20074!  That caused the problem.


Fragment 1# HeemkundeProcessor.java
            DigidocumentDetail detail = digidocService.newCustomDigidocument("Heemkunde");
            Map<String, Object> fields = new HashMap<String, Object>();
           
            Heemkunde heem = list.get(0);
            // de velden invullen
            fields.put("onderwerp", heem.getOnderwerp());
            fields.put("soort_heemkunde", heem.getSoort());
            fields.put("eigenaar", heem.getEigenaar());
            fields.put("datum_ontvangst", heem.getDateOntvangst());
            fields.put("datum_gemaakt", heem.getDatumGemaakt());
            fields.put("locatie", heem.getLocatie());
           
            String[] wat = null;
            if (StringUtils.isNotBlank(heem.getWat()))
                wat = StringUtils.split(heem.getWat(), "\n");
           
            String[] wie = null;
            if (StringUtils.isNotBlank(heem.getWie()))
                wie = StringUtils.split(heem.getWie(), "\n");
           
           
            fields.put("wat_heemkunde", wat );
            fields.put("wie_heemkunde", wie);
           
            detail.setUnknownFields(fields);
           
            Attachement pic = pictureFacade.newPicture(new File((String)map.get(fileNameField)));
            detail.getPictures().add(pic);
           
            try
            {
                for (Attachement picture : detail.getPictures())
                {
                    // realizatie van pictures
                    pictureFacade.loadAnyLocalFileInMemory(picture);
                }
                digidocService.insertOrUpdate(detail);   
            }
            catch (Exception e)
            {
                message(map, " FOUT BIJ INSERT/UPDATE ");
            }

Fragment 2# Heemkunde.java

    public static DateFormat fm = new SimpleDateFormat("dd/MM/yyyy");

    public Date getDateOntvangst()
    {
        if (StringUtils.isNotBlank(datumOntvangst))
            try
            {
                    return fm.parse(datumOntvangst);   
            }
            catch (Exception e)
            {
                throw new RuntimeException("error");
            }           
        else
            return null;
    }



Bruno Dumon wrote:
On Thu, Aug 6, 2009 at 8:39 AM, Bart Van den Abeelebvda@... wrote:
  
Hi,

I solved it by modifying the value in thefields table in the database.
    

Can you share the code fragment which resulted in the creation of this document?

  

**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy