dhenning - Wednesday, August 1, 2007 8:25 AM:
I have set up an action as a type Item, Server based to be able to execute against an instance of a QS Issue. I get this error:
Exception during initialization ApplyItem(InnovatorDatabaseException: Invalid operation. The connection is closed.)Exception during initialization ApplyItem(InnovatorDatabaseException: Invalid operation. The connection is closed.) InnovatorDatabaseException: Invalid operation. The connection is closed. Aras.Server.Core.InnovatorDatabaseException InnovatorCore at Aras.Server.Core.InnovatorSQLServerDatabase.BeginTransaction(IsolationLevel level) at Aras.Server.Core.InnovatorSQLServerDatabase.BeginTransaction() at Aras.Server.Core.Startup.innovatorserver_main_dispatch() at Aras.Server.Core.Startup.innovatorserver_main()at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) at System.Environment.get_StackTrace() at Aras.Server.Core.XML.SetErrorMessage(XmlDocument& xmlDom, Int64 faultCode, String& errorMessage, String& dbMessage) at Aras.Server.Core.Startup.SetErrorMessageFromException(XmlDocument aDom, String amsg, Exception e) at Aras.Server.Core.Startup.innovatorserver_main() at ASP.innovatorserver_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in D:AppsInnovator81InnovatorServerInnovatorServer.aspx:line 20 at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.innovatorserver_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) at System.Web.HttpApplication.ResumeSteps(Exception error) at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr) at System.Web.Hosting.ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
That seems to be a fairly low-level error, but i don't have a clue what my problem really is. I did this same thing in our development database and it was working. So I copied the method code and pasted it into this production environment and created the action - but this popped up. Does this error tell anyone what is really going on?
Thanks for helping to reduce the ignorance of the world (me, mostly).
Dennis
Bill - Wednesday, August 1, 2007 10:38 AM:
Hi Dennis,
The connection closed sounds like some kind of authentication problem.
Does this method have a RunAs user in the original database? Can you post the method?
-Bill
dhenning - Wednesday, August 1, 2007 11:34 AM:
Bill:
1.) the methods in both environments do NOT have a run as user set.
2.) the mehtod-config.xml files for both are the same - no diff's found.
3.) Here is the code from the failing method:
' History
' peter 02.09.2007 cleanup after method-config.xml changes
' peter 02.13.2007 changedd template to VBMain and added return message to the client
' dennis 07.18.2007 this was copied from other process to set up testing for a
' point-to-point type communication to do application specific
' tasks based on the outgoing message. Response would be either
' ok or an expected datum.
'
' =======================================================================================
' NOTE the next commented line is a directive to the Innovator
' method compiler, specifying which template in method-config.xml to use
' MethodTemplateName=VBMain;
' using Innovator WriteDebug to create entries in a Log file (since there is not console)
' look in d:appsinnovator81innovatorserver emp to see the log files
'The following 4 defaults could be set in an itemtype of Sonic based on the
'value of the corp_plant property in the driving/invoking item
'Declare the program constants
Dim DEFAULT_BROKER_NAME As String Dim DEFAULT_USERNAME As String Dim DEFAULT_PASSWORD As String Dim DEFAULT_SONIC_QUEUE As String'Declare the user input variables.
Dim broker As String Dim userName As String Dim password As String Dim sendQueueName As String'Declare the global messaging objects.
Dim connectionFactory As Sonic.JMS.Cf.Impl.QueueConnectionFactory Dim connection As Sonic.Jms.QueueConnection Dim session As Sonic.Jms.QueueSession Dim sendDestination As Sonic.JMS.Queue Dim requestor As Sonic.JMS.QueueRequestorDim requestString As String Dim requestText As Sonic.JMS.TextMessage
Dim responseString As String Dim responseText As Sonic.JMS.TextMessage Dim responseMessage As Sonic.Jms.Message
Function
Main()
CCO.Utilities.WriteDebug(
"QADAppTest","quality alert Program Start at " & today() ) Dim myInnovator As Innovator = Me.newInnovator() ' retrieve broker access info from itemtype SonicAPI Dim sonicInfo As Item Dim sonicAPI As Item = Me.newItem("SonicAPI OAC","get")sonicAPI.setProperty(
"sonic_queue_oac","SampleQ1")sonicInfo
= sonicAPI.apply() If sonicInfo.isError() Then Return myInnovator.newResult("Quality Alert to QAD Failed...Sonic Broker cannot be found") End If 'Set Data from SonicAPIDEFAULT_BROKER_NAME
= sonicInfo.getProperty("sonic_broker_url_oac")DEFAULT_USERNAME
= sonicInfo.getProperty("sonic_user_oac")DEFAULT_PASSWORD
= sonicInfo.getProperty("sonic_pwd_oac")DEFAULT_SONIC_QUEUE
= sonicInfo.getProperty("sonic_queue_oac")
CCO.Utilities.WriteDebug(
"QADAppTest", "Sonic API Setup " & sonicInfo.getProperty("sonic_broker_url_oac") _&
" user: " & sonicInfo.getProperty("sonic_user_oac") _&
" pwd: " & sonicInfo.getProperty("sonic_pwd_oac") _&
" que: " & sonicInfo.getProperty("sonic_queue_oac") )' get the part number Presume QS Issue is context Innovator
Dim PartId = Me.getproperty("part")Dim vAlert = Me.getproperty("description") Dim corpPlant = Me.getproperty("corp_plant") Dim partNumber As String Dim result As Item Dim y As item = Me.newItem("SQL", "SQL PROCESS")
CCO.Utilities.WriteDebug(
"QADAppTest", "Before SQL Setup " & today() )y.setProperty(
"name", "getPartNumber_OAC")y.setProperty(
"PROCESS", "CALL")y.setProperty(
"ARG1", PartId)result
= y.apply()CCO.Utilities.WriteDebug(
"QADAppTest", "After SQL part Result " ) If result.isError() Then Return myInnovator.newResult("Quality Alert to QAD Failed...part not found") End If If Not result.getResult() = "" ThenpartNumber
=result.getResult()CCO.Utilities.WriteDebug(
"QADAppTest", "Return Part = " & partNumber ) End IfCCO.Utilities.WriteDebug(
"QADAppTest","QATest_Alert: " + vAlert )CCO.Utilities.WriteDebug(
"QADAppTest","QATest_Plant Site: " + corpPlant )broker
= DEFAULT_BROKER_NAMEuserName
= DEFAULT_USERNAMEpassword
= DEFAULT_PASSWORDsendQueueName
= DEFAULT_SONIC_QUEUETry ' Create an instance of the connection factory
connectionFactory
= New Sonic.JMS.Cf.Impl.QueueConnectionFactory (broker) ' Make a connection to the brokerconnection
= ConnectionFactory.createQueueConnection (userName, password) ' Establish a sessionsession
= connection.createQueueSession(False, Sonic.Jms.SessionMode.AUTO_ACKNOWLEDGE) ' Make a queue object for the requested send queue If (sendqueuename.Length <> 0) Then 'CCO.Utilities.WriteDebug("QADAppTest","QATest Creating send queue")sendDestination
= Session.createQueue(sendQueueName) 'CCO.Utilities.WriteDebug("QADAppTest","QATest Creating send queue - successful") End If Catch e As ExceptionCCO.Utilities.WriteDebug(
"QADAppTest","QATest Failed to setup connection to broker - " & broker & " : " & e.Message)Done()
Return(myInnovator.newResult("QADAppTest Failed to setup connection to broker - " & broker & " : " & e.Message)) End Try 'Start the connection 'CCO.Utilities.WriteDebug("QADAppTest","QATest Connection.start a")Connection.start()
'CCO.Utilities.WriteDebug("QADAppTest","QATest Connection.start b")requestor
= New Sonic.Jms.QueueRequestor(Session, SendDestination) 'CCO.Utilities.WriteDebug("QADAppTest","QATest after Requestor")'<?xml version="1.0" encoding= "UTF-8" ?>
requestString
= "<QualityAlert center=""" _ + corpPlant + """ addedattr=""testing""><PartNumber>" + partNumber + "</PartNumber>" _ + "<Alert>" + vAlert + "</Alert></QualityAlert>" ' Create a text messagerequestText
= session.createTextMessage()requestText.setText(requestString)
'CCO.Utilities.WriteDebug("QADAppTest","before response")
responseMessage
= requestor.request(requestText) 'CCO.Utilities.WriteDebug("QADAppTest","after response")
responseText
= CType(responseMessage, Sonic.Jms.textMessage)responseString
= responseText.getText()
CCO.Utilities.WriteDebug(
"QADAppTest","returned message =" + responseString)
Done()
Return (myInnovator.NewResult(responseString))End Function
Sub
Done() Try If Not(Connection Is Nothing) ThenConnection.
Close() 'CCO.Utilities.WriteDebug("QADAppTest","Connection Closed") End If Catch e As ExceptionCCO.Utilities.WriteDebug(
"QADAppTest","Failure in closing connection - " & e.Message) End TryEnd Sub
4.) For your comparison, here is code from method that works in other environment:
' History
' peter 02.09.2007 cleanup after method-config.xml changes
' peter 02.13.2007 changedd template to VBMain and added return message to the client
' dennis 07.18.2007 this was copied from other process to set up testing for a
' point-to-point type communication to do application specific
' tasks based on the outgoing message. Response would be either
' ok or an expected datum.
'
' =======================================================================================
' NOTE the next commented line is a directive to the Innovator
' method compiler, specifying which template in method-config.xml to use
' MethodTemplateName=VBMain;
' using Innovator WriteDebug to create entries in a Log file (since there is not console)
' look in d:appsinnovator81innovatorserver emp to see the log files
'The following 4 defaults could be set in an itemtype of Sonic based on the
'value of the corp_plant property in the driving/invoking item
'Declare the program constants
Dim DEFAULT_BROKER_NAME As String = "intranet.ogihara.com:4000" Dim DEFAULT_USERNAME As String = "Administrator" Dim DEFAULT_PASSWORD As String = "Administrator" Dim DEFAULT_SONIC_QUEUE As String = "SampleQ1"'Declare the user input variables.
Dim broker As String Dim userName As String Dim password As String Dim sendQueueName As String'Declare the global messaging objects.
Dim connectionFactory As Sonic.JMS.Cf.Impl.QueueConnectionFactory Dim connection As Sonic.Jms.QueueConnection Dim session As Sonic.Jms.QueueSession Dim sendDestination As Sonic.JMS.Queue Dim requestor As Sonic.JMS.QueueRequestorDim requestString As String Dim requestText As Sonic.JMS.TextMessage
Dim responseString As String Dim responseText As Sonic.JMS.TextMessage Dim responseMessage As Sonic.Jms.Message
Function
Main()
CCO.Utilities.WriteDebug(
"QADAppTest","quality alert Program Start at " & today() ) Dim myInnovator As Innovator = Me.newInnovator() ' retrieve broker access info from itemtype SonicAPI Dim sonicInfo As Item Dim sonicAPI As Item = Me.newItem("SonicAPI OAC","get")sonicAPI.setProperty(
"sonic_queue_oac","SampleQ1")sonicInfo
= sonicAPI.apply() If sonicInfo.isError() Then Return myInnovator.newResult("Quality Alert to QAD Failed...Sonic Broker cannot be found") End If 'Set Data from SonicAPIDEFAULT_BROKER_NAME
= sonicInfo.getProperty("sonic_broker_url_oac")DEFAULT_USERNAME
= sonicInfo.getProperty("sonic_user_oac")DEFAULT_PASSWORD
= sonicInfo.getProperty("sonic_pwd_oac")DEFAULT_SONIC_QUEUE
= sonicInfo.getProperty("sonic_queue_oac")
CCO.Utilities.WriteDebug(
"QADAppTest", "Sonic API Setup " & sonicInfo.getProperty("sonic_broker_url_oac") _&
" user: " & sonicInfo.getProperty("sonic_user_oac") _&
" pwd: " & sonicInfo.getProperty("sonic_pwd_oac") _&
" que: " & sonicInfo.getProperty("sonic_queue_oac") )' get the part number Presume QS Issue is context Innovator
Dim PartId = Me.getproperty("part")Dim vAlert = Me.getproperty("description") Dim corpPlant = Me.getproperty("corp_plant") Dim partNumber As String Dim result As Item Dim y As item = Me.newItem("SQL", "SQL PROCESS")
CCO.Utilities.WriteDebug(
"QADAppTest", "Before SQL Setup " & today() )y.setProperty(
"name", "getPartNumber_OAC")y.setProperty(
"PROCESS", "CALL")y.setProperty(
"ARG1", PartId)result
= y.apply()CCO.Utilities.WriteDebug(
"QADAppTest", "After SQL part Result " ) If result.isError() Then Return myInnovator.newResult("Quality Alert to QAD Failed...part not found") End If If Not result.getResult() = "" ThenpartNumber
=result.getResult()CCO.Utilities.WriteDebug(
"QADAppTest", "Return Part = " & partNumber ) End IfCCO.Utilities.WriteDebug(
"QADAppTest","QATest_Alert: " + vAlert )CCO.Utilities.WriteDebug(
"QADAppTest","QATest_Plant Site: " + corpPlant )broker
= DEFAULT_BROKER_NAMEuserName
= DEFAULT_USERNAMEpassword
= DEFAULT_PASSWORDsendQueueName
= DEFAULT_SONIC_QUEUETry ' Create an instance of the connection factory
connectionFactory
= New Sonic.JMS.Cf.Impl.QueueConnectionFactory (broker) ' Make a connection to the brokerconnection
= ConnectionFactory.createQueueConnection (userName, password) ' Establish a sessionsession
= connection.createQueueSession(False, Sonic.Jms.SessionMode.AUTO_ACKNOWLEDGE) ' Make a queue object for the requested send queue If (sendqueuename.Length <> 0) Then 'CCO.Utilities.WriteDebug("QADAppTest","QATest Creating send queue")sendDestination
= Session.createQueue(sendQueueName) 'CCO.Utilities.WriteDebug("QADAppTest","QATest Creating send queue - successful") End If Catch e As ExceptionCCO.Utilities.WriteDebug(
"QADAppTest","QATest Failed to setup connection to broker - " & broker & " : " & e.Message)Done()
Return(myInnovator.newResult("QADAppTest Failed to setup connection to broker - " & broker & " : " & e.Message)) End Try 'Start the connection 'CCO.Utilities.WriteDebug("QADAppTest","QATest Connection.start a")Connection.start()
'CCO.Utilities.WriteDebug("QADAppTest","QATest Connection.start b")requestor
= New Sonic.Jms.QueueRequestor(Session, SendDestination) 'CCO.Utilities.WriteDebug("QADAppTest","QATest after Requestor")'<?xml version="1.0" encoding= "UTF-8" ?>
requestString
= "<QualityAlert center=""" _ + corpPlant + """ addedattr=""testing""><PartNumber>" + partNumber + "</PartNumber>" _ + "<Alert>" + vAlert + "</Alert></QualityAlert>" ' Create a text messagerequestText
= session.createTextMessage()requestText.setText(requestString)
'CCO.Utilities.WriteDebug("QADAppTest","before response")
responseMessage
= requestor.request(requestText) 'CCO.Utilities.WriteDebug("QADAppTest","after response")
responseText
= CType(responseMessage, Sonic.Jms.textMessage)responseString
= responseText.getText()
CCO.Utilities.WriteDebug(
"QADAppTest","returned message =" + responseString)
Done()
Return (myInnovator.NewResult(responseString))End Function
Sub
Done() Try If Not(Connection Is Nothing) ThenConnection.
Close() 'CCO.Utilities.WriteDebug("QADAppTest","Connection Closed") End If Catch e As ExceptionCCO.Utilities.WriteDebug(
"QADAppTest","Failure in closing connection - " & e.Message) End TryEnd Sub
Hope this helps.
Bill - Wednesday, August 1, 2007 12:06 PM:
Hi Dennis,
Can you check if the "getPartNumber_OAC" SQL Item is in the database, and if it has the property "Is Stale" = 1?
If it isn't there you will need to import it. If it is there, but is stale, you will need to right click on the SQL item and select SQL Execute from the context menu.
Let me know what you find.
-Bill
dhenning - Wednesday, August 1, 2007 1:18 PM:
Bill:
Once again, you're the man.....the sql was missing from the production environment.....it would have been nice if the error message would have given a hint like that, but can you tell me the chain of questions you were asking yourself that brought you to see this? I feel I should have had that insight from the start, and any hints on the thought process could mean the fewer times I have to bug you with such rookie mistakes.
Thanks Bill.
-Dennis
Bill - Wednesday, August 1, 2007 2:04 PM:
Glad it worked.
No terribly complicated chain of thought. The error was about a database exception, so I looked for anything about connections in the method. I saw a SQL item being called and decided to check if the SQL was there and executed, since you made no mention of it previously.
When moving from one environment to the other it is a common mistake to forget to export a something like list or something else that was created early and not modified much. (It's not a "rookie" thing. I do it too.)
Ask again, anytime.
-Bill