Castle Windsor container.Resolve produces null reference exception - castle-windsor

In my Visual Studio environment my project that uses Castle Windsor dependency injection runs correctly.
When deployed to a target environment however, it fails to start. Capturing exceptions has show this issue:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at My.MyService..ctor()
at My.Program.Main(System.String[])
I checked registrations but everything seems OK.
Any ideas?

It turned out that my installer failed to deploy some of the dll's. Once that was fixed, the above exception disappeared.
Takeaway: when a type fails to load dependency resolution, you receive a NullReferenceExecption. It'd be more friendly to get a TypeLoadException as the framework does when a library is not available.

Related

Constructor NotImplementedException?

I am starting and doing testing with PostSharp 6.9.4 Community version, upgrading from 3.0.27 Express. Everything is fine building in VS2017, but when we queue a new build in tfs we get this error:
c:\B1\Net\SEP TR dev Visual Studio 2017\Sources\src\projectName\projectName.csproj : error LA0014: The custom attribute 'Helpers.TimeTraceAspect' constructor threw the exception NotImplementedException: The method cannot be executed at build time.
What does it mean?
Same code works and builds fine in 3.0.27 but not in 6.9.4.
I have not found any information about this error in PostSharp's support page.
Thank you for your help.

Can I deploy a Grails 4 app to Google Cloud Platform?

I have been able to run through the following Grails 3 guide for deploying a Grails application to GCP.
https://guides.grails.org/grails-google-cloud/guide/index.html
I've tried to mirror this using my own Grails 4 application but it fails when I try to access it.
appengineDeploy completes successfully but when I try and access the webapp URL, I get a long stacktrace which culminates in the following error;
Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/mysql/cj/api/io/SocketFactory
...
...
Caused by: java.lang.ClassNotFoundException: com.mysql.cj.api.io.SocketFactory
I've been trying all sorts of various versions of the socket factory dependency to try and solve and redeploy but all result in the same error.
I have used various version of the j-6 connector (com.google.cloud.sql:mysql-socket-factory-connector-j-6) and my most recent attempt used the j-8 (1.0.14).
At this point it would be great to even know if what I'm trying is even possible. Java 11 support has been added quite recently and I have made the necessary config adjustments to get my app to deploy, but I cannot then access it.
Upgrading to version 8 of mysql-connector-java in tandem with mysql-socket-factor-connector-j-8 appears to have made this particular issue go away (and moved me to the next).
Dependencies are as follows;
runtime "mysql:mysql-connector-java:8.0.15"
runtime "com.google.cloud.sql:mysql-socket-factory-connector-j-8:1.0.14"

How to configure Hudson base distribution?

I am a total newbie to the Hudson administration, so my question is very 101:
I downloaded hudson-3.0.0.war, which is said to be just the Hudson Core without any plugins included, and deployed it on my Apache Tomcat 7.0 server.
So Hudson as a web app is up, I can browse it, manage plugins via UI and so on.
But when I try to create my very first job as Build a free-style software project, I get the following exception:
HTTP Status 500 - java.lang.NoClassDefFoundError: org/eclipse/hudson/utils/tasks/MetaProject
type Exception report
message java.lang.NoClassDefFoundError: org/eclipse/hudson/utils/tasks/MetaProject
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/eclipse/hudson/utils/tasks/MetaProject
I assume that a certain plugin is missing (although I would expect that even the base distribution included such a basic task, but never mind...).
I cannot figure out which plugin I have to install in order to enable the job creation between all available plugins.
I am really hoping to any assistance with this issue, which I shall appreciate very much.
It looks like you are missing a dependency. Add to the pom.xml the dependency:
<dependency>
    <groupId>org.eclipse.hudson</groupId>
    <artifactId>hudson-plugin-utils</artifactId>
    <version>3.0.1</version>
</dependency>

how can I be notified when a bundle throws an exception in osgi runtime? (equinox helios)

If a bundle throws an exception in osgi, the stack-trace is printed on the osgi console. I want to be notified if a bundle throws an exception. I thought using osgi logging service could help about it. However I could not get it to work under Helios.
The question is how can I be notified if a bundle throws an exception in osgi Helios.
Or if osgi logging does the work, how can I get osgi logging to work in Helios? As much as I googled, there is apparently no implementation of osgi loggin service currently integrated in helios. I downloaded the equinox skd 3.6 from eclipse site that contains the bundle org.eclipse.equinox.log, however I could add it as dependency to my plugins, or install it in the osgi runtime.
Any help is really appreciated.
A bundle can only throw an exception when it is invoked. This nearly always when some other bundle invoked one of your published services, or because the bundle received a callback from the framework such as BundleActivator.start().
In the first case, OSGi has absolutely no way to know that an exception happened! Service invocations are direct method calls between two objects, and are not brokered or proxied by the OSGi framework. Therefore if you want to find out about the exception, you must catch it in the calling code.
In the second case, callbacks happen because some bundle caused them to happen. For example, a bundle will be started because some other bundle called Bundle.start(). In this case, an exception thrown from the BundleActivator.start() method would be wrapped in a BundleException that could be caught by the calling code.
So it's really all down to your code, unless you have some third-party bundles that invoke your services or start/stop your bundles (e.g. a web console, or a shell like GoGo). In this case it's down to the third party code. In most cases they should send messages to the LogService, so you should install the log bundle into your framework.
You said that you couldn't install the log bundle, but you didn't say why it failed, what the error message was etc! This kind if information is important if you want help resolving the problem.
You could try Pax Logging and a custom Log4J appender - Pax Logging provides implementations of the OSGi LogService etc as well as wrappers for common logging frameworks.
Do you want to do this purely to log/notify exceptions, or is there some other reason? An UncaughtExceptionHandler might be what you want if it's a case of managing your own or wrapped code.

Diagnosing CLR errors in Windows Event Viewer

We have an .NET desktop application that crashed in production. How do we diagnose the error? I'd like to know the type of exception that occurred, the error message, and the stack trace.
Because the exception wasn't handled by our code, we received the "This application has encountered a problem and needs to close" Windows message box. The only option was to close, there was no debug button.
This MSDN article suggested looking in the Windows Event registry. I checked there, and here's the information inside it:
Faulting application Initect.Server.UI.exe,
version 0.12.9084.90,
time stamp 0x49cac472,
faulting module KERNEL32.dll,
version 6.0.6001.18000,
time stamp 0x4791a81d,
exception code 0xe0434f4d,
fault offset 0x0002f35f,
process id 0x44c,
application start time 0x01c9ada7f320cab0
How can this information tell me the exception type, the stack trace, and the error message?
That information isn't enough to get you a stack trace, exception type, error message, etc.
You can configure Windows Error Reporting (which showed you the problem & needs to close UI) on Windows Server 2008 to always collect a dump file that you can then debug. This doesn't require you to install Visual Studio or any other debugger in your production environment.
http://blogs.technet.com/askperf/archive/2008/02/05/ws2008-windows-error-reporting.aspx shows the proper registry settings to do this.