Why would my Mule project suddenly start complaining about "Invalid keystore format" - mule

While trying to learn how to use the Imap connector in Mule studio, I came across this tutorial. I downloaded it and imported it into AnyPoint studio as a project, and as it were in that tutorial, it worked great (after sending the connector to the right host/port etc.) I then did a quick edit to change the flow to something like this:
IMAP response -> Email to String transormer -> Log this string in the console
And all was well and good. I then went in to the properties of the connector configuration, and changed it so that emails would not be deleted after they're read in, and everything broke. When trying to run the Mule project, I get a long list of errors, starting with:
java.io.IOException: Invalid keystore format
And later down the list:
org.mule.module.launcher.DeploymentInitException: IOException: Invalid keystore format
Which is relentlessly frustrating because really I didn't do anything to the connector's configuration aside from allowing it to keep emails in the inbox of the email that is being used in the IMAP connector. Even if doing something like that were to throw this kind of exception, after changing the configuration back to the way it was when the tutorial was working fine, I still get the same errors and the project fails to deploy.

I suspect that you edited the flow in visual mode instead of XML and that Studio has transformed this (which came from the download):
<imaps:connector checkFrequency="100" doc:name="IMAP" name="imapsConnector" validateConnections="true">
</imaps:connector>
into that:
<imaps:connector checkFrequency="100" doc:name="IMAP" name="imapsConnector" validateConnections="true">
<imaps:tls-client path="" storePassword="" />
<imaps:tls-trust-store path="" storePassword="password" />
</imaps:connector>
i.e. empty tls element(s) got injected thus messing your configuration up.

Related

Anypoint Platform application name missing (flowVars._clientName)

I am facing a weird problem today, when running my MuleSoft application locally from my AnypointStudio and firing a request from postman, I am getting 403 error. When debugging I found out that the application is checking for flowVars._clientName, however it is missing. According to this documentation, actually yes flowVars._clientName is expected.
https://help.mulesoft.com/s/article/How-to-get-the-client-application-name-in-a-flow-based-on-the-client-id-and-client-secret.
So my application fails with 403 error. Seems that other environments are working perfectly fine.
And yes it is using Client Id enforcement.
Any clues?
Without more details it looks like the issue is inside the logic of your application. The KB article that you referenced is a how to in case you need to obtain the client name. It doesn't say that you have to use for authentication. You don't describe how the application does authentication/authorization. Is it in a flow? Or in a policy? If it is the standard Client ID enforcement policy, the expressions to evaluate client id and secret can be configured, but I don't think the default is not #[flowVars._clientName] nor #[flowVars._clientId].
Note that Exchange is basically a repository of APIs and other artifacts. It doesn't authenticate anything at execution time. Unless your application is trying to use it somehow, but I can't think of a reason for that.
The issue was resolved only by re-downloading Anypoint Studio and mule runtime. Very weird, it was happening only for one application, not for the others. Creating a new workspace did not help, deleting the application and re-cloning and installing did not help, even recloning in a new directory did not help. Only using a new Anypoint Studio and runtime installation resolved it (even with the old code base) ...

ASP.NET Core hosting - 500 internal server error

