HP ALM OTAClient.dll is incompatible with 64Bit OS - java

I Added a code to connect and create a defect in HP ALM through Eclipse(Java) in which it communicates OTAClient and com4j.jar. I successfully able to connect and create a defect in 32 Bit OS but i couldn't able to connect it on 64 bit based OS.
I walkaround some of the solutions posted here and even though following the solution successfully i couldn't achieve a solution.
[1]: com4j on Windows 64 bit ..
Here is My Code
import com.ClassFactory;
import com.IBug;
import com.IBugFactory;
import com.ITDConnection;
import com4j.Variant;
public class AlmQc {
public static void main(String args[])
{
login();
}
public static void createDefect(ITDConnection connection) {
IBugFactory bugFactory = (IBugFactory) connection.bugFactory().queryInterface(IBugFactory.class);
IBug bug = (bugFactory.addItem(new Variant(Variant.Type.VT_NULL))).queryInterface(IBug.class);
bug.assignedTo("Administrator");
bug.detectedBy("Administrator");
bug.status("New");
bug.project("Banking");
bug.summary("Created by Esh");
//bug.priority("Low");
bug.field("BG_SEVERITY", "2-Medium");
bug.field("BG_DETECTION_DATE", "2016-01-27 00:00:00");
bug.post();
}
public static void login()
{
String url = "http://almqc:8080/qcbin";
String username = "Administrator";
String password = "********";
String domain = "DEFAULT";
String project = "Banking";
ITDConnection itdc = ClassFactory.createTDConnection();
itdc.initConnectionEx(url);
itdc.connectProjectEx(domain, project, username, password);
System.out.println(itdc.projectConnected());
createDefect(itdc);
}
While running above code in eclipse i encountered following error.
Exception in thread "main" com4j.ExecutionException: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j.cpp:153
at com4j.ComThread.execute(ComThread.java:203)
at com4j.Task.execute(Task.java:25)
at com4j.COM4J.createInstance(COM4J.java:97)
at com4j.COM4J.createInstance(COM4J.java:72)
at com.mercury.qualitycenter.otaclient.ClassFactory.createTDConnection(Unknown Source)
at Sample.main(Sample.java:18)
Caused by: com4j.ComException: 80040154 CoCreateInstance failed : Class not registered : .\com4j.cpp:153
at com4j.Native.createInstance(Native Method)
at com4j.COM4J$CreateInstanceTask.call(COM4J.java:117)
at com4j.COM4J$CreateInstanceTask.call(COM4J.java:104)
at com4j.Task.invoke(Task.java:51)
at com4j.ComThread.run0(ComThread.java:153)
at com4j.ComThread.run(ComThread.java:134)
Please provide any walkaround or solution who got successfully executed on 64 bit Based OS.

You'll have to make a 32-bit version of your program that can use the 32-bit version of OTACLIENT.DLL. I'm not aware of a 64-bit version of OTACLIENT.DLL.

The issue is not with 64 bit OS but with 64 bit JRE. If you are using IDE, point your JRE library (build path) to a 32 bit JRE (bin folder) else you can also install 32 bit JRE in 64 bit machines and run in that environment

OTAClient is pure windows dll, even though you are using java you need to register it on windows machine. Better approach to get most out of it is to use it with .net, in such cases you can create windows/web service exposed over http. With this service you can develop c# code to do operations with OTAClient.dll. Using web/rest/wcf service you can communicate with the developed service. Gr8 part of it is it allows you to run over 64-bit architecture. IIS also allows with option "Enable 32-bit application" at application pool level.

Related

Unable to create grpc connection in 32bit windows machine

I am trying to access the list of Subscribers in my GCP Project using my java code and few libraries provided by GCP. This code works fine in my 64 bit Windows environment but not working in 32bit windows environment.
I have seen in a few documents, saying that netty is not supported on 32bit machines and we can build our own binaries if required.
https://netty.io/wiki/forked-tomcat-native.html#how-to-build
CredentialsProvider credentialsProvider =
FixedCredentialsProvider.create(
ServiceAccountCredentials.fromStream(new FileInputStream(JSONPath)));
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create(SubscriptionAdminSettings.newBuilder().setCredentialsProvider(credentialsProvider).build())) {
ListSubscriptionsRequest listSubscriptionsRequest =
ListSubscriptionsRequest.newBuilder()
.setProject(ProjectName.of(ProjectId).toString())
.build();
SubscriptionAdminClient.ListSubscriptionsPagedResponse response =
subscriptionAdminClient.listSubscriptions(listSubscriptionsRequest);
logger.log(Level.SEVERE,"response List: "+response.toString());
Iterable<Subscription> subscriptions = response.iterateAll();
for (Subscription subscription : subscriptions) {
if(subscription.getName().equals(SubscriptionId)){
return true;
}
}
[20:02:30:384]|[06-17-2019]|[io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts]|[INFO]|[36]: netty-tcnative unavailable (this may be normal)|
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_windows_x86_32, netty_tcnative_x86_32, netty_tcnative] at io.grpc.netty.shaded.io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:104)
at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:526)
at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSsl.(OpenSsl.java:93)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:244)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:171)
at io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:120)
at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:385)
at io.grpc.internal.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:435)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:254)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:165)
at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:157)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:157)
at com.google.cloud.pubsub.v1.stub.GrpcSubscriberStub.create(GrpcSubscriberStub.java:260)
at com.google.cloud.pubsub.v1.stub.SubscriberStubSettings.createStub(SubscriberStubSettings.java:241)
at com.google.cloud.pubsub.v1.SubscriptionAdminClient.(SubscriptionAdminClient.java:177)
at com.google.cloud.pubsub.v1.SubscriptionAdminClient.create(SubscriptionAdminClient.java:158)
The grpc-java SECURITY.md describes your options:
Use Java 9+, which support ALPN without need for tcnative
For 32 bit Windows specifically, you can Conscrypt
The documentation also describes how to use Conscrypt. Namely to add a dependency on conscrypt-openjdk-uber and to register it as the default security provider:
import org.conscrypt.Conscrypt;
import java.security.Security;
...
// Somewhere in main()
Security.insertProviderAt(Conscrypt.newProvider(), 1);
You answered your own question... netty-tcnative-* does not support 32bit platforms so you will need to compile it yourself and include it in your class-path.

