When attempting to create a task to call another package from a server I get up to the point of selecting the package name. As soon as I click on that I get this error "Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) (Microsoft.SqlServer.DTSRuntimeWrap)".
I have tried changing it the TargetServerVersion, tried it in existing project, new project but so far nothing seems to work. Have done a lot of searching but nothing has helped.
Here are the underlying details of the error
Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) (Microsoft.SqlServer.DTSRuntimeWrap)
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Application.GetPackageInfos(String strFolder, String serverName, String serverUserName, String serverPassword)
at Microsoft.SqlServer.Dts.Tasks.ExecutePackageTask.PackageBrowser.<>c__DisplayClass3_0.b__0(String path)
at Microsoft.SqlServer.Dts.Tasks.ExecutePackageTask.PackageBrowser.EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value)
===================================
Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) (Microsoft.SqlServer.DTSRuntimeWrap)
Program Location:
at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.GetPackageInfos(String bstrPackageFolder, String bstrServerName, String bstrServerUserName, String bstrServerPassword)
at Microsoft.SqlServer.Dts.Runtime.Application.GetPackageInfos(String strFolder, String serverName, String serverUserName, String serverPassword)
I would expect clicking on the search box to the right would open a screen to select from the available packages on that server.
Related
I have a vb.net program that posts a JSON to a Web API and returns a Result.
When the API returns an Error I need to create a Sting of the Error to display in the Program.
I am using Newtonsoft.Json
The Error that is Returned is.
{"message":"One or more input exceptions have occurred.","errors":[{"message":"\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"name"}},{"message":"\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"base64_encoded_data"}},{"message":"\"%fieldName\" is required. Enter and try again.","parameters":{"fieldName":"type"}}],"trace":"TraceMessageHasBeenDeleted {main}"}
I have Extracted the Message by
Dim responseFromAPI As HttpResponseMessage
Dim rawResponseFromAPI As String
Dim responseFromAPIStream As Stream
Dim responseFromAPIReader As StreamReader
Dim responseFromAPIObject As JObject
' Check Result
If responseFromAPI.IsSuccessStatusCode = False Then
' Add Error to Error Collection
responseFromAPIStream = Await responseFromAPI.Content.ReadAsStreamAsync()
responseFromAPIReader = New StreamReader(responseFromAPIStream)
rawResponseFromAPI = responseFromAPIReader.ReadToEnd()
responseFromAPIObject = JObject.Parse(rawResponseFromAPI)
' Check for Message
Console.WriteLine(responseFromAPIObject("message").ToString())
CustomErrorCollection.AddError(responseFromAPIObject("message").ToString())
End If
This returns the Message "One or more input exceptions have occurred."
But I also need to extract all the "Messages" from in the "errors" section and replace the "%fieldName" with the parameter of "fieldName"
So the Final result I am looking for is a Multi line string.
"
One or more input exceptions have occurred.
name is required. Enter and try again.
base64_encoded_data is required. Enter and try again.
type is required. Enter and try again."
There is probably a very simple way to achieve this but after a couple of hours searching and experimenting I haven't got anywhere.
Many Thanks
To assist with navigating deserialized Json, it's best to make objects which represent your json properties and derserialize into those.
{
"message":"One or more input exceptions have occurred.",
"errors":[
{
"message":"\"%fieldName\" is required. Enter and try again.",
"parameters":{
"fieldName":"name"
}
},
{
"message":"\"%fieldName\" is required. Enter and try again.",
"parameters":{
"fieldName":"base64_encoded_data"
}
},
{
"message":"\"%fieldName\" is required. Enter and try again.",
"parameters":{
"fieldName":"type"
}
}
],
"trace":"TraceMessageHasBeenDeleted {main}"
}
Looking at your json example, you have three (3) main properties Message, Errors, and Trace. You can define an object that holds these properties and call
JsonConvert.DeserializeObject(Of YourRepresentativeObject)(yourJsonString)
This would look like:
Public Class ErrorResponse
Public Property Message As String
Public Property Errors As List(Of ErrorDefinition)
Public Property Trace As String
End Class
Public Class ErrorDefinition
Public Property Message As String
Public Property Parameters As Parameter
End Class
Public Class Parameter
Public Property FieldName As String
End Class
And your code to deserialize and utilize would be:
Dim responseFromAPIObject = JsonConvert.DeserializeObject(Of ErrorResponse)(rawResponseFromAPI)
Dim builder As New StringBuilder()
builder.AppendLine(responseFromAPIObject.Message) 'Get the main message
For Each definition In responseFromAPIObject.Errors 'Get the error definitions
'replace the placeholder with the parameter fieldName
builder.AppendLine(definition.Message.Replace("%fieldName", definition.Parameters.FieldName))
Next
Console.WriteLine(builder.ToString)
Final Output:
One or more input exceptions have occurred.
"name" is required. Enter and try again.
"base64_encoded_data" is required. Enter and try again.
"type" is required. Enter and try again.
I got a valid issue when I run my package. It runs failed in my PC and success in anyone else.
The error is caused by Script Component (turned red), and it is in Post Execute phase, not the post execute in the script componet, but in the runtime of package. The error is:
Information: 0x40043008 at Data Flow Task, SSIS.Pipeline: Post Execute phase is beginning.
Error: 0xC0047062 at Data Flow Task, Script Component [263]: System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{22992C1D-393D-48FB-9A9F-4E4C62441CCA}' failed due to the following error: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)).
I guess the issue is related to variables, because when I remove all the code related to variables, the package run successfully. The code in script component:
private int scheduled550;
private int scheduled620;
private int scheduled720;
private int scheduled820;
public override void PreExecute()
{
base.PreExecute();
scheduled550 = Variables.Count550;
scheduled620 = Variables.Count620;
scheduled720 = Variables.Count720;
scheduled820 = Variables.Count820;
}
public override void PostExecute()
{
base.PostExecute();
}
Did anyone ever encounter the same issue? Can anyone tell me what will POST Execute phase do? Thanks
More info: I have tried to re-install SQL Server, but this is not help. And not all the script component with variables failed running in my SSIS (not in the same package with the error one)
All the tasks/containers in an SSIS have the same lifecycle. You can see some of this by watching the Event Handlers fire. In a script component, inside a Data Flow Task, is going to under go various steps. Part of that is Validation (this contract says I should have a column from this table that is an integer type- can I connect, does it exist, is it the right type, etc).
After validation, tasks will have setup and tear down steps to perform. Since you appear to be working with SSIS Variables in your script, part of that pre/post execute time is spent allowing the translation of Variable (SSIS) to variable (.net) and back again.
Until I see the specific code in your PostExecute method that was causing the failure, I can't state what the code issue might have been.
I cannot recreate your issue. While this is the 2012 release of Integration Services, the Script Component as you are using it will behave the same. I did not send my output to Excel but that should not matter given it's the Script that is failing.
My Script component. I have selected my Variable, User::Count550 as a ReadOnly variable in the menu before editing my code.
public class ScriptMain : UserComponent
{
private int scheduled550;
public override void PreExecute()
{
base.PreExecute();
this.scheduled550 = Variables.Count550;
}
public override void PostExecute()
{
base.PostExecute();
//this.Variables.Count550 = scheduled550;
//this.VariableDispenser.LockForWrite("Count550");
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
if (true)
{
this.scheduled550++;
}
}
}
I've been searching for a solution for days now and I still cant seem to find one. I have a problem acquiring a connection in my Script component. I need to query my database to retrieve an Id to be used before I insert it in the
public override void AcquireConnections(object Transaction)
{
connMgr = base.Connections.Connection;
conn = (SqlConnection)connMgr.AcquireConnection(null);
}
I get an exception here.
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Any solutions?
For those that want to be able to do this in a Script Component:
Double Click the Script component to open the "Script Transformation Editor"
Click the "Connection Managers" list item.
Add a new Connection Manager. Select an existing ADO.NET connection manager.
Click on the "Script" list item and then the "Edit Script..." button.
You can do something like this inside your script:
using (SqlConnection connection = this.Connections.Connection.AcquireConnection(null) as SqlConnection)
{
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "SELECT [Value] FROM dbo.MyTable";
command.CommandType = CommandType.Text;
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
ProfanityWords.Add(reader.GetValue(0).ToString());
}
}
}
this.Connections.Connection.ReleaseConnection(connection);
}
ADO.NET connection manger should be created and refer into the code to type cast to the SqlConnection. If you dont have the ADO.NET connection in your SSIS pakcage you will get the TypeCast exception. Following steps should be used if you want to use the SqlConnection.
Create the ADO.NET connection.
Use the following line in your code.
var connObj = Dts.Connections["ADO.NETConnectionName"].AcquireConnection(null);
var sqlConn = (SqlConnection)connObj;
Once you done with your SQL connection. Use the following code to Close/ Release your connection.
Dts.Connections["ADO.NETConnectionName"].ReleaseConnection(connObj);
Hope this helps.
My struts2 webapp makes use of a SQL database. Within the DB access code, I've written a basic try/catch handler that catches SQL or general exceptions, writes the detail to a log file, and then continues. The hierarchy of classes is as follows:
Action method -> get or set method on Model -> DB access.
//Action method in action class
public string doActionMethod() throws Exception
{
String results = SampleModel.getResults();
}
//Model method in model class
public string getResults() throws Exception
{
String results = DBLayer.runQuery("SELECT Results FROM SampleTable WHERE Value='1');
}
//Method that queries database in DB access class
public string runQuery() throws Exception
{
ResultSet rs = null;
Connection dbConnection = null;
PreparedStatement preparedStatement = null;
dbConnection = MSSQLConnection.getConnection();
preparedStatement = dbConnection.prepareStatement(sqlQuery);
//run SQL statements
return String(rs.get(0));
}
I'd like caught exceptions to bubble up to the Action level, so that I can forward them to an appropriate error page. Is there a better way to do this than adding a "throws Exception" to the method signature?
Since you have no hope of recovery, throw an application-specific RuntimeException.
Use standard Struts 2 declarative exception handling to get your app to the appropriate error page.
I am trying to install MOSS 2007. This computer already had MOSS2007 installed, we had to uninstall MOSS2007 and install it again (for various reasons).
When we install MOSS2007, the installation completed fine but the Sharepoint Products and Technologies Configuration Wizard runs into the following problem in Step 2.
Why does it not work? What is the root cause/solution?
PS: I have SQL Server 2005 already installed on the machine.
The error message is as follows -
Failed to create the configuration database
An exception of type System.Security.Principal.IdentityNotMappedException was thrown. Additional exception information: Some or all identity references could not be translated.
The eventviewer has the stack trace -
Failed to create the configuration
database. An exception of type
System.Security.Principal.IdentityNotMappedException
was thrown. Additional exception
information: Some or all identity
references could not be translated.
System.Security.Principal.IdentityNotMappedException:
Some or all identity references could
not be translated. at
System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection
sourceAccounts, Type targetType,
Boolean forceSuccess) at
System.Security.Principal.NTAccount.Translate(Type
targetType) at
Microsoft.SharePoint.Administration.SPProcessIdentity.GetCurrentSecurityIdentifier()
at
Microsoft.SharePoint.Administration.SPProcessIdentity.GetCurrentSid()
at
Microsoft.SharePoint.Administration.SPProcessIdentity.Update()
at
Microsoft.SharePoint.Administration.SPApplicationPool.Update()
at
Microsoft.SharePoint.Administration.SPWebApplication.CreateDefaultInstance(SPWebService
service, Guid id, String
applicationPoolId, IdentityType
identityType, String
applicationPoolUsername, SecureString
applicationPoolPassword, String
iisServerComment, Boolean
secureSocketsLayer, String
iisHostHeader, Int32 iisPort, Boolean
iisAllowAnonymous, DirectoryInfo
iisRootDirectory, Uri defaultZoneUri,
Boolean iisEnsureNTLM, Boolean
createDatabase, String databaseServer,
String databaseName, String
databaseUsername, String
databasePassword,
SPSearchServiceInstance
searchServiceInstance, Boolean
isPaired, Boolean
autoActivateFeatures) at
Microsoft.SharePoint.Administration.SPAdministrationWebApplication.CreateDefaultInstance(SqlConnectionStringBuilder
administrationContentDatabase,
SPWebService adminService,
IdentityType identityType, String
farmUser, SecureString farmPassword)
at
Microsoft.SharePoint.Administration.SPFarm.CreateAdministrationWebService(SqlConnectionStringBuilder
administrationContentDatabase,
IdentityType identityType, String
farmUser, SecureString farmPassword)
at
Microsoft.SharePoint.Administration.SPFarm.CreateBasicServices(SqlConnectionStringBuilder
administrationContentDatabase,
IdentityType identityType, String
farmUser, SecureString farmPassword)
at
Microsoft.SharePoint.Administration.SPFarm.Create(SqlConnectionStringBuilder
configurationDatabase,
SqlConnectionStringBuilder
administrationContentDatabase,
IdentityType identityType, String
farmUser, SecureString farmPassword)
at
Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.CreateOrConnectConfigDb()
at
Microsoft.SharePoint.PostSetupConfiguration.ConfigurationDatabaseTask.Run()
at
Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
You must delete the config database in SQl. But also make sure you delete the previous central admin site in IIS and delete the related app pool.