I am trying to publish as ASP.NET Core project with a hosting provider that supports ASP.NET Core. I am getting 500 Internal Server Error which I believe is very common. So I searched through the internet and various forums and then I checked the processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" in web.config and they look to be correctly converted with processPath="dotnet" and arguments=".\MyApplication.dll".
I also checked the connection string and it points to production DB server that's working. I confirmed the DB connection by changing the connection string to production DB and running project local. It works and I get the production DB access.
I also tried to get the error info by using the below in my Startup.cs (irrespective of env):
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseBrowserLink();
I have also enabled stdoutLog in web.config, but I don't see that folder either:
stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"
I also tried to change applicationUrl and launchUrl in launchSettings.json to my prod Url, but that didn't work as well.
So, the 500 Internal Server Error refuses to go away, and I still don't have a useful error message. The page just says:
Oops.
500 Internal Server Error
An error occurred while starting the application.
I would really appreciate if someone could help me here.
I have also enabled stdoutLog in web.config as but I don't see that folder either:
stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout"
There is one trick here - you must create both folders logs and stdout manually - then and only then IIS will create log file inside logs folder (not stdout as you could expect) - don't ask me why, because I don't know why ;)
Oops. 500 Internal Server Error An error occurred while starting the application.
Usually, means problems with a configuration in Startup.cs - the most common problems include an issue with DB itself, an issue with migrations (if you are using Code First approach), problems with appsettings.js, problems with Social Logins credentials (like missing SecretKey)...
Please refer to log file in .\logs\stdout - this is the quickest way to find details about the problem :)
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
Those will work after your WebApp fully started, but not while starting the application.
in web.config file change modules="AspNetCoreModuleV2" to modules="AspNetCoreModule"
and watch this video
https://www.youtube.com/watch?v=clCR3k6kkD8
Thanks to Lukasz for his comments. I was able to see the log and it stated that "ClientId option must be provided". The problem was with the UserSecrets. Since secrets.json is only available in Development, there were no secrets found in Production. Once I had the secrets in my appSettings.json, it worked fine.
Moreover, To replicate this in Local environment, just go to Project properties and change the environment variable ASPNETCORE_ENVIRONMENT to 'Production' and run in local. This will replicate the 500 Internal Server Error in local and you'll get the error message.
Also, ensure that the ASP.NET Core Windows Server Hosting bundle is installed. THis creates a reverse proxy between IIS and the Kestral server.
More Info:
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x#tabpanel_tfsY37MhAQ_aspnetcore2x
I would like to add some more info to #Lukasz Makowej answer.
I found out the reason why to have to create the folder, in microsoft documentation it is said that:
stdoutLogFile - Optional string attribute.
".....Any folders provided in the path must exist in order for the module to create the log file...."
So you have to create it yourself :)
Check it out here:
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.0
I also must said that in my case I had to validate that the web-site had the permissions to access to the "log" folder.
Make sure your web.config is good. I've been stomped more than once by a syntactically good web.config that referred to a module (Rewrite) that wasn't on the server. No error messages anywhere, other than the 500 response error.
Std log wasn't working for me, I had to uninstall all .ENT Core runtime / SDK versions from the server and my local to install the latest one and it worked after publishing everything again from scratch.
Another thing that helped was binding the IIS app to port 5000 without any dns so it actually showed me errors on http://localhost:5000
Encountered this issue yesterday, we also had no logging, no eventlog message whatsoever.
Then we checked the site's authentication settings via the IIS-manager to double-check the settings. And pop suddenly a popup with an error message 'Error on line XXXX'.
Turned out the configuration section was locked in the website's config at server-level.
So try unlocking the relevant IIS configuration settings at server level, as follows:
Open IIS Manager
Select the server in the Connections pane
Open Configuration Editor in the main pane
In the Sections drop down, select the section to unlock, e.g. system.webServer => security => authentication
Click Unlock Attribute in the right pane
Repeat for any other settings which you need to unlock
Restart IIS (optional) - Select the server in the Connections pane, click Restart in the Actions pane

Error while enter URL in WSDL location in SoapUI

