Plugin Skype notification

Hello,

I created and packaged a plugin to get skype notifications.
When launching TeamCity server i get the following:

[2010-11-22 17:33:25,474]  ERROR - gins.spring.SpringPluginLoader - Failed to initialize spring context for plugin SkypeNotifier

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SkypeNotifier' defined in URL [file:/D:/TeamCity/temp/spring-SkypeNotifier3189163644160665392-spring.config.tmp.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.SkypeNotifier]: Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError: Can't load library: d:\TeamCity\temp\skype.dll


Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.SkypeNotifier]: Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError: Can't load library: d:\TeamCity\temp\skype.dll

My plugin jar is a simple java file with an external ressource (Skype4Java). This resource skype.jar contains a DLL skype.dll that should be unpacked to the temp directory when needed.
Obviously it's not.

If i manually copy the DLL to this path, TeamCity stops loading. Last line in the log is:

[2010-11-22 17:51:58,293]   INFO - rver.plugins.PluginsCollection - Load shared classloader for 27 plugins [buildDurationStatisticsPlugin, changeViewers, charisma, clearcase, coverage, cvs, dotnet-dupfinder, Duplicator, email, feed, FxCop, jabber, jetbrains.git, ldap, mercurial, perforce, rake-runner, remoteAccess, SkypeNotifier, stacktraces, starteam, svn, TeamCityArtifactsSizeStatisticsPlugin, vault-vcs, vss, WindowsTray, xml-report-plugin]


Do you have any idea? Using version 5.1.5 (build 13602).

Thanks and best regards,
Jonathan
16 comments

I believe the hung of TeamCity was caused by hung of that native dll that was loaded in to TeamCity.

It should be possible to load native library from a plugin. Try getClass().getClassloader().load(<path to dll>);

I would recommend you to start processes that would call skype to send all notifications. This solution is simple, it noes not use JNI and does not load any additional native libraries to server's process. You may use Runtime.exec method for it.

I also checked that Skype4Java requires swt, and swt native library to run
http://skype.sourceforge.jp/index.php?Skype%20API%20For%20Java%20(English)
This could be a reason it fails under TeamCity

Please check what user account was used to run TeamCity windows service. Try changing it to some local administrator account.

0

Firs of all, many thanks for your answer.

When i provide the swt/jni jars with my jar, it works, but get weird error as it cannot attach to skype.
I changed the user account to be the one where skype is started but still the same.

Therefore, i changed to use the COM DLL object which is easier (Skype4COM using jacob): the plugin loads fine (no more error/exception) but i do not get any notification nor error message.

I was wondering if the plugin is a server plugin or an agent plugin? Who is doing the notification?

Also, i tried to get a logger to output stuff in the log file but do not see anything.
I'm using:
import com.intellij.openapi.diagnostic.Logger;
...
private final static Logger LOG = Logger.getInstance(SkypeNotifier.class.getName());
...
notificatorRegistry.register(this);
LOG.info("### SKYPE (info)");
 LOG.debug("### SKYPE (debug)");

If i launch eclipse in debug with tomcat in debug, it nevers trigger the breakpoints i set.... (in debug, the teamcity server seems to show an old backup and it unregisters two of my agents because of the licensing)

Best rgds,
Jon

0

There could be an issue in communication with Skype from service layer to desktop layer. I'm not sure it is possible. Please try running TeamCity server from commandline to check if it so.

This is server plugin that does the notifications. So you should put all it's .jar files into <server>webapps/root/WEB-INF/plugings/<plugin-name>/server folder. Your spring config file under META-INF in .jar should have name build-server-plugin-<pluginname>.xml

The logger you used is a wrapper for Log4j logger. We have Log4j configuration files under <server>/conf/teamcity-server-log4j.xml file. To make your logs visible add your category (aka class namespace) to this config. You may simply switch to using Log4j

When you debug server, please make sure you run it with same parameters as is started as service/commandline. It's recommended to stop original server. Otherwise you may start TeamCity server with debug parameters to attach to it with debugger after it started.

Please see
http://confluence.jetbrains.net/display/TCD6/Configuring+TeamCity+Server+Startup+Properties
for details on how to start TeamCity from commandline. Note, you need to specify several system properties to enable logging and to provide path to TeamCity data directory folder.

Thanks!

0

Hello again.

I finally succeed to launch teamcity from command line with the same parameters as the service.
Skype receives the notification (ask me to allow java.exe) and everything works fine from desktop layer.

Howver, using the service layer, nothing happens :( (plugin works correctly).

If there is any way of doing that easily, i'd be happy to know :)

This link do not help either: http://www.microsoft.com/whdc/system/sysinternals/Session0Changes.mspx
Best rgds,
Jon

0

That sounds good! Congratulations!

You may try running the service as local system having 'Allow to interact with desktop' checkbox checked. Another approach is to try running skype under service layer. Probably you could start skype form your plugin.

BTW. Are you going to put the plugin to opensource? We may add a link to your plugin from our plugins list.

0

If it works, I don't think it will be a problem to make it opensource, i will check.
I will try your suggestions tomorrow and will let you know for sure... thanks for the help.
Cheers!

0

Does your plugin work?

We are interested by your project to integrate Skype in teamcity with a plugin. We will apreciate if you can share it with us.

Thanks

0

Hi,

The plugin works if you run TeamCity using the command line.
It does not when you run it as a service because there is no communication between the service layer and the desktop layer or at least i did no success to do it yet as (new change in Vista...).

Cheers

0

I would be interested in Skype plugin as well. Is there any addition news on this?

0

Paul,

Nothing from the JetBrains side.
If Jonathan can make the plugin publicly available we will be glad to list in in the plugins.

0

Well, it doesn't hurt to ask :). Thanks for the update.

0

Hi,

Same status than the last time:

The plugin works if you run TeamCity using the command line.
It does not when you run it as a service because there is no communication between the service layer and the desktop layer or at least i did no success to do it yet as (new change in Vista...)

No workaround.

0

Hi Jonathan,

Is your plugin public? Even with this limitation it seems like it can be quite useful for some.

0

No it is not public.
It was originally developed with Teamcity 5.X and Skype 5.X.

Not sure it will work fine with TC 7.X and Skype 6.X.
And as I have no time to look at it, i am not making it public but willing to send the sources i have to someone who wants to look at it.

0

One of my co-workers may be interested. He is on vacation this week. I'll ask him next week when he is back.

0

I successfully connected Skype with Teamcity via sevabot and tcWebHooks plugin.

sevabot - is skype bot, which can run under linux, with some REST API.
tcWebHooks - web hooks (triggers) for Teamcity.

Hope, it would help someone.

0

Please sign in to leave a comment.