DCOM access via j-interop in Server 2008 R2 - java

I'm trying to access WMI via j-interop (www.j-interop.org/), wich is a Java DCOM client.
However, I always get a "Access is denied" error.
Things I've tried:
disabled the Firewall
set permission on HKEY_CLASSES_ROOT\CLSID{76A64158-CB41-11D1-8B02-00600806D9B6}, which is the WMI component I'm trying to access
OS is Windows Server 2008 R2.
No luck. Any ideas?

maybe you could try additionally the following:
Is UAC active? If yes than disable it. (Note: You could also disable it only for Build In\Administrator or all Administrators, if you use one of these accounts)
Is the service remote registry started? If not start it.
Did you enable AutoRegistration? JISystem.setAutoRegisteration(true);
I hope this will help.

Related

Accessing Google Cloud VM Instance Tomcat using External IP

I am trying to access my Tomcat HomePage which is inside my Google Cloud VM Instance with External IP address 35.189.85.127 and Internal IP 10.154.0.2. On my local machine, in my browser I tried http://35.189.85.127 and http://35.189.85.127:8080 but got error
The connection has timed out. The server at 35.189.85.127 is taking too long to respond.
I have seen all the questions and replies on stackoverflow regarding this question but still I found no clear solution.
The steps that I've done so far:
I have setup a Google Cloud VM instance in Compute Engine. I am using Windows Server 2016 as the image.
Using RDP I log on to Windows Server.
I successfully installed Java 1.7 and Tomcat 7 on Windows Server.
I tested Java and Tomcat 7, both are working fine i.e. I open browser and type localhost:8080 and it shows Tomcat HomePage.
I replaced localhost with my VM Instance Internal IP i.e. 10.154.0.2:8080 and it again correctly shows Tomcat HomePage.
Now I try to access Tomcat HomePage using my VM Instance External IP (Static) 35.189.85.127 but in my browser I get error
The connection has timed out. The server at 35.189.85.127 is taking too long to respond.
Faced the same issue today.
Noticed from your question that you're using an Windows environment.
On Windows
Be sure that the Windows Firewall is properly configured to allow traffic under the ports you need (or deactivate it).
On GCP
Under "VPC Network/Firewall Rules", create a new firewall rule and configure as below:
Firewall Rule Parameters (image)
Or, you have the option to check the "Allow HTTP traffic" option under the Instance Configuration menu and edit Tomcat's server.xml to startup at port 80, as described here:
Change Tomcat Port Tutorial # StackOverflow
Option1: If it's just tomcat. GCP offers a click to launch Tomcat instance with an external IP. You can SSH and also have a temp tomcat username and password to manage any of your deployments.
https://console.cloud.google.com/launcher/details/click-to-deploy-images/tomcat
Option 2:
If you wish to have a Google Cloud VM instance in Compute Engine.
You will need to setup security groups and assign it to your instance.
Eg. Define rules to Open Tomcat port 8080(or any) externally / range. Assign that group/rule to your VM instance.
There are many options available, it all depends on how you wish to organize things. You could create a VPC and add your instances there or keep them under the same subnet or have them accessible externally etc.

Remotely connect to SQL Server through Java from an untrusted domain with Windows authentication

I am trying to remotely connect to SQL Server from a remote machine on an untrusted domain (I am not on the same domain as the host with the SQL server). The SQL Server is using Windows authentication and I can't change that. I am not allowed to make any manual changes to that remote machine like using SQL authentication. I can't add my machine to trusted domain(At least not manually). Currently using WMI I am able to access registry, etc. I know using runas /netonly command I can pretend I am on that machine but I can't use this command as it has to be all Java. I know with WMI I'll be able to connect to that machine having its ip/password and get different type of information but is there away to run SQL queries and all as well? Or any other solution using Java?
P.S. currently of course, I am getting "com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."
Thank you.
I couldn't connect to SQL Server through Java remotely when not being in the same domain and only having the Windows Authentication option. So I ended up changing the security option manually in SQL Server management Studio to both using SQL user and Windows Authentication. This way I could connect to it using the SA!