I have got below error message when I have enter the URL in WSDL location
Error loading [http://www.mobilefish.com/services/web_service/countries.php?wsdl]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Reference to undefined entity: nbs
I've got the same problem.
I did try to download the wsdl and import the downloaded wsdl... it didn't solve. I also try to found the "entity nbsp" on the file with no results.
This problem is not related with your wsdl but it's a soapUI problem. I had this problem with 5.0.0 version and i installed the 4.5.1 version and it worked =)
Just a note: look out with the proxy setting problem. This version is affected by this problem.. the solution is easy and it's here
So, if you are trying to access a WSDL the first thing i would recommend is try to open it in a web browser(any will do...yes even IE). Do this from the same machine from where you are going to run the test.
This will tell you if you have access to the WSDL from your test machine and if the WSDL is valid.
Once the WSDL opens, copy the URL into the soapUI's new project dialog box. This will create nodes for all service operations in the service and if you have the option selected, it will also create a sample request for each service option.
This is what a wsdl open in a browser(chrome in this case looks like)
This is what the soapUI new project dialog box looks like. Do remember to check "Create sample requests for all operations?" option to create sample requests. You can give it any name..i called it stackoverflow
This is what a wsdl loaded into soapUI looks like, notice the different sub nodes?
If you are looking for WSDL to play with..check out the ones listed on xmethods or webservcex.
Hope this answers both this questions and the other one

Mule SFTP credentials

Mule 3.3.1 CE
The SFTP endpoint appears to have problems with user names with the '#' character in them. For example, both of the following fail although the address works in other tools.
<sftp:outbound-endpoint address="sftp://test04#caqa.com:Test1234#testftpdev.caqa.com" outputPattern="#[function:datestamp].xml"/>
<sftp:outbound-endpoint exchange-pattern="one-way" outputPattern="#[function:datestamp].xml" host="testftpdev.caqa.com" port="22" path="/" user="test04#caqa.com" password="Test1234" responseTimeout="10000"/>
The error message is:
Error during login to null#null
com.jcraft.jsch.JSchException: username must not be null.
...etc.
Trying against a site that allows user names without the '#' (e.g., 'test04') seems to work fine through the connector.
Since I have no control over the user names at some of the required target sites, does anyone know of a workaround for this? It needs to run in 3.3.1 CE as we won't be onto 3.4 Enterprise for another couple of months.
You need to URL encode the name and password to take care of this situation.

OData / WCF Data Service - HTTP 500 Error

I have created an OData/WCF service using Visual Studio 2010 on Windows XP SP3 with all current patches installed.
When I click on "view in browser", the service opens and I see the 3 tables from my EF model. However, when I add a table name ("Commands" in this case) to the end of the query string, rather than seeing the data from the table, I get an HTTP 500 error.
(This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.).
I have not only followed the examples from 2 sites, but have also tried running the sample application that the blog poster sent me (that works on his machine), and still am not having any luck.
The blog post is at Exposing OData from an Entity Framework Model
Does anyone have an idea why this is occurring and how to resolve it?
Here is the output of the "View in Browser":
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
- <service xml:base="http://localhost:1883/VistaDBCommandService.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
- <workspace>
<atom:title>Default</atom:title>
- <collection href="Commands">
<atom:title>Commands</atom:title>
</collection>
- <collection href="Databases">
<atom:title>Databases</atom:title>
</collection>
- <collection href="Statuses">
<atom:title>Statuses</atom:title>
</collection>
</workspace>
</service>
Update:
In an effort to get this working, I have:
Removed and re-installed IIS
Ran the %WINDIR%\Microsoft.Net\Framework\v4.0.30319\aspnet_regiis –i –enable command
Ran the %WINDIR%\Microsoft.Net\Framework\v4.0.30319\ServiceModelReg.exe -r command.
Created a new solution and followed the instructions very carefully to assure that I
didn't mess anything up.
After all of this, I am still getting the same HTTP 500 error, with no entries of any kind in the Event Viewer.
Any other ideas?
I figured out that my problem was an issue with opening the database. The way I figured it out was to add the following to the servicename.svc.cs file in the InitializeService method:
config.UseVerboseErrors=true;
Thanks to all who tried to help.
Eric
config.UseVerboseErrors=true; helped me in finding out the problem. The problem was I was using windows authentication for database connection. After changing to SQL Server Authentication everything worked fine.
Please try these debugging tips to see the actual error which happened:
Link
500 always means there was an unhandled exception in the service. Go look in the windows event log to see what that error was.
Received similar output with VS2013:
Resolved by upgrading the Entity Framework.
See answer https://stackoverflow.com/a/21028123/2116188.
You can also activate Failed Request Tracing for your Web Application in IIS
then you will get detailled trace execution in Xml files from IIS when a 500 error occurs
There is a good article here explaining how to setup Failed Request Tracing in IIS :
Using Failed Request Tracing to Trace Rewrite Rules
HTH
Cédric
If you are using SQL Server Compact data file (Like NorthWind.sdf) you need to give write file permission to IUSRS group.
Ex: If you are using NorthWind.sdf in DataDirectory i.e. YourWeb/App_Data then you need to give write permissions to _IUSRS group from IIS Console or from Windows Explorer.