Unknown Error With Token API



  • It's trying to access a setting that doesn't exist. Are you sure the database upgrade commands ran successfully?



  • Actually, i dont remember the error. But i also get it when i upgraded to 1.2.

    This is the error im getting from apache2/error.log

    Exception while initOnce: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
    at CloneDeploy_Services.SettingServices.GetSetting (System.String settingName) [0x00084] in <330237144396400586bdc8075697df1e>:0
    at CloneDeploy_Services.SettingServices.GetSettingValue (System.String settingName) [0x00005] in <330237144396400586bdc8075697df1e>:0
    at CloneDeploy_App.Startup.Configuration (Owin.IAppBuilder app) [0x00058] in <330e4cdf4ecd4d40a6e17f60205836b8>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <9790d962aaad40deb63d33029ba0d2f6>:0
    --- End of inner exception stack trace ---
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <9790d962aaad40deb63d33029ba0d2f6>:0
    at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <9790d962aaad40deb63d33029ba0d2f6>:0
    at Owin.Loader.DefaultLoader+<>c__DisplayClass12.<MakeDelegate>b__b (Owin.IAppBuilder builder) [0x00000] in <392be445bb6947f2a5f768f7860b8204>:0
    at Owin.Loader.DefaultLoader+<>c__DisplayClass1.<LoadImplementation>b__0 (Owin.IAppBuilder builder) [0x0004f] in <392be445bb6947f2a5f768f7860b8204>:0
    at Microsoft.Owin.Host.SystemWeb.OwinHttpModule+<>c__DisplayClass2.<InitializeBlueprint>b__0 (Owin.IAppBuilder builder) [0x00012] in <392be445bb6947f2a5f768f7860b8204>:0
    at Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize (System.Action1[T] startup) [0x00120] in <392be445bb6947f2a5f768f7860b8204>:0 at Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build (System.Action1[T] startup) [0x00014] in <392be445bb6947f2a5f768f7860b8204>:0
    at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint () [0x00018] in <392be445bb6947f2a5f768f7860b8204>:0
    at System.Threading.LazyInitializer.EnsureInitializedCore[T] (T& target, System.Boolean& initialized, System.Object& syncLock, System.Func1[TResult] valueFactory) [0x0002e] in <9790d962aaad40deb63d33029ba0d2f6>:0 at System.Threading.LazyInitializer.EnsureInitialized[T] (T& target, System.Boolean& initialized, System.Object& syncLock, System.Func1[TResult] valueFactory) [0x0000f] in <9790d962aaad40deb63d33029ba0d2f6>:0
    at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init (System.Web.HttpApplication context) [0x00000] in <392be445bb6947f2a5f768f7860b8204>:0
    at System.Web.HttpApplication.CreateDynamicModules () [0x0002c] in <347f335902b24586a53361aa1278a360>:0
    at System.Web.HttpApplication.InitOnce (System.Boolean full_init) [0x0009b] in <347f335902b24586a53361aa1278a360>:0
    Please restart your app to unlock it



  • Try running the db upgrade commands again.

    what version of mono?
    mono -V
    Try upgrading to the latest if not.



  • This is the version of mono:
    Mono JIT compiler version 5.4.0.201 (tarball Fri Oct 13 21:53:30 UTC 2017)
    Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS: __thread
    SIGSEGV: altstack
    Notifications: epoll
    Architecture: amd64
    Disabled: none
    Misc: softdebug
    LLVM: supported, not enabled.
    GC: sgen (concurrent by default)



  • This is the return when i update CD databasee

    root@clonedeploy:~# mysql clonedeploy -v -u root -p < ~/clonedeploy-1.3.0-upgrade/1.3.0-update.sql
    Enter password:

    CREATE TABLE alternate_server_ips (
    alternate_server_ip_id int(11) NOT NULL AUTO_INCREMENT,
    alternate_server_ip varchar(45) DEFAULT NULL,
    alternate_server_ip_api varchar(100) DEFAULT NULL,
    PRIMARY KEY (alternate_server_ip_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8

    ERROR 1050 (42S01) at line 1: Table 'alternate_server_ips' already exists
    root@clonedeploy:~# mysql clonedeploy -v -u root -p --execute="update images set image_environment = 'linux' where image_environment='';update images set image_environment = 'linux' where image_environment is null;"
    Enter password:

    update images set image_environment = 'linux' where image_environment=''


    update images set image_environment = 'linux' where image_environment is null



  • I have same error and same problem updating database



  • Are you certain it's the exact same error? Can you attach the front end log



  • Here is error from first db update script

    CREATE TABLE alternate_server_ips (
    alternate_server_ip_id int(11) NOT NULL AUTO_INCREMENT,
    alternate_server_ip varchar(45) DEFAULT NULL,
    alternate_server_ip_api varchar(100) DEFAULT NULL,
    PRIMARY KEY (alternate_server_ip_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8


    CREATE TABLE audit_logs (
    audit_log_id int(11) NOT NULL AUTO_INCREMENT,
    user_id int(11) DEFAULT NULL,
    audit_type tinyint(11) DEFAULT NULL,
    object_type varchar(45) DEFAULT NULL,
    object_id int(11) DEFAULT NULL,
    object_name varchar(45) DEFAULT NULL,
    ip_address varchar(45) DEFAULT NULL,
    date_time datetime DEFAULT CURRENT_TIMESTAMP,
    user_name varchar(45) DEFAULT NULL,
    object_json text,
    PRIMARY KEY (audit_log_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8

    ERROR 1067 (42000) at line 8: Invalid default value for 'date_time'



  • If I run db update script second time -

    CREATE TABLE alternate_server_ips (
    alternate_server_ip_id int(11) NOT NULL AUTO_INCREMENT,
    alternate_server_ip varchar(45) DEFAULT NULL,
    alternate_server_ip_api varchar(100) DEFAULT NULL,
    PRIMARY KEY (alternate_server_ip_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8

    ERROR 1050 (42S01) at line 1: Table 'alternate_server_ips' already exists



  • [code]
    2017-11-30 13:59:02,873 [Threadpool worker] ERROR CloneDeploy_ApiCalls.TokenApi Error With Token API: System.Xml.XmlException: Name cannot begin with the ' ' character, hexadecimal value 0x20. Lin$
    at System.Xml.XmlTextReaderImpl.Throw (System.Exception e) [0x0002a] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.Throw (System.String res, System.String[] args) [0x00029] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.Throw (System.Int32 pos, System.String res, System.String[] args) [0x0000c] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.ParseQName (System.Boolean isQName, System.Int32 startOffset, System.Int32& colonPos) [0x0009f] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.ParseQName (System.Int32& colonPos) [0x00000] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.ParseElement () [0x000f8] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.ParseElementContent () [0x001b5] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.XmlTextReaderImpl.Read () [0x00090] in <499ff02b83be4a12bd542266780a9d91>:0
    at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader r) [0x00227] in <cabf9420bcd8406382cfba3dd3c5e666>:0
    at System.Xml.Linq.XContainer.ReadContentFrom (System.Xml.XmlReader r, System.Xml.Linq.LoadOptions o) [0x00008] in <cabf9420bcd8406382cfba3dd3c5e666>:0
    at System.Xml.Linq.XDocument.Load (System.Xml.XmlReader reader, System.Xml.Linq.LoadOptions options) [0x0009b] in <cabf9420bcd8406382cfba3dd3c5e666>:0
    at System.Xml.Linq.XDocument.Parse (System.String text, System.Xml.Linq.LoadOptions options) [0x00016] in <cabf9420bcd8406382cfba3dd3c5e666>:0
    at System.Xml.Linq.XDocument.Parse (System.String text) [0x00000] in <cabf9420bcd8406382cfba3dd3c5e666>:0
    at RestSharp.Deserializers.XmlDeserializer.Deserialize[T] (RestSharp.IRestResponse response) [0x0001e] in <a413af11872d4786add172686a6728e8>:0
    at RestSharp.RestClient.Deserialize[T] (RestSharp.IRestRequest request, RestSharp.IRestResponse raw) [0x0005c] in <a413af11872d4786add172686a6728e8>:0
    2017-11-30 13:59:02,881 [Threadpool worker] ERROR CloneDeploy_ApiCalls.TokenApi Error With Token API: <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>Error 500</title>
    </head>
    <body>
    <div class="page">
    <div id="header">
    <div id="header-text">Application Exception</div>
    </div>
    <div id="main">
    <h1>System.TypeLoadException</h1>
    <h2 class="exceptionMessage">Failure has occurred while loading a type.</h2>
    <p><strong>Description:</strong> HTTP 500.Error processing request.</p><p><strong>Details:</strong> Non-web exception. Exception origin (name of application or object): CloneDeploy-App.</p>
    <div><strong>Exception stack trace:</strong></div>
    <div class="details"> at CloneDeploy_App.SwaggerConfig.Register () [0x00015] in <330e4cdf4ecd4d40a6e17f60205836b8>:0
    at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
    at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInf$
    <div style="color:Black;"><strong>Version Information:</strong> <tt>4.6.1 (Stable 4.6.1.5/ef43c15 Wed Oct 12 09:10:37 UTC 2016)</tt>; ASP.NET Version: <tt>4.0.30319.42000</tt></div>
    <div id="footer-powered-by">Powered by <a href="http://mono-project.com/">Mono</a></div>
    </div>
    </div>
    </div>
    </body>
    </html>
    [/code]



  • Are you running mysql or mariadb? What's the version number?



  • i mysql-server 5.5.52-0ubuntu0.14.04.1 all MySQL database server (metapackage depending on the latest version)
    un mysql-server-5.0 <none> <none> (no description available)
    un mysql-server-5.1 <none> <none> (no description available)
    ii mysql-server-5.5 5.5.52-0ubuntu0.14.04.1 amd64 MySQL database server binaries and system database setup
    un mysql-server-core <none> <none> (no description available)
    un mysql-server-core-5.0 <none> <none> (no description available)
    un mysql-server-core-5.1 <none> <none> (no description available)
    ii mysql-server-core-5.5 5.5.52-0ubuntu0.14.04.1 amd64 MySQL database server binaries



  • This could be database version problem, you have given me some more information, and this stands out

    ERROR 1067 (42000) at line 8: Invalid default value for 'date_time'

    So the dbupdate script probably never went past that point. I have only tested 1.3.x on Ubuntu 16 and newer, which ships with mysql 5.7. Can you update?



  • I am gonna upgrade Mysql now.



  • All good.
    I also had to Remove Debian sources and add Ubuntu 14.04 from Mono's site
    apt-get remove --purge mono-devel libapache2-mod-mono
    apt-get remove -y mono-devel libapache2-mod-mono



  • Thanks for the update