March 2010 Archives

Reference from fixing VMWare NAT problems on Windows 7

First Step: change virtual IP

  1. Run "Manage Virtual Networks" (VMWare Player: start vmnetcfg.exe from installation directory) with administrave rights
  2. go to "Host Virtual Network Mapping" tab, select the ">" next to VMnet1 and (if necessary) change the subnet to something different than 192.168.137.0 (for example 192.168.50.0) and click apply
  3. go to "Host Virtual Network Mapping" tab, select the ">" next to VMnet8 and change the subnet to 192.168.137.0 and click apply
  4. go to "NAT" tab, click edit and change gateway IP adress to 192.168.137.1 and click apply

It is not necessary to restart the NAT service.

Second Step: enable ICS

  1. open the "Network and Sharing Center" and click "Change adapter settings"
  2. open the properties of your LAN-Connection, go to the "sharing" tab and enable "allow other network users to connet through this computer's internet connection" and select to connect through VMnet8
  3. windows tells you that it will assign IP 192.168.137.1, click OK

Third Step: check VMs

If you have configured a fixed IP inside your VM you must change the IP4 Gateway and DNS1 to 192.168.137.1

Note 1: Port forwarding has to be configured using the ICS Settings button, not the VMWare NAT-Dialog.

Note 2: Windows 7 Beta seems to use 192.168.137.1 as IP für ICS.

Note 3: no Windows Firewall changes are necessary

Using JNative call dll

| 1 TrackBack

Reference from JNative Howto

JNative is simpler than JNI.

1.Copy JNativeCpp.dll to Windows/systems32 folder.
2.Copy JNative.jar to your java project lib folder.
3.The example code to call dll function:

package jnative;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.xvolks.jnative.JNative;
import org.xvolks.jnative.exceptions.NativeException;
import org.xvolks.jnative.Type;

public class OMSignAPI {

    public static final String DLL_NAME = "C:\\Program Files\\OrderMaster\\OMSignAPI.dll";
    private static JNative api;

    public static void main(String[] args) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd kk:mm:ss");
        Timestamp now = new Timestamp(new Date().getTime());
        
        try {
            GoOrder("MTX001","",dateFormat.format(now).toString(),1,7400);
        } catch (NativeException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static final void IniDllAndPosition(String signID,
            int iniPosition) throws NativeException, IllegalAccessException {
        api = new JNative(DLL_NAME, "IniDllAndPosition");
        api.setRetVal(Type.INT);
        int i = 0;
        api.setParameter(i++, Type.STRING, signID);
        api.setParameter(i++, Type.INT, "" + iniPosition);
        api.invoke();
        int a = Integer.parseInt(api.getRetVal());
        if (a == 0){
            System.out.println("OMSignAPI IniDllAndPosition Error!!");
        }
    }

    public static final void GoOrder(String signID, String bySignStr,
            String dateTimeStr, int nowPosition, double nowPrice)
            throws NativeException, IllegalAccessException {
        api = new JNative(DLL_NAME, "GoOrder");
        api.setRetVal(Type.INT);
        int i = 0;
        api.setParameter(i++, Type.STRING, signID);
        api.setParameter(i++, Type.STRING, bySignStr);
        api.setParameter(i++, Type.STRING, dateTimeStr);
        api.setParameter(i++, Type.INT, "" + nowPosition);
        api.setParameter(i++, Type.DOUBLE, "" + nowPrice + ".0");
        api.invoke();
        int a = Integer.parseInt(api.getRetVal());
        if (a == 0){
            System.out.println("OMSignAPI GoOrder Error!!");
        }
    }
}

Reference: Connection factory JNDI name practices
Using the direct JNDI DataSource, jdbc/xxxxxx, at Hibernate 3.X on Websphere 6.X has wrong message below:
J2CA0294W: Deprecated usage of direct JNDI lookup of resource jdbc/mysqlds.
The following default values are used: [Resource-ref settings]
or
J2CA0294W: 已棄用 jdbc/mysqlds 資源的直接 JNDI 查閱。使用下列預設值:[Resource-ref settings]
1.Just use Resource-ref in web.xml,add the resource setting, like

 <resource-ref id="ResourceRef_1268360344308">
  <res-ref-name>jdbc/MySQL</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Application</res-auth>
  <res-sharing-scope>Shareable</res-sharing-scope>
 </resource-ref>

2. Add below in ibm-web-bnd.xmi,

  <resRefBindings xmi:id="ResourceRefBinding_1268360344308" jndiName="java:/comp/env/jdbc/mysqlds">
    web.xml#ResourceRef_1268360344308"/>
  </resRefBindings>

Then, the wrong message issue can be solved.

Reblog this post [with Zemanta]

February 2012

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

Archives

Powered by Movable Type 4.34-en

About this Archive

This page is an archive of entries from March 2010 listed from newest to oldest.

February 2010 is the previous archive.

April 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.