InetAddress.getByName fails getaddrinfo works

I've been having an issue with DNS lookup for IPv6 addresses that I can't seem to find good information about.
I'm trying to lookup an IPv6 address using InetAddress.getByName("ipv6.local.com"). It throws an UnknownHostException error.
The weird part is I know the DNS server can be contacted because this works:
InetAddress.getByName("ipv4.local.com")
I also know the IPv6 record is working because I can run:
nslookup ipv6.local.com
and it properly returns 3ffe:b00:0:1:4678:3eff:fe36:16e8.
Likewise, if I run the following in C++, I get a result with the above address as well:
int errorCode = getaddrinfo("ipv6.local.com", "4242", &hints, &res);
I have also tried Inet6Address.getByName(), but this also throws UnknownHostException. So why do getaddrinfo() and nslookup work and not InetAddress.getByName()?
I am attempting the DNS lookup from an Android device (Galaxy Tab S2 8") running Android 6.0.1 on the same network as the DNS server. The DNS server has a record "ipv4.local.com" pointing to 192.168.0.190, and a record "ipv6.local.com" pointing to 3ffe:b00:0:1:4678:3eff:fe36:16e8.
The DNS server is explicitly set in Wi-Fi settings on the Android device, and is running on 192.168.0.182.
Any ideas?
I am not sure why IPv6 resolution is not working for you. Here is the example of Java code(java version "1.8.0_171") I tested:
package com.myjava.ip;
import java.net.InetAddress;
import java.net.UnknownHostException;
class MyIpByHost {
public static void main(String a[]){
try {
InetAddress host = InetAddress.getByName("ipv6.google.com");
System.out.println(host.getHostAddress());
} catch (UnknownHostException ex) {
ex.printStackTrace();
}
}
}
Output: java com/myjava/ip/MyIpByHost => 2404:6800:4003:c02:0:0:0:8a
This code returns IPv6 for endpoint "ipv6.google.com".
Java run C functions in it's backend to get work done. As you already know getaddrinfo() function of C supports IPv6, but gethostbyname() does not.
You may be running outdated version of java with underlying C function
gethostbyname() which does not support IPv6. I
would suggest you to upgrade Java which will use getaddrinfo().

Java error sending sms message with gsm modem

Hi there I am trying to send a sms message using Java with a GSM Modem
I am learning from this URL: http://www.codeproject.com/Tips/492716/How-to-send-SMS-using-Java-with-a-HSDPA-Dongle
Here is my code:
import com.harshadura.gsm.smsdura.GsmModem;
public class TestSMS {
private static String port = "COM1"; //Modem Port.
private static int bitRate = 9600; //this is also optional. leave as it is.
private static String modemName = "ZTE"; //this is optional.
private static String modemPin = "0000"; //Pin code if any have assigned to the modem.
private static String SMSC = "+9477000003"; //Message Center Number ex. Mobitel
public static void main(String[] args) throws Exception {
GsmModem gsmModem = new GsmModem();
GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);
gsmModem.Sender("+917350320106", "Test Message"); // (tp, msg)
}
}
I have added the various libraries to the built path of my project:
comm.jar
commons-net-3.0.1.jar
smsdura-1.0.jar
RXTXcomm.jar
However, I get this error when i run the project:
Exception in thread main org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
Please help
First fill arguments in this line "GsmModem.configModem(port, bitRate, modemName, modemPin, SMSC);"
1.port
can simply right click the MyComputer Icon > go to Mange > then Search for Modems > then it will pop up a interface with several tabs. Okay then you can simply notice theirs a Name called port. In front of that there is the port number. Now you know the port number. Insert that into the code.
2.Modem name
is a optional thing
3.Bit rate?
Leave it as it is. Or change to a proper one. The number will change depending modem to modem.
4.Some modems are using PIN numbers for Security. Does your one also using such a pin? If so please insert it to the code. if you have code in your modem
5.fill your network service center no...check your message setting..
This error can occur due to several reasons.
Your dongle software might be opened. So close it, double check if its running as a background service by using Task Manager. Kill it if it still runs.
Your SMSLib configurations to JVM is not affected properly. So check again the required files are there or not. You need to place them both JDK and JRE see 1
This program does not work well with 64Bit JVM, but it does not say you cannot use it in a 64 bit machine. You have installed 32Bit JDK on the machine, remove the 64Bit JDK to prevent mix ups.
The port you going to access might not really be available in the system. You can simple check the Dongle port if its there by: right clicking Computer icon then go manage > then select device manager > then expand Ports(COM LPT) column > You will see the Application interface port of your device. Thats the port you have to use thre.

Utgard - Access denied

I have been unable to find a solution that fixes my issue, so I am opening a new topic.
Utgard (http://openscada.org/projects/utgard) seems like a very useful tool to me. In this phase I just want to be able to access the TOP OPC Server locally on a Windows 8 OS via Eclipse. However, when trying to run their tutorial I end up with an "Access is denied". I do not think that I have made any mistakes with username, password and so on.
The Exele OPC DA Test Client does not return any errors. I can connect, retrieve and rewrite values.
Please note that I am a newbie when it comes to OPC and OpenSCADA. Any help will be greatly appreciated.
package org.openscada.opc.tutorial;
import java.util.concurrent.Executors;
import org.jinterop.dcom.common.JIException;
import org.openscada.opc.lib.common.ConnectionInformation;
import org.openscada.opc.lib.da.AccessBase;
import org.openscada.opc.lib.da.DataCallback;
import org.openscada.opc.lib.da.Item;
import org.openscada.opc.lib.da.ItemState;
import org.openscada.opc.lib.da.Server;
import org.openscada.opc.lib.da.SyncAccess;
public class UtgardTutorial1 {
public static void main(String[] args) throws Exception {
// create connection information
final ConnectionInformation ci = new ConnectionInformation();
//final ConnectionInformation connectionInformation = new ConnectionInformation();
ci.setHost("127.0.0.1");
//ci.setDomain("");
ci.setUser("Me");
ci.setPassword("Password");
ci.setProgId("SWToolbox.TOPServer.V5");
//ci.setClsid("680DFBF7-C92D-484D-84BE-06DC3DECCD68"); // if ProgId is not working, try it using the Clsid instead
// create an id for the tag you want to retrieve
final String itemId = "_System._Time_Second";
// create a new server
final Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
//final Server serverServer = new Server(connectionInformation, Executor.newSingleThreadSchedulesExecutor);
try {
// connect to server
server.connect();
// add sync access, poll every 500 ms
final AccessBase access = new SyncAccess(server, 500);
access.addItem(itemId, new DataCallback() {
#Override
public void changed(Item item, ItemState state) {
System.out.println(state);
}
});
// start reading
access.bind();
// wait a little bit
Thread.sleep(10 * 1000);
// stop reading
access.unbind();
} catch (final JIException e) {
System.out.println(String.format("%08X: %s", e.getErrorCode(), server.getErrorMessage(e.getErrorCode())));
}
}
}
Error stack trace:
INFO org.openscada.opc.lib.da.Server - Failed to connect to server
org.jinterop.dcom.common.JIException: Access is denied, please check whether the [domain-username-password] are correct. Also, if not already done please check the GETTING STARTED and FAQ sections in readme.htm. They provide information on how to correctly configure the Windows machine for DCOM access, so as to avoid such exceptions. [0x00000005]
at org.jinterop.winreg.smb.JIWinRegStub.winreg_OpenKey(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.jinterop.dcom.core.JIProgId.getIdFromWinReg(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.jinterop.dcom.core.JIProgId.getCorrespondingCLSID(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.jinterop.dcom.core.JIComServer.<init>(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.openscada.opc.lib.da.Server.connect(Server.java:123) ~[org.openscada.opc.lib_1.0.0.201303051455.jar:na]
at org.openscada.opc.tutorial.UtgardTutorial1.main(UtgardTutorial1.java:32) [bin/:na]
Caused by: org.jinterop.dcom.common.JIRuntimeException: Access is denied, please check whether the [domain-username-password] are correct. Also, if not already done please check the GETTING STARTED and FAQ sections in readme.htm. They provide information on how to correctly configure the Windows machine for DCOM access, so as to avoid such exceptions. [0x00000005]
at org.jinterop.winreg.IJIWinReg$openKey.read(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at ndr.NdrObject.decode(Unknown Source) ~[org.openscada.jinterop.deps_1.0.0.201303051454.jar:na]
at rpc.ConnectionOrientedEndpoint.call(Unknown Source) ~[org.openscada.jinterop.deps_1.0.0.201303051454.jar:na]
at rpc.Stub.call(Unknown Source) ~[org.openscada.jinterop.deps_1.0.0.201303051454.jar:na]
You don't have access to the local Windows Registry, so the client fails to convert the server's ProgID to CLSID. Make sure you run the application with enough privileges in there, i.e. that you are an Administrator user.
Alternatively, you can just configure the connection using the server's CLSID, so you will not need the registry.
An OPC client should actually use the OpcEnum service running on the server computer to do the ProgID to CLSID conversion. Perhaps the service is not available or Utgard only tries the registry (I do not know Utgard myself). If you don't have the server installed on the client machine, the registry-based ProgID to CLSID conversion will fail anyway, since that information is not available in the local Windows Registry. The worst case is that Utgard will try to open the remote Windows Registry, which only rarely succeeds (or you need to ensure that it's enabled separately).
Note that as I do not know Utgard, I am just guessing which strategies it is attempting. Nevertheless, using CLSID only will bypass the whole conversion part, which is your problem.
E: Considering that your other client can connect without a problem, I suspect that Utgard does not try to use OpcEnum at all.
I got the same error, and solve the problem by
applying the following patch to the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
create or modify 32-bit DWORD: LocalAccountTokenFilterPolicy
set the value to: 1

socket mac os x vs windows java slow

Please help me figure out why the Mac OS X Java takes 5 times longer than the Windows XP Java.
I have some code that behaves differently on Mac and PC Java. I have a Java GUI that talks to a number of "servers" on a Windows XP box.
When I run the GUI on another Windows XP machine or a linux machine the LabView receives the messages and responds within 1 second.
When it runs from the Mac OS X box, it takes 5 seconds. The pause seems to be (from all we can tell debugging) between the time I THINK I send the string "pot 7\r\n" and the time it is actually received by LabView.
LabView sees the pot 7 command (we have a display to check) immediately when coming from Windows but according to the LabView programmer the command does not show up on the screen until the 5 seconds has passed when sent from the Mac OS machine.
I'll try to provide enough code here that someone who knows more might say aha!
String IPaddress;
int commPort;
BufferedReader reader;
PrintWriter writer;
Socket sock;
long timeout = 8000;
...
public synchronized void connectCommPort() {
if (commportconnected != true) {
try {
sock = new Socket();
InetSocketAddress endpoint = new InetSocketAddress(IPaddress, commPort);
sock.connect(endpoint, timeout);
sock.setSoTimeout( timeout );
reader = new BufferedReader(new InputStreamReader(sock.getInputStream()));
writer = new PrintWriter(sock.getOutputStream());
commportconnected = true;
errorstatus = false;
} catch (IOException ex) {
logwriter("LabV: WARNING - network connection to Labview command port failed."+ex.toString());
commportconnected = false;
errorstatus = true;
}
}
}
...
public synchronized float[] readpots() {
String message = "pot 7";
connectCommPort();
if (commportconnected) {
try {
writer.print(message + "\r\n");
writer.flush();
logwriter("LabV: [sent] " + message);
shortpotvalues = potslistener();
} catch (Exception ex) {
}
disconnectCommPort();
}
potvalues[0] = shortpotvalues[0];
potvalues[1] = shortpotvalues[1];
potvalues[2] = shortpotvalues[2];
potvalues[3] = shortpotvalues[3];
potvalues[4] = shortpotvalues[4];
potvalues[5] = shortpotvalues[5];
potvalues[6] = shortpotvalues[6];
potvalues[7] = 5.0f;
return potvalues;
}
public synchronized float[] potslistener() {
String message = null;
int i = 0;
try {
//while ((message = reader.readLine()) != null && i < shortpotvalues.length) {
while (i < shortpotvalues.length) {
message = reader.readLine();
if ( message != null )
{
logwriter("LabV: [received] " + message);
if (message.contains("."))
{
shortpotvalues[i] = Float.parseFloat(message);
i++;
}
}
else
{
logwriter("LabV: received NULL unexpectedly, may not have all pots correct");
}
} // close reader-ready-while
} catch (ArrayIndexOutOfBoundsException aiofbex) {
logwriter("LabV: in potslistener() Array out of bounds! " + aiofbex.toString());
} catch (Exception ex) {
logwriter("LabV: in potslistener() got exception: " + ex.toString());
}
return shortpotvalues;
}
On Mac OS X 10.8. running java -version gives:
marks-Mac-mini:~ mark$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
On Windows XP (the java used when the GUI is run on the windows and works fine) gives:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\gus>java -version
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
Finally here is part of the log from the PC:
2013-03-19T11:45:22.000 LabV: [sent] pot 7
2013-03-19T11:45:22.921 LabV: [received] 2.310835
2013-03-19T11:45:22.921 LabV: [received] 2.447397
And correspondingly from the Mac (note the 5 seconds between the send and the first received):
2013-03-13T12:13:17.092 LabV: [sent] pot 7
2013-03-13T12:13:22.513 LabV: [received] 2.300508
2013-03-13T12:13:22.514 LabV: [received] 2.112090
Thanks in advance for any help/advice.
Follow-up:
I've since discovered that if I use a 10.7.5 Mac OS machine with the same Java the speed is the same as the Windows XP. I am now looking into problems with 10.8.3 and networking and or security firewall settings. Again, any help is appreciated.
Maye this will help someone else.
When were running on an isolated network, this problem became a show-stopper. After all that work (simulator, outputstream, disabling bonjour, etc), the solution was to edit the hosts file on the Microsoft Windows XP box.
I think this worked because there was no time spent looking for a WINS or DNS server. What is annoying is that on a mac or linux box on the same network, addressing an IP address automatically eliminated any DNS calls that resulted in timeouts. Editing the file removed the strange delay completely. When I have access to the machine again, I will be more specific about what the edits were.
The debugging that led us to this problem was noticing some netbios request that took a long time to respond. I was not there when they saw this. My understanding is that they ran a packet sniffer on the mac os machine and saw these requests. When they edited the Windows machine hosts file, the problem went away (it could find the mac without that netbios broadcast).
"After some packet sniffing we have determined that the delay we've
been experiencing when querying the Agilent from the GUI has been due
to [the Windows XP machine] flailing about looking for the Agilent [a
motor controller] via the WINS service. Can't say that I completely
understand what's going on, but we verified that the delay goes away
when we turn the NetBIOS service off.
Which would be all good, except
that windows file sharing seems to depend on the NetBIOS service, thus
we can't access the disk on [the Windows XP machine] without it.
So we added two lines in the host file"
That is what my colleague sent me. So it was two systems away from my java code... I addressed a LabView app on a Windows XP box. I wrote a simulator for the LabView app. But the network problem was between the LabView app and another piece of equipment. So his solution was to put two lines in Windows\System32\Drivers\etc\hosts to resolve the Mac and the Agilent on the Windows side and the network delay went away!

Categories

Resources