How to debug a jar remotely from netbeans

I'm trying to figure out how to debug my jar that is running remotely. Here is my scenario:
My .jar will be running from a VPS. This jar basically runs a server
for a game, so it also connects to a mysql db. I start the server with 3 .bat files that looks something like this:
set CLASSPATH=.;dist\aries.jar;dist\mina-core.jar;dist\slf4j-api.jar;dist\slf4j-jdk14.jar;dist\mysql-connector-java-bin.jar
java -Xmx500m -Dwzpath=wz\ -Djavax.net.ssl.keyStore=filename.keystore -Djavax.net.ssl.keyStorePassword=passwd -Djavax.net.ssl.trustStore=filename.keystore -Djavax.net.ssl.trustStorePassword=passwd net.world.WorldServer
pause
What I want to do is start the server on the vps like normal, but debugging the server on my local machine via Netbeans IDE. I don't know if this is possible because people will be connecting to the server (although, I will be debugging a test server which will only have me online).
Note: I have done a lot of searching before coming here and a lot of what I found had to do with using xdebug & php which has doesn't have much to do with my situation (I don't think)
-Thanks
There's a NetBeans FAQ page about this.
In brief:
Add the remote debugging options to your Java command. For example:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n
Then, use the attach debugger option in NetBeans and select your server and the port you used above (8888). It's pretty much that easy.
You may want to think about network and firewall considerations, as you may have noticed there are no passwords involved, so anyone who can connect to the port can debug your app. This could be a big security risk. Your VPS provider probably has some tools to help with setting up a secure, private connection.

Eclipse Proxy authorisation exception

I am using Eclipse 3.5 along with JDK 1.6.0_23 (both on Laptop and desktop) within my organisation. The proxy server uses Windows domain authentication to pass through request.
While adding update sites within Eclipse available on Laptop, I could see that Eclipse is able to connect the site and doesn't throw authorisation exception. I have set the Active Provider in Network Connections as Native. I haven't configured my credentials in eclipse anywhere and it communicates with Proxy server smoothly.
I have similar settings on my desktop machine, but it throws Proxy Authorization exception. There is no clue in Error log. But it does displays a information indicating
System property http.proxyHost is not set but should be XXX.XXX.XXX.XXX.
Similar messages do appear for http.proxyPort and https as well. I don't want to explicitly enter my credentials in Eclipse and hence looking for clues as why similar settings are behaving differently in these environments.
I had the same problem with eclipse luna. I tried this link
( http://javarevisited.blogspot.com/2014/01/eclipse-not-able-to-connect-internet-market-place-configure-proxy-settings.html ) and it helped me resolve the problem!

Netbeans not able to connect to internet

I am using windows 8 (64bit) but not able to get access to internet using netbeans. When I am trying to update via Help > Check for Update I am getting
Check your network connection, verify that your proxy settings are configured correctly in the NetBeans IDE, or try again later.
When I am trying to access some url with a program in java I am getting error
connection refused: Address is invalid on local machine
whats going on here????
I need to force Java to use IPv4, to do so set it by command
setx _JAVA_OPTIONS -Djava.net.preferIPv4Stack=true
Are you behind a proxy server? Go to Tools > Options > General and try to change the network settings according to your network config.
EDIT: It may also be a firewall issue.
Are you using a proxy server, because if you are then you will need to use a ProxyAuthenticator java class which will can be called within your Java class. This should allow your class to access the Internet.
However, it may be worth checking your NetBeans Internet settings (Tools -> Options -> General) and checking whether a HTTP Proxy authentication is being used. Even so, a ProxyAuthenticator Java class may still be required (assuming a Proxy server is being used). Please see Authenticated HTTP proxy with Java

Categories