Archive for the ‘General’ Category
sljava.dll / IntelliJ IDEA / ActivIdentity
Case
The administrators tried to install ActivIdentity on my desktop. Then I rebooted my computer and launched IntelliJ IDEA 8.1.4 as usual.
IDEA froze. I tried to launch former versions (8.0, 7.5.4), with the same result. Then I launched the idea.bat (available in the same folder as the idea.exe), setting echo on, to have a little more logs.
Stacktrace
[java]Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: \Program Files\ActivIdentity\SecureLogin\sljava.dll[/java]
Complete stacktrace
[java]C:\Program Files\JetBrains\IntelliJ IDEA 8.1.4\bin>"C:\win32app\Java\jdk1.6.0_01\jre\bin\java.exe" "
-Xms256m" "-Xmx1024m" "-XX:MaxPermSize=140m" "-Xbootclasspath/p:../lib/boot.jar " "-ea" -Xbootclassp
ath/a:../lib/boot.jar -cp "..\lib\bootstrap.jar;..\lib\util.jar;..\lib\jdom.jar;..\lib\log4j.jar;.
.\lib\extensions.jar;..\lib\trove4j.jar;C:\win32app\Java\jdk1.6.0_01\lib\tools.jar" com.intellij.ide
a.Main
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:126)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: \Program Files
\ActivIdentity\SecureLogin\sljava.dll
at java.lang.Runtime.load0(Runtime.java:767)
at java.lang.System.load(System.java:1005)
at com.actividentity.sso.javasso.SSOLoginScriptRunner.(SSOLoginScriptRunner.java:905
)
at com.actividentity.sso.javasso.ConsoleLogger.(Logger.java:54)
at com.actividentity.sso.javasso.Logger.(Logger.java:73)
at com.actividentity.sso.javasso.awt_swing.JavaSSOHook.(JavaSSOHook.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorIm
pl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:773)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:861)
at java.awt.Window.getToolkit(Window.java:1127)
at java.awt.Window.init(Window.java:369)
at java.awt.Window.(Window.java:407)
at java.awt.Frame.(Frame.java:402)
at java.awt.Frame.(Frame.java:367)
at javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1731)
at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1808)
at javax.swing.JOptionPane.getRootFrame(JOptionPane.java:1673)
at com.intellij.idea.MainImpl.b(MainImpl.java:8)
at com.intellij.idea.MainImpl.a(MainImpl.java:79)
at com.intellij.idea.MainImpl.start(MainImpl.java:73)
… 6 more
ERROR: Error while accessing com.intellij.idea.MainImpl.start with arguments: []
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:126)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: \Program Files
\ActivIdentity\SecureLogin\sljava.dll
at java.lang.Runtime.load0(Runtime.java:767)
at java.lang.System.load(System.java:1005)
at com.actividentity.sso.javasso.SSOLoginScriptRunner.(SSOLoginScriptRunner.java:905
)
at com.actividentity.sso.javasso.ConsoleLogger.(Logger.java:54)
at com.actividentity.sso.javasso.Logger.(Logger.java:73)
at com.actividentity.sso.javasso.awt_swing.JavaSSOHook.(JavaSSOHook.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorIm
pl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:773)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:861)
at java.awt.Window.getToolkit(Window.java:1127)
at java.awt.Window.init(Window.java:369)
at java.awt.Window.(Window.java:407)
at java.awt.Frame.(Frame.java:402)
at java.awt.Frame.(Frame.java:367)
at javax.swing.SwingUtilities$SharedOwnerFrame.(SwingUtilities.java:1731)
at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1808)
at javax.swing.JOptionPane.getRootFrame(JOptionPane.java:1673)
at com.intellij.idea.MainImpl.b(MainImpl.java:8)
at com.intellij.idea.MainImpl.a(MainImpl.java:79)
at com.intellij.idea.MainImpl.start(MainImpl.java:73)
… 6 more
ERROR: Error while accessing com.intellij.idea.MainImpl.start with arguments: []
java.lang.AssertionError: Error while accessing com.intellij.idea.MainImpl.start with arguments: []
at com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:49)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:56)
at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:130)
at java.lang.Thread.run(Thread.java:619)[/java]
Explanation and Fix
I ran other Java applications, such as Eclipse and Mule ESB. The result was the same.
When you look at the stacktrace, you can see that sun.reflect.NativeConstructorAccessorImpl.newInstance0 calls com.actividentity.sso.javasso.awt_swing.JavaSSOHook. This makes me think ActivIdentity intercepts Java calls, even of very low level, and checks them before executing them. I don’t know if compiled code of JRE’s jars is modified, or if some methods are inserted through a mechanism similar to AOP. Anyway, the fact is that ActivIdentity is always called, even though I doubt a lot that original HotSpot was designed to do so…
I tried to uninstall ActivIdentity, this had no effect. I looked in Windows regedit but I found nothing. I tried also to check the value of java.library.path which, for Windows, points to Windows’PATH environment variable.
Therefore, the only solution I found to fix the issue was to changed the JAVA_HOME parameter (more accurately: the parameter IDEA_JDK) from one JDK to another, in my case: from 1.6.0_01 to 1.6.0_18)
Tutorial: from an application, make a clustered application, within WebLogic 10
Abstract
You have a non-clustered installation, on the host with DNS name jonathanDevDesktop, with an admin (port: 7001), a muletier (port: 7003) and a webtier (port: 7005) instances.
You need set your muletier as a clustered installation, with two nodes, on the same server. The second node will dedeployed on port 7007.
We assume you have a configured JMS Modules (in our case: JmsMqModule, even though the bridge between WebLogic and MQ has no impact here).
Process
Batches
- Copy
$DOMAINS\jonathanApplication\start-muletier-server.bat"as$DOMAINS\jonathanApplication\start-muletier-server-2.bat" - Edit it:
- Possibly, modify the debug port (usually:
5006) - Replace the line
call "%DOMAIN_HOME%\bin\startManagedWebLogic.cmd" muletier t3://jonathanDevDesktop:7001
with
call "%DOMAIN_HOME%\bin\startManagedWebLogic.cmd" muletier2 t3://jonathanDevDesktop:7001
- Possibly, modify the debug port (usually:
Second Node Creation
- Following points are not required.
- Copy the folder
%DOMAIN_HOME%\servers\muletieras%DOMAIN_HOME%\servers\muletier2 - Delete the folders
%DOMAIN_HOME%\servers\muletier2\cacheand%DOMAIN_HOME%\servers\muletier2\logs
- Copy the folder
- Stop the server
muletier - On WebLogic console:
- Servers > New > Server Name:
muletier2, Server Listen Port:7007> CheckYes, create a new cluster for this server.> Next - Name:
jonathanApplication.cluster.muletier> Messaging Mode:Multicast, Multicast Address:239.235.0.4, Multicast Port:5777 - Clusters >
jonathanApplication.cluster.muletier> Configuration > Servers > Select a server:muletier - Clusters >
jonathanApplication.cluster.muletier> Configuration > Servers > Select a server:muletier2
- Servers > New > Server Name:
- Start the instances of
muletierandmuletier2in MS-DOS consoles. - On the WebLogic console:
- Deployments >
jonathanApplication-web(the mule instance) > Targets > check “jonathanApplication.cluster.muletier” and “All servers in the cluster” > Save
- Deployments >
- On the
muletier2DOS console, you can see the application is deployed.
JMS Configuration
The deployment of JMS on clustered environment is a little tricky.
- On WebLogic console: JMS Modules >
JmsMqModule> Targets > check “jonathanApplication.cluster.muletier” and “All servers in the cluster“ - Even though it is not required, restart your muletiers. Then you can send messages either on port 7003 or 7007, they will be popped and handled the same way.
Tutorial: Use WebShere MQ as JMS provider within WebLogic 10.3.3, and Mule ESB as a client
Abstract
You have an application deployed on WebLogic 10 (used version for this tutorial: 10.3.3). You have to use an external provider for JMS, in our case MQ Series / WebSphere MQ.
The client side is a Mule ESB launched in standalone.
Prerequisites
You have:
- a running WebLogic 10 with an admin instance and an another instance, in our case: Muletier.
- a file
file.bindings, used for MQ.
JARs installation
- Stop all your WebLogic 10 running instances.
- Get the JARs from MQ Series folders:
providerutil.jarfscontext.jardhbcore.jarconnector.jarcommonservices.jarcom.ibm.mqjms.jarcom.ibm.mq.jar
- Copy them in your domain additional libraries folder (usually:
user_projects/domains/jonathanApplication/lib/) - Start WebLogic 10 admin. A block like this should appear:
[java]<Oct 15, 2010 12:09:21 PM CEST> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
C:\win32app\bea\user_projects\domains\jonathanApplication\lib\com.ibm.mq.jar;C:\win32app\bea\user_projects\domains\jonathanApplication\lib\com.ibm.mqjms.jar;C:\win32app\bea\user_projects\domains\jonathanApplication\lib\commonservices.jar;C:\win32app\bea\user_projects\domains\jonathanApplication\lib\connector.jar;C:\win32app\bea\user_projects\domains\jonathanApplication\lib\dhbcore.jar;C:\win32app\bea\user_projects\domains\jonathanApplication\lib\fscontext.jar;C:\win32app\bea\
user_projects\domains\jonathanApplication\lib\providerutil.jar>[/java]
Config
- Get
file.bindings, copy it intouser_projects/domains/jonathanApplication/config/jms, rename it as.bindings(without any prefix) - Launch the console, login
JMS>JMS Modules>Create JMS System Module>Name: JmsMqModule. Leave other fields empty. >Next> target serverMuleTier>Finish- Select
JmsMqModule>New>Foreign Server> Name:MQForeignServer> keep check MuleTier >Finish- Select MQForeignServer >
- JNDI Initial Context Factory: replace
weblogic.jndi.WLInitialContextFactorywith:com.sun.jndi.fscontext.RefFSContextFactory - JNDI Connection URL: set the URI of the folder containing the
.bindingsfile, eg:file://c/win32app/bea/user_projects/domains/jonathanApplication/config/jms
- JNDI Initial Context Factory: replace
- Tab
Connection Factories> New >- Name:
MQForeignConnectionFactory - Local JNDI Name: the JNDI name on WebLogic side, eg:
jonathanApplication/jms/connectionFactory/local(convention I could observe: separator on WebLogic: slash'/'; unlike clients for which the separator in a dot'.') - Remote JNDI Name: the JNDI name on MQ side, eg:
JONATHAN_APPLICATION.QCF - OK
- Name:
- Tab
Destinations> New >- Queue of requests:
- Name:
JONATHAN.APPLICATION.REQUEST - Local JNDI Name:
JONATHAN.APPLICATION.REQUEST - Remote JNDI Name:
JONATHAN.APPLICATION.REQUEST
- Name:
- Queue of response:
- Name:
JONATHAN.APPLICATION.REPONSE - Local JNDI Name:
JONATHAN.APPLICATION.REPONSE - Remote JNDI Name:
JONATHAN.APPLICATION.REPONSE
- Name:
- NB: usually, MQ data are upper-cased and Java’s JNDI names are low-cased typed ; anyway (because of Windows not matching case?) here we use uppercase in for both names.
- Queue of requests:
- Select MQForeignServer >
Mule
This part of the tutorial deals with a case of Mule ESB being your client application (sending and/or receiving JMS messages).
- Get the archive
wlfullclient.jar(56MB). Alternatively, you can generate it yourself: go to the server/lib directory of your WebLogic installation (usually:C:\win32app\bea\wlserver_10.3\server\lib, and run:java -jar wljarbuilder.jar - Copy the archive into
$MULE_HOME/lib/user - Copy the seven jars above (
providerutil.jar,fscontext.jar,dhbcore.jar,connector.jar,commonservices.jar,com.ibm.mqjms.jar,com.ibm.mq.jar) into the same folder:$MULE_HOME/lib/user - You can launch the mule. The config file is similar to any other configuration using standard JMS.
No handlers could be found for logger…
Case
You run a Python script, and you get an error similar to:
[python]No handlers could be found for logger "stomp.py"[/python]
Fix
Edit the script, and add the following block:
[python]import logging
logging.basicConfig()[/python]
This will produce explicit log that will allow you to identity the source of the actual issue.
Tutorial: an Event Bus Handler for GWT / GXT
Overview
Introduction
Let’s consider a application, JonathanGwtApplication, divided in three main panels
- a panel to select animal name name
- a panel to display, expand and collapse trees of the animal ancestors
- a panel of information to display many indicators (colors, ages, etc.).
An issue we encounter is: how to make the different panels communicate? In more technical terms, how to fire events from a panel to another one?
A first solution would be to declare each panel as listener to the other panels. Indeed, this principle may go further, and declare each component as listener to a list of other components…
Main drawbacks:
- the code becomes hard to read
- adding or removing a component requires to modify many parts of the code
- we don’t follow GWT 2’s “philosophy”, which is to use
Handlersrather thanListeners.
Hence, these reasons incited us to provide a global EventBusHandler.
The EventBusHandler concept
The EventBusHandler is a global bus which is aware of all events that should be shared between different panels, and fires them to the right components.
The EventBusHandler is a field of JonathanGwtApplicationContext.
Intrastructure
lalou.jonathan.application.web.gwt.animal.events.HandledEvent: generic interface for a event. Abstract method:[java]EventTypeEnum getEventEnum();[/java]lalou.jonathan.application.web.gwt.animal.handler.EventHandler: generic interface for a component able to handle an event. Abstract method:[java]void handleEvent(HandledEvent handledEvent);[/java]lalou.jonathan.application.web.gwt.animal.handler.EventHandlerBus: the actual bus. As a concrete class, it has two methods:[java]/**
* Fires an event to all components declared as listening to this event
* event type.
*
* @param baseEvent
*/
public void fireEvent(HandledEvent baseEvent) {
// …
}/**
* Adds an listener/handler for the event type given as parameter
*
* @param eventTypeEnum
* @param eventHandler
* @return The List of handlers for the key given as parameter. This list
* contains the eventHandler that was given as second parameter
*/
public List<EventHandler> put(EventTypeEnum eventTypeEnum,
EventHandler eventHandler) {
// …
}[/java]
How to use the bus?
- Define an event: in JonathanGwtApplication, an event is decribed by two elements:
- a functionnal entity: eg: “animal”, “food”, “tree node”. The functionnal entity must be isomorph to a technical DTO, eg:
AnimalDTOfor an entity Animal.(in the scope of this turoriel we assume to have DTOs, even though the entities may ne sufficient) - a technical description of the event: “selection changed”, “is expanded”
- a functionnal entity: eg: “animal”, “food”, “tree node”. The functionnal entity must be isomorph to a technical DTO, eg:
- Add an entry in the enum
EventTypeEnum. Eg: “ANIMAL_SELECTION_CHANGED“ - in
lalou.jonathan.application.web.gwt.animal.events, create an event, implementingHandledEventand its methodgetEventEnum(). The match betweenEventTypeEnumand DTO is achieved here. Eg:
[java]public class AnimalSelectionChangedEvent extends
SelectionChangedEvent<AnimalDTO> implements HandledEvent {public AnimalSelectionChangedEvent(
SelectionProvider<AnimalDTO> provider,
List<AnimalDTO> selection) {
super(provider, selection);
}public EventTypeEnum getEventEnum() {
return EventTypeEnum.ANIMAL_SELECTION_CHANGED;
}}[/java]
@Override
public void selectionChanged(SelectionChangedEvent<AnimalDTO> se) {
final AnimalDTO selectedAnimalVersion;
selectedAnimalVersion= se.getSelectedItem();
JonathanGwtApplicationContext.setSelectedAnimal(selectedAnimal);
final AnimalSelectionChangedEvent baseEvent = new AnimalSelectionChangedEvent(
se.getSelectionProvider(), se.getSelection());
JonathanGwtApplicationContext.getEventHandlerBus()
.fireEvent(baseEvent);
}
});[/java]
- easy case: the component handles only one type of event: this handler must implement the right interface (eg:
AnimalSelectionChangedEventHandler) and its method, eg:[java]protected void handleAnimalSelectionChangedEvent(HandledEvent handledEvent) {
return;
}[/java] - frequent case: the component handles two or more event types. No matter, make the component implement all the needed interfaces (eg:
AnimalSelectionChangedEventHandler,FoodSelectionChangedEventHandler). Provide a unique entry point for the method to implement, which is common to both interfaces. Retrieve the event type, and handle it with ad hoc methods. Eg:[java]public void handleEvent(HandledEvent handledEvent) {
final EventTypeEnum eventTypeEnum;eventTypeEnum = handledEvent.getEventEnum();
switch (eventTypeEnum) {
case ANIMAL_SELECTION_CHANGED:
handleAnimalSelectionChangedEvent(handledEvent);
return;
case FOOD_SELECTION_CHANGED:
handleFoodSelectionChangedEvent(handledEvent);
return;
default:
break;
}
}protected void handleAnimalSelectionChangedEvent(HandledEvent handledEvent) {
// do something
}
protected void handleFoodSelectionChangedEvent(HandledEvent handledEvent) {
// do something else
}[/java]