Customized SSLSocketFactory dynamically loading TrustManager instance with updated truststore

When I am making LDAPS connection, I would like the LDAPS client be authenticated with latest updated CA certificate in the truststore.
Here is what I am trying to do:
// Set up the environment for creating the initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
  "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");
// Specify the socket factory
env.put("java.naming.ldap.factory.socket", "MySSLSocketFactory");
// Create the initial context
DirContext ctx = new InitialDirContext(env);
Defining the MySSLSocketFactory class here:
import com.vormetric.server.ServiceLocator;
import com.vormetric.server.sdk.config.IConfigUtil;
import com.vormetric.server.sdk.config.LdapException;
import org.apache.log4j.Logger;
import javax.net.SocketFactory;
import javax.net.ssl.*;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.*;
public class MySSLSocketFactory extends SSLSocketFactory {
   private static Logger logger = Logger.getLogger(MySSLSocketFactory.class);
   public static final String TRUST_STORE_FILE = "server.truststore";
   private static MySSLSocketFactory factory;
   private SSLSocketFactory sslsocket = null;
   private SSLContext sslContext;
   static private String ldapHost;
   private static String domainName;
   private String trustStore;
   //private ExtendedSSLSession sess;
   public MySSLSocketFactory() {
   try {
  IConfigUtil svrCfg = ServiceLocator.getConfigUtilInstance();
   trustStore = svrCfg.getCGSSConfDir() + TRUST_STORE_FILE;
  File file = new File(trustStore);
   if (!file.exists()) {
   throw new LdapException(
   "Trust store non-exists! Configure ldaps settings first.");
   sslContext = getSSLContext(trustStore, domainName);
   //sslContext.setSocketFactory(SSLSocketFactoryImpl.getDefault());
   sslsocket = sslContext.getSocketFactory();
  } catch ( Exception ex ){ throw new IllegalArgumentException(ex); }
   @Override public String[] getDefaultCipherSuites() { return sslsocket.getDefaultCipherSuites(); }
   @Override public String[] getSupportedCipherSuites() { return sslsocket.getSupportedCipherSuites(); }
   public static synchronized SocketFactory getDefault() {
   if(factory == null){
   factory = new MySSLSocketFactory();
   return factory;
   @Override
   public Socket createSocket(Socket socket, String host, int port, boolean bln) throws
   IOException {
   return sslsocket.createSocket(socket, host, port, bln);
   @Override
   public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
   return sslsocket.createSocket(host,port);
   @Override
   public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
   throws IOException, UnknownHostException {
   return sslsocket.createSocket(host, port, localHost, localPort);
   @Override
   public Socket createSocket(InetAddress host, int port) throws IOException {
   return sslsocket.createSocket(host,port);
   @Override
   public Socket createSocket(InetAddress host, int port, InetAddress localAddress, int localPort)
   throws IOException {
   return sslsocket.createSocket(host, port, localAddress, localPort);
   public SSLContext getSSLContext(String trustStore, String domainName)
   throws Exception {
  TrustManager[] trustManagers = new TrustManager[] { new ReloadableX509TrustManager(this.trustStore, this.domainName)
   //SSLContext sslContext = new SSLContextImpl.TLS12Context();
   SSLContext sslContext = SSLContext.getInstance("TLSv1.2", "SunJSSE");
  sslContext.init(null, trustManagers, null);
   return sslContext;
   public static void setDomainName(String name) {
   domainName = name;
   public static String getSsContext() {
   return domainName;
But here is the problem whenever trying to make LDAPS connection, I am getting the following exceptions with JDK1.7.0_72:
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1) Caused by: java.net.SocketException: Unconnected sockets not implemented
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at javax.net.SocketFactory.createSocket(SocketFactory.java:125)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at java.lang.reflect.Method.invoke(Method.java:606)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   at com.sun.jndi.ldap.Connection.createSocket(Connection.java:307)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   at com.sun.jndi.ldap.Connection.<init>(Connection.java:203)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   ... 59 more
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1) Caused by: java.lang.UnsupportedOperationException
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   at javax.net.SocketFactory.createSocket(SocketFactory.java:123)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   ... 65 more
Please let me know what I should do to get over this exception.
Thanks a lot.
yilicaus

When I am making LDAPS connection, I would like the LDAPS client be authenticated with latest updated CA certificate in the truststore.
Here is what I am trying to do:
// Set up the environment for creating the initial context
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
  "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=JNDITutorial");
// Specify the socket factory
env.put("java.naming.ldap.factory.socket", "MySSLSocketFactory");
// Create the initial context
DirContext ctx = new InitialDirContext(env);
Defining the MySSLSocketFactory class here:
import com.vormetric.server.ServiceLocator;
import com.vormetric.server.sdk.config.IConfigUtil;
import com.vormetric.server.sdk.config.LdapException;
import org.apache.log4j.Logger;
import javax.net.SocketFactory;
import javax.net.ssl.*;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.*;
public class MySSLSocketFactory extends SSLSocketFactory {
   private static Logger logger = Logger.getLogger(MySSLSocketFactory.class);
   public static final String TRUST_STORE_FILE = "server.truststore";
   private static MySSLSocketFactory factory;
   private SSLSocketFactory sslsocket = null;
   private SSLContext sslContext;
   static private String ldapHost;
   private static String domainName;
   private String trustStore;
   //private ExtendedSSLSession sess;
   public MySSLSocketFactory() {
   try {
  IConfigUtil svrCfg = ServiceLocator.getConfigUtilInstance();
   trustStore = svrCfg.getCGSSConfDir() + TRUST_STORE_FILE;
  File file = new File(trustStore);
   if (!file.exists()) {
   throw new LdapException(
   "Trust store non-exists! Configure ldaps settings first.");
   sslContext = getSSLContext(trustStore, domainName);
   //sslContext.setSocketFactory(SSLSocketFactoryImpl.getDefault());
   sslsocket = sslContext.getSocketFactory();
  } catch ( Exception ex ){ throw new IllegalArgumentException(ex); }
   @Override public String[] getDefaultCipherSuites() { return sslsocket.getDefaultCipherSuites(); }
   @Override public String[] getSupportedCipherSuites() { return sslsocket.getSupportedCipherSuites(); }
   public static synchronized SocketFactory getDefault() {
   if(factory == null){
   factory = new MySSLSocketFactory();
   return factory;
   @Override
   public Socket createSocket(Socket socket, String host, int port, boolean bln) throws
   IOException {
   return sslsocket.createSocket(socket, host, port, bln);
   @Override
   public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
   return sslsocket.createSocket(host,port);
   @Override
   public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
   throws IOException, UnknownHostException {
   return sslsocket.createSocket(host, port, localHost, localPort);
   @Override
   public Socket createSocket(InetAddress host, int port) throws IOException {
   return sslsocket.createSocket(host,port);
   @Override
   public Socket createSocket(InetAddress host, int port, InetAddress localAddress, int localPort)
   throws IOException {
   return sslsocket.createSocket(host, port, localAddress, localPort);
   public SSLContext getSSLContext(String trustStore, String domainName)
   throws Exception {
  TrustManager[] trustManagers = new TrustManager[] { new ReloadableX509TrustManager(this.trustStore, this.domainName)
   //SSLContext sslContext = new SSLContextImpl.TLS12Context();
   SSLContext sslContext = SSLContext.getInstance("TLSv1.2", "SunJSSE");
  sslContext.init(null, trustManagers, null);
   return sslContext;
   public static void setDomainName(String name) {
   domainName = name;
   public static String getSsContext() {
   return domainName;
But here is the problem whenever trying to make LDAPS connection, I am getting the following exceptions with JDK1.7.0_72:
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1) Caused by: java.net.SocketException: Unconnected sockets not implemented
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at javax.net.SocketFactory.createSocket(SocketFactory.java:125)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2015-03-02 13:23:37,563 ERROR [stderr] (http-/0.0.0.0:8445-1)   at java.lang.reflect.Method.invoke(Method.java:606)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   at com.sun.jndi.ldap.Connection.createSocket(Connection.java:307)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   at com.sun.jndi.ldap.Connection.<init>(Connection.java:203)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   ... 59 more
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1) Caused by: java.lang.UnsupportedOperationException
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   at javax.net.SocketFactory.createSocket(SocketFactory.java:123)
2015-03-02 13:23:37,564 ERROR [stderr] (http-/0.0.0.0:8445-1)   ... 65 more
Please let me know what I should do to get over this exception.
Thanks a lot.
yilicaus

Similar Messages

  • Spry Tabbed panels + Progressive Enhancement and Dynamic Loading of Content With Spry

    Is there any way to combine tabbed panels together with "Progressive Enhancement and Dynamic Loading of Content With Spry"?
    Visit: http://labs.adobe.com/technologies/spry/articles/best_practices/progressive_enhancement.ht ml#updatecontent
    And click on the "Using Spry.Utils.updateContent()"
    The 3rd example shows how to use a fade transition whenever the content changes.
    I already have tabbed panels. My menu contains buttons (on tabs) and my Content div contains the panels.
    Tabs code;
    <ul class="TabbedPanelsTabGroup">
              <li class="TabbedPanelsTab">
                   <table class="Button"  >
                        <tr>
                        <td style="padding-right:0px" title ="Home">
                        <a href="javascript:TabbedPanels1.showPanel(1);" title="Home" style="background-image:url(/Buttons/Home.png);width:172px;height:75px;display:block;"><br/></a>
                        </td>
                        </tr>
                   </table>
              </li>
    etc
    etc
    etc
    and the panel code:
    <div class="TabbedPanelsContent" id="Home">
         CONTENT
    </div>
    I hoped i can use the example code from the link into my tabbed panels.
    I thought this code:
    onclick="FadeAndUpdateContent('event', 'data/AquoThonFrag.html'); return false;"
    could be added to the tab code like this:
    <a href="javascript:TabbedPanels1.showPanel(1);" onclick="FadeAndUpdateContent('event', 'data/AquoThonFrag.html'); return false;" title="Home" style="background-image:url(/Buttons/Home.png);width:172px;height:75px;display:block;"><br/></a>
    But the content doesnt fade...
    I know i need to change the header etc.
    The following is from the link:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Aquo Events</title>
    <script src="../../../includes/SpryEffects.js" type="text/javascript"></script>
    <script src="../../../includes/SpryData.js" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function FadeAndUpdateContent(ele, url)
    try {
         Spry.Effect.DoFade(ele,{ duration: 500, from: 100, to: 0, finish: function() {
              Spry.Utils.updateContent(ele, url, function() {
                        Spry.Effect.DoFade(ele,{ duration: 500, from: 0, to: 100 });
    }catch(e){ alert(e); }
    -->
    </script>
    <style type="text/css">
    /* IE HACK to prevent bad rendering when fading. */
    #event { background-color: white; }
    </style>
    </head>
    So i changed my header etc, put the SpryEffects.js and SpryData.js into position and nothing changed...
    Is there a way to keep my tabbed panel (or change as less as possible) and let
    A. The fade work
    B. The loading work.
    The problem now is that it loads all pages instead of only the home. Therefore i wanted this Progressive Enhancement.
    And the fading part is just because its nice...

    It doesnt show in the post but off course i changed this link;
    "data/AquoThonFrag.html"
    into;
    "javascript:TabbedPanels1.showPanel(1);"
    I must say i dont know if this even works...

  • Dynamically Loading a Class with Parameters

    Hi,
    I'm working on small program during my spare time and I have run into a problem. I have one abstract class (Foo) which is extended by several other subclasses (subFoo1, subFoo2). I am trying to avoid making a whole host of if statements depending on user input by coding in dynamic class loading.
    The newInstance() method I've read about works well except that it does not accept arguments, something that I sorely need:
    Foo a = Class.forName(input).asSubclass(Foo.class).newInstance();The other method works for creating the objects but I get an error:
    Class foo = Class.forName(input);
    Constructor cons = cs.getConstructor(new Class[]{String.class, Long.TYPE});
    Object a = cons.newInstance(new Object[]{ FooString, FooInt});
    a.method()
    cannot find symbol
    symbol : method(java.math.BigDecimal)
    location : java.lang.ObjectI can understand the problem that the new 'Object' can't find the methods of 'foo', but i don't know how to solve the problem.

    Object a = cons.newInstance(new Object[]{ FooString, FooInt});
    a.method();That isn't very strange, is it? a is an Object, and class Object doesn't have the method you're calling. You have to cast it to a Foo:
    Foo a = (Foo)cons.newInstance(new Object[]{ FooString, FooInt});
    a.method();

  • Master Data loading got failed: error "Update mode R is not supported by th

    Hello Experts,
    I use to load master data for 0Customer_Attr though daily process chain, it was running successfully.
    For last 2 days master data loading for 0Customer_Attr got failed and it gives following error message:
    "Update mode R is not supported by the extraction API"
    Can anyone tell me what is that error for? how to resolve this issue?
    Regards,
    Nirav

    Hi
    Update mode R error will come in the below case
    You are running a delta (for master data) which afils due to some error. to resolve that error, you make the load red and try to repeat the load.
    This time the load will fail with update mode R.
    As repeat delta is not supported.
    So, now, the only thing you can do is to reinit the delta(as told in above posts) and then you can proceed. The earlier problem has nothing to do with update mode R.
    example your fiorst delta failed with replication issue.
    only replicating and repeaing will not solve the update mode R.
    you will have to do both replication of the data source and re-int for the update mode R.
    One more thing I would like to add is.
    If the the delat which failed with error the first time(not update mode R), then
    you have to do init with data transfer
    if it failed without picking any records,
    then do init without data transfer.
    Hope this helps
    Regards
    Shilpa
    Edited by: Shilpa Vinayak on Oct 14, 2008 12:48 PM

  • Problems with the dynamic loader... And well... I SERIOUSLY messed up.

    So you might call me an idiot.  Go ahead... I deserve it.
    I was in the process of updating my netbook over SSH because I left it back home when I went to school.  I ended up running into problems with glibc etc...  So I did something that I seriously regret...
    I executed the command...
    mv /lib/* /usr/lib*
    This has to be the most retarded thing I have ever done ever... Like I'm not even shitting you.
    To make things worse... I don't have busybox and have no method of getting busybox onto the computer.
    Now I have seen about using the dynamic loader "ld-linux.so.2" to execute programs using a user defined library path.  So I thought perfect, I can do this.  The problem is... I can't find it.  I looked on two healthy Arch machines at the locations and names.  I used that to try this.  I am sure at least I have a recent version of glibc installed (<current version>-1 I believe).  But I still cannot find this at all.  I am logged in as root over SSH but it fails to log in again on another session.  So I have one session to work with it I can work it at all.
    Do you have any suggestions to fix this?  If not, I can always have someone tomorrow dd a copy of an arch iso tomorrow and possibly fix everything... But I would really like this fixed without all of that... Thanks...

    See these two threads.

  • How do you force instances with the same name on the same layer to update?

    Maybe someone can tell me why flash doesn’t redraw
    components’ x,y positions if they have the same instance name
    and are on adjacent frames? (movieclips work fine, just not
    components) If I have a button on frame 1 and a button on frame 2
    both with the same instance name but different locations on the
    stage, frame 2’s button doesn’t show up in the position
    I placed it, it stays at the position of frame 1 but still has the
    properties of frame 2’s button. The label changes and
    everything. If I stick a button on a frame in between and give it a
    different instance name there is no problem. I thought it might be
    the style manager bug
    http://www.gskinner.com/blog/archives/2007/12/cs3_component_b.html
    but it didn’t seem to affect. This happens for textareas too
    and probably all components although I haven’t tried them.
    I’ve tried using drawNow() and validateNow() with no luck
    either
    http://www.adobe.com/devnet/flash/articles/creating_as3_components_pt3_05.html
    Thank you!
    // put this on frame 1 along with a button on the stage with
    instance name: b
    function doit(event) {
    if (currentFrame == 1)
    gotoAndStop(2);
    else
    gotoAndStop(1);
    b.addEventListener(MouseEvent.CLICK, doit);
    stop();
    // put another button on frame 2 along with this code and
    also make it’s instance name: b but move it so it’s not
    in the same x,y coordinates as the button on frame 1
    stop();
    Something possibly related. I have a movieclip on a layer,
    one instance with name “a” on frame 1 and one instance
    with name “a” on frame 2 and it has event listeners
    inside it that update something on the movieclip. Unless I put the
    movieclips on separate layers the event listeners won’t reset
    each frame. (example: a button with a tooltip onmouseover that you
    want to change the text of from frame 1 to frame 2) You’d
    think if they were on separate keyframes at least but no, they need
    to be on separate layers too.
    I want the movieclip to update each frame. Any ideas?

    instances (whether components or not) with the same name may
    or may not be the same instance. it depends upon how they were
    created.
    for example, if you create an instance on frame 1 of your
    main timeline, give it an instance name and then create a keyframe
    on frame 2, the two instances will be the same.
    but if you create an instance on frame 1 of your main
    timeline, give it an instance name and then create a blank keyframe
    on frame2 and create another, what you think is a duplicate,
    instance and give it the same name, it will be a different
    instance.

  • Static analyzer fails on WIX custom install action project: .dll' could not be opened -- 'An attempt was made to load a program with an incorrect format'

    On our build system, we use the global setting to code analyze all projects. One of our projects is a C# WIX custom action. This projects causes the build to fail with:
    EACustomInstallActions.CA.dll' could not be opened -- 'An attempt was made to load a program with an incorrect format.
    The ...CA.Dll target seems to be created by a WIX custom action. Does anybody have already encountered this issue and found a workaround?
    Full build output:
    <target name="ContractDeclarativeAssemblyCS" success="false">
                  <message level="normal"><![CDATA[Build Declarative Contract Assembly for C# D:\EA_MAIN_DB\AMI\bin\Debug\GEHealthcare.Isip.EACustomInstallActions.dll]]></message>
                  <message level="high"><![CDATA[C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /pdb:obj\x86\Debug\Decl\GEHealthcare.Isip.EACustomInstallActions.pdb /errorreport:prompt /warn:0 /define:DEBUG;TRACE;CONTRACTS_FULL;CODE_ANALYSIS /reference:"C:\Program Files\Windows Installer XML v3\SDK\Microsoft.Deployment.WindowsInstaller.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SqlWmiManagement.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /addmodule:D:\EA_MAIN_DB\AMI\src\radstore\Installer\EACustomInstallActions\obj\x86\Debug\GEHealthcare.Isip.EACustomInstallActions.CA.dll /debug+ /debug:full /filealign:512 /keyfile:..\..\Common\EAKeyPair.snk /optimize+ /out:obj\x86\Debug\Decl\GEHealthcare.Isip.EACustomInstallActions.dll /target:library /warnaserror- ..\..\Common\GlobalAssemblyInfo.cs CustomAction.cs Properties\AssemblyInfo.cs Resource1.Designer.cs SqlServersSelector.cs SqlServersSelector.designer.cs "C:\Program Files\Microsoft\Contracts\Languages\CSharp\ContractDeclarativeAssemblyAttribute.cs"]]></message>
                  <error code="CS0009" file="CSC"><![CDATA[Metadata file 'd:\EA_Main_DB\AMI\src\radstore\Installer\EACustomInstallActions\obj\x86\Debug\GEHealthcare.Isip.EACustomInstallActions.CA.dll' could not be opened -- 'An attempt was made to load a program with an incorrect format. ']]></error>
                </target>

    This problem appears to be ongoing 5 years after this thread was started. I have just run into it.
    When WiX builds a custom action, the build proceeds as normal and produces a managed code output, say MyCustomActions.dll. Windows Installer doesn't support managed code in custom actions, so the managed code has to be wrapped in an unmanaged native code
    wrapper, so in a post-build step, it injects the managed output into the unmanaged wrapper and _that_ then becomes the project's build output and will be named MyCustomActions.CA.dll. I believe that Code Contracts may be trying to open the unmanaged wrapper
    file and discovering that it is not managed code ("invalid format").
    In order for CCRewrite to work here, it would need to run on the managed code _before_ it gets wrapped in the unmanaged wrapper. I am not sure how we can hook into the build process to get that to happen.
    It might be possible to somehow make a WiX Custom Action project by creating a standard C# class library, which would work correctly with CCRewrite, then somehow performing the WiX packaging as a post-build step. I'm not sure what is required though, exactly.
    Any ideas?
    --Tim Long
    Tim Long

  • Dynamic loading of a class at runtime with known inheritance

    Hi,
    I am trying to dynamically load a class during runtime where I know that the class implements a particular interface 'AInterface'. Also, this class may be linked to other classes in the same package as that class, with their implementations/extensions given in their particular definitions.
    The class is found by using a JFileChooser to select the class that implements 'AInterface', and loaded up.
    Because the name of the class can be practically anything, my current approach only works for certain classes under the package 'Foo' with classname 'Bar'. Some names have been changed to keep it abstract.
    private AInterface loadAInterface(URL url) throws Exception {
         URL[] urls = { url };
         // Create a new class loader with the directory
         URLClassLoader cl = new URLClassLoader(urls);
         // Load in the class
         Class<?> cls = cl.loadClass("Foo.Bar");
         return (AInterface) cls.newInstance();
    }As you can see, all that is being returned is the interface of the class so that the interface methods can be accessed. My problem is that I don't know what the class or package is called, I just know that the class implements AInterface. Also note that with this approach, the class itself isn't selected in the JFileChooser, rather the folder containing Foo/Bar.class is.

    ejp wrote:
    The class is found by using a JFileChooser to select the class that implements 'AInterface', and loaded up.
    Also note that with this approach, the class itself isn't selected in the JFileChooser, rather the folder containing Foo/Bar.class is.These two statements are mutually contradictory...My apologies, I worded that wrong. My current approach (the one given in the code) selects the root package folder. However, what I want to be able to do, is to simply select a single class file. The current code just makes some assumptions so that I can at least see results in the program.
    As you said, if the root of the package hierarchy is known, then this could be achieved. The problem is that the user either selects the package root or the AInterface class, but not both.
    Is there a way to get package details from a .class file to be used in the actual loading of the class?

  • C# load xml data with attributes to datagridview; update data and save back to the xml

    Hi guys,
    i currently have this XML as data
    <DEALS>
    <DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones">
    <ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">2500</ALLOCATION>
    <ALLOCATION DEMANDE="7000" CODE="75" PRICE="35.00">4000</ALLOCATION>
    </DEAL>
    <DEAL ID="23" ISBN="1-7988-1623-3" Screenplay="Joe Doe" Title ="Nothing Much" Director = "Listentome">
    <ALLOCATION DEMANDE="3300" CODE="72" PRICE="15.00">2500</ALLOCATION>
    </DEAL>
    </DEALS>
    I load the data with the code below:
    i use xDocument to load the DealData.xml and then put it in ToString.
    //outside of the form
    public static class XElementExtensions
    public static DataTable ToDataTable(this XElement element)
    DataSet ds = new DataSet();
    string rawXml = element.ToString();
    ds.ReadXml(new StringReader(rawXml));
    return ds.Tables[0];
    public static DataTable ToDataTable(this IEnumerable<XElement> elements)
    return ToDataTable(new XElement("Root", elements));
    //in the form
    private void button2_Click(object sender, EventArgs e)
    var xDocument = XDocument.Load("DealData.xml");
    string txtxml = xDocument.ToString();
    StringReader reader = new StringReader(txtxml);
    XDocument doc1 = XDocument.Load(reader);
    var res = doc1.Descendants("DEAL").ToList().Where(x => x.Attribute("ID").Value == "22").Descendants("ALLOCATION");
    dataGridView1.DataSource = res.ToDataTable();
    Now my question is:
    I would like to update the data from the DataGridview with the Attribute("ID").Value == "22" and save the data back to the XML.
    For example, after I load my data on the datagridview, we only pickup anything that is in the node
    <DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones">
    <ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">2500</ALLOCATION>
    <ALLOCATION DEMANDE="7000" CODE="75" PRICE="35.00">4000</ALLOCATION>
    </DEAL>
    I updated the datagridview below with DEMANDE = 9000 CODE = 66 PRICE = 24.77 AND ALLOCATION = 1200
    I want be able to extract the data back in the xml as a child of the DEAL ID = "22"
    So that the XML file looks like this 
    <DEALS>
    <DEAL ID="22" ISBN="0-7888-1623-3" Screenplay="Mary Kaplan" Title ="Mr Gentleman" Director = "Jonathan Jones">
    <ALLOCATION DEMANDE="5000" CODE="72" PRICE="25.00">2500</ALLOCATION>
    <ALLOCATION DEMANDE="7000" CODE="75" PRICE="35.00">4000</ALLOCATION>
    <ALLOCATION DEMANDE="9000" CODE="66" PRICE="24.77">1200</ALLOCATION> <-! this is the new line !->
    </DEAL>
    <DEAL ID="23" ISBN="1-7988-1623-3" Screenplay="Joe Doe" Title ="Nothing Much" Director = "Listentome">
    <ALLOCATION DEMANDE="3300" CODE="72" PRICE="15.00">2500</ALLOCATION>
    </DEAL>
    </DEALS>
    Is there a way to achieve that?
    I have been searching and reading in the books but i cannot find a solution for this.
    Thank you
    Please do not forget to click “Vote as Helpful” if the reply helps/directs you toward your solution and or "Mark as Answer" if it solves your question. This will help to contribute to the forum.

    I would think of something like the below, the id is passed as static you need to change this
    protected virtual void button1_Click(object sender, EventArgs e)
    //Get DataTable from DGV datasource
    DataTable dt = new DataTable();
    dt = (DataTable)dataGridView1.DataSource;
    string file1 = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><DEALS><DEAL ID=\"22\" ISBN=\"0-7888-1623-3\" Screenplay=\"Mary Kaplan\" Title =\"Mr Gentleman\" Director = \"Jonathan Jones\"><ALLOCATION DEMANDE=\"5000\" CODE=\"72\" PRICE=\"25.00\">2500</ALLOCATION><ALLOCATION DEMANDE=\"7000\" CODE=\"75\" PRICE=\"35.00\">4000</ALLOCATION></DEAL><DEAL ID=\"23\" ISBN=\"1-7988-1623-3\" Screenplay=\"Joe Doe\" Title =\"Nothing Much\" Director = \"Listentome\"><ALLOCATION DEMANDE=\"3300\" CODE=\"72\" PRICE=\"15.00\">2500</ALLOCATION></DEAL></DEALS>";
    StringReader reader = new StringReader(file1);
    XDocument doc1 = XDocument.Load(reader);
    //Remove all elements related to the id being populated into the Grid
    doc1.Descendants("DEAL").ToList().Where(x => x.Attribute("ID").Value == "22").Descendants("ALLOCATION").Remove();
    //loop through datatable and create new xelement to be added to the xdocument
    foreach (DataRow dr in dt.Rows)
    XElement xe = new XElement("ALLOCATION",
    new XAttribute("DEMANDE", dr[0].ToString()),
    new XAttribute("CODE", dr[1].ToString()),
    new XAttribute("PRICE", dr[2].ToString()));
    xe.Value = dr[3].ToString();
    doc1.Descendants("DEAL").ToList().Where(x => x.Attribute("ID").Value == "22").FirstOrDefault().Add(xe);
    Fouad Roumieh

  • Remote debugging an executable with dynamically loaded subpanel VIs

    All,
    A colleague of mine is attempting to perform remote debugging of an executable he has inherited. It includes subpanels that show dynamically loaded VIs. When connecting with the remote debugger, the main executable shows fine, but the dynamically loaded VIs are not showing their front panels. They appear ok on the remote PC where the executable is running, but they don't appear on his laptop from where he is running the debugger.
    I don't have access to LabVIEW currently, and he cannot get this to work, so I thought I'd ask the community this generic question:
    "Is it possible to remotely debug a LabVIEW executable with subpanels that show dynamically loaded subVIs?"
    Technically he can see and probe the block diagram of the main executable, but the subpanels are blank where the dynamcally loaded subVI front panel should show, making it impossible to interact with the program.
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

    Thanks Josh. Does this issue have a CAR number I can tag?
    Thoric (CLA, CLED, CTD and LabVIEW Champion)

  • How do I dynamically load a SWF that was compiled from an Fla with a linked external class file

    I am dynamically loading external SWFs in a Main Fla in response to clicks on a menu.
    The loading code is standard and works fine for all of the SWFs except one. When I try to load it I get the following error:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.
    I am certain that the URL to the problem SWF is correct. The SWF itself doesn't load any other SWFs or images.
    The problem SWF is linked to an external class file and compiled with it.
    i.e. in the properties panel of the main timeline of the problem SWF's Fla I have entered the path to the external class.
    1. there is no problem compiling this SWF with the class (it works fine by itself)
    2. if I remove the external class from the properties panel and don't use it the resulting SWF imports without a problem into the Main Fla mentioned before
    So the problem seems to be the fact that the external class is linked in the properties panel. Is this a path problem?
    Would appreciate any suggestions,
    Thanks!

    despite what you say, that loaded swf most likely is loading something and that's the cause of the error.
    you could test that by putting the main swf's embedding html file in the same directory with problematic swf.  if the problem is as explained above, you'll have no problem when the main html is in the same directory with the loaded swf.

  • How to update old instances with values

    Hi,
    i am using albpm 5.7 version.
    i have a requirement i need to update the oldinstances with updated data.
    suppose i have added new external variable to process how it will update the old instances.
    plz suggest how to solve this problem.
    Regards,
    Srinivas.

    Hi,
    The standard behaviour is that new instances of the process will use the most recent version of the process that has been deployed to the database. This allows you to deploy new versions of the processes without impacting on processes which are already in progress.
    When the workflow engine determines what activity to run next in the process, the engine checks what the start date of the process instance was, so that it can check what version of the process was active at that time. If you update the start date for each running process, so that it reflects the date that you saved the most recent version of the flow, then the workflow engine will use the latest version instead of the version that it was running.
    This is not supported. I would never suggest that you do this in a production environment - it does not make sense to be making frequent changes to the process in a production environment, since there is no supported mechanism for forcing existing flows to use the new definition. The engine is designed specifically to run the same version of the process for the duration of the process instance - what you want to do is to blow this out of the water completely. If you do change this, then all timing that is recorded against the activities becomes useless, and the other impact on the workflow process us something that you would need to consider incredibly carefully before deciding whether you want to take the risk.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://thoughts.workflowfaq.com ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • Why set bosed mode cant be used with UPDATE or DELETE loading strategy

    Hi,
    Could u please tell me why i am not able to use SET BASED mode with UPDATE or DELETE loading strategy in OWB mappings.
    Appreciate your help.

    I came across this point while reading OWB documenation which i got from
    http://www.oracle.com/technology/documentation/index.html
    Here is the topic details:
    Staretegies for configuring PL/SQL mappings
    Set Based
    here is the exact statement from the document..
    Warehouse builder doesnt support UPDATE or DELETE loading in set set based mode.

  • Can I dinamicly load a class with custom class loader ?

    Can I dinamicly load a class with custom class loader ?

    Hi,
    I was wondering if you found answer to your question, and also were you using your custom class loader inside a signed applet as I am in a similar situation, and was wondering if you could help me. An example would be great...
    Thanks a lot.
    Regards.

  • Alpha transparency borders on dynamically loaded images for use with textures

    Hi there folks. Well, I have been beating my head over this
    and am hoping one of you can help me out.
    Essentially I have 16bit images that are loaded into my
    shockwave application at run-time. These images are user defined
    which means that I will not know their size ahead of time. Once the
    images are loaded I then create textures and apply them to various
    shaders. Ok, all of this works just fine. What I need to do though
    is create an alpha transparent border around the images, so when I
    apply them to their surfaces I only see the image and nothing
    around it. I am doing this because these images will only appear at
    specific parts on a surface, textureRepeat will be false, and many
    models will be stacked in the same exact location using the same
    model resource. I have everything working, but I cannot figure out
    the alpha part for the life of me. Also, when I test the alpha
    based image by itself it works just fine. It is not until I try and
    combine the 16bit (converted to 32bit at run-time) image that I run
    into problems.
    I have tried:
    - Creating a 32bit alpha image in Fireworks with a
    transparent border and a black rect for the inside. I then copy the
    dynamic image over the alpha image (only after going from 16bit to
    32bit in imaging Lingo) and leave a little room at the edges for
    the transparency. Well, I get a crazy amount of streaks here even
    when I try to up the trans border by around 24 pixels on each side.
    - Using another similiar alpha based image as a mask with
    copyPixels and extractAlpha/setAlpha like this... (code is a little
    rough here)
    newImage = new(#bitmap)
    newImage.name = "place_Test"
    newImage.image = member("place").image
    newAlpha = new(#bitmap)
    newAlpha.name = "AHH"
    newAlpha.image = image(newImage.image.width + 24,
    newImage.image.height + 24, 32)
    newAlpha.image.useAlpha = true
    newAlpha.image.copyPixels(member("vase").image,
    newAlpha.image.rect, member("vase").image.rect)
    newAlphaInfo = newAlpha.image.extractAlpha()
    newAlpha.image.useAlpha = false
    --reverse dark to light
    iAlphaReverse = image(newAlpha.image.width,
    newAlpha.image.height, 8, #grayscale)
    iAlphaReverse.fill(iAlphaReverse.rect, rgb(0,0,0))
    iAlphaReverse.copyPixels(newAlphaInfo, iAlphaReverse.rect,
    newAlphaInfo.rect, [#ink : #reverse])
    --newAlphaInfo.copyPixels(iAlphaReverse, newAlphaInfo.rect,
    iAlphaReverse.rect, [#ink:#subtractpin])
    newAlphaMask = iAlphaReverse.createMask()
    rescaleAbs(newImage, newImage.image.width,
    newImage.image.height, "place_Test", 32)
    destImage = member("place_Test").image.duplicate()
    destImage.fill(destImage.rect, rgb(0,0,0))
    newAlpha.image.useAlpha = false
    destImage.copyPixels(newImage.image, newImage.image.rect,
    newImage.image.rect, [#maskImage:newAlphaMask, #ink:#add])
    destImage.setAlpha(iAlphaReverse)
    destImage.useAlpha = true
    member("place_Test").image = destImage
    I apologize for the messy code. I have cut and pasted from
    all over the place and am getting confused. In any case, I think I
    am making this harder then it needs to be and hope someone can
    help.
    Thank you in advance,
    Dave

    Hi, you can try using other texture layer as mask on the same
    shader. As usually you create the texture from a dynamic loaded
    image, then apply this texture to the shader on the texture list
    index 1 (textureList[1]). Next part does the job, create other
    texture from a 32 bits image with the alpha information and fill
    all pixels with white color, this is very important because the
    second texture layer will be multiply with the first texture layer.
    This texture set its render format to rgba8888. Apply the mask
    texture to the same shader at texture list index 2, verify that the
    blendFunctionList index 2 is #multiply.
    I include the code of a project that use this masking
    approach:
    property pMember
    property pEarthSphere
    property pNightSphere
    property pLastTransform
    on beginSprite me
    pMember = sprite(me.spriteNum).member
    me.setupWorld()
    end
    on setupWorld(me)
    pMember.resetWorld()
    repeat with i = pMember.light.count down to 1
    pMember.deletelight(i)
    end repeat
    vEarthModelResource = pMember.newModelResource("EARTH MODEL
    RESOURCE", #sphere)
    vEarthModelResource.radius = 50.000
    vEarthModelResource.resolution = 20
    vEarthTexture = pMember.newTexture("EARTH TEXTURE",
    #fromCastMember, member(3,1))
    vEarthShader = pMember.newShader("EARTH SHADER", #standard)
    vEarthShader.emissive = color(255,255,255)
    vEarthShader.flat = TRUE
    vEarthShader.transparent = FALSE
    vEarthShader.textureList[1] = vEarthTexture
    pEarthSphere = pMember.newModel("EARTH MODEL",
    vEarthModelResource)
    pEarthSphere.shaderList = vEarthShader
    vNightModelResource = pMember.newModelResource("NIGHT MODEL
    RESOURCE", #sphere)
    vNightModelResource.radius = 50.2000
    vNightModelResource.resolution = 20
    vNightTexture = pMember.newTexture("NIGHT TEXTURE",
    #fromCastMember, member(4,1))
    vNightTexture.quality = #lowFiltered
    vNightTexture.nearFiltering = FALSE
    vNightTexture.renderFormat = #rgba8880
    vNightShader = pMember.newShader("NIGHT SHADER", #standard)
    vNightShader.emissive = color(255,255,255)
    vNightShader.flat = TRUE
    vNightShader.transparent = TRUE
    vNightShader.textureList[1] = vNightTexture
    vMaskNightTexture = pMember.newTexture("MASK NIGHT TEXTURE",
    #fromCastMember, member(6,1))
    vMaskNightTexture.renderFormat = #rgba8888
    vNightShader.textureList[2] = vMaskNightTexture
    vNightShader.textureModeList[2] = #wrapPlanar
    pNightSphere = pMember.newModel("NIGHT MODEL",
    vNightModelResource)
    pNightSphere.shaderList[1] = vNightShader
    pNightSphere.parent = pEarthSphere
    end
    on exitFrame(me)
    pEarthSphere.rotate(0.0,0.1,0.0)
    me.moveMaskNightTexture()
    end
    on moveMaskNightTexture(me)
    vRotationVector = - pEarthSphere.transform.rotation
    pNightSphere.shaderList[1].wrapTransformList[2].rotation =
    vRotationVector
    end

Maybe you are looking for