I'm trying to scan the Files for viruses using Clam Antivirus which is installed on Ubuntu on different machine from java code which is again on different machine. Below is my java code lines
//connect to Linux server
ClamScan clamScan = new ClamScan("127.0.0.1", 3310, 20);
// Scanning the test file
ScanResult result = clamScan.scan(new FileInputStream("D:\\vcredist_x64.png"));
I have done the necessary changes in Clamd.conf files that is to add the Tcp Port and Address , but still getting below error description
ERROR com.philvarner.clamavj.ClamScan - could not connect to clamd
server java.net.ConnectException: Connection refused: connect
So any body can help me to find out what is going wrong either in code or configuration .
Thanks in Advance.
Ali
Finally found the solution , actually clam daemon was not up and running .
Related
I recently switched over from using a PC to a Mac and now for whatever reason one of my Impala drivers that worked fine is no longer found when run in Python. I keep receiving this error every time I run the script : "java.lang.RuntimeException: Class com.cloudera.impala.jdbc41.Driver not found". Please see code snippet for my connection below.
c = jaydebeapi.connect
(jclassname='com.cloudera.impala.jdbc41.Driver',
url='jdbc:impala://cloudera-impala-proxy.live.bi.xxx/;AuthMech=3;ssl=1;',
driver_args=['xxx', self.dwh_password], jars='/Users/xxx/Desktop/ImpalaJDBC41 2.jar')
Any help or suggestions are appreciated, I feel like I'm going crazy trying to get this to work.
Did you check do you have the ImpalaJDBC***.jar in your new machine.
Please check properly weather it's available at classpath/build path or not.
Edit:
You can use hive jdbc jar as well to connect with impala , just use the port of impala rather hive in jdbc url.
Looking at this error means your jar is corrupt.
First check your impalaJDBC jar
java -jar ImpalaJDBC<version>.jar
If it gives you error that means your jar is corrupt.
Download the correct jar from cloudera
I follow this steps to run the Metamap Java API 2014 on Linux platform
(Main page from metamap)
After start Metamap server, I run some main class in Metamap JavaAPI pakages, but it raises Error when querying Prolog Server: Connection refused
Then I check if the Metamap server is running on port 8066 by using the command:
sudo netstat -tulpn | grep 8066
but I receive nothing.
Did anyone had the same problem before and knows solution for this?
After running skrmedpostctl (and the optional word sense diambiguation server wsdserverctl), you need to run the mmserver executable in order to use the Java API for Metamap. This can be run by running the command
./bin/mmserver{two-digit-year}
Also, be sure to include the two jar files for metamap and prolog-beans in your classpath (in your IDE, this can be done by adding a dependency to these jars).
The issue may reside with the timeout: when the timeout parameter is not specified for the MetaMapImpl, it is set to 0, so the instance interprets any latency as failure and reports an error.
Increase the timeout to a reasonable value (for me 500 msec was enough).
I was getting this error after getting error SPIO_E_TOO_MANY_OPEN_FILES and losing the connection to the mmserver. I was tryig to construct instances of MetaMapApiImpl in a loop and calling processCitationsFromString for thousands of times. Therefore, I was getting error SPIO_E_TOO_MANY_OPEN_FILES after around a hundred repeats.
What I did to fix this error was to simply disconnect the api at the end of the loop, by calling the function disconnect().
I have PHP and the PHP/Java bridge set up on Windows and Tomcat 7.0. All is OK there.
However, I am trying to write a php file with java calls to connect to my Weblogic server installed on my Windows 7 machine to play around with adding/deleting users/groups etc.
This is what I followed: http://docs.oracle.com/cd/E13222_01/wls/docs90/jmx/accessWLS.html I also looked at this one http://weblogic-wonders.com/weblogic/2009/10/11/creating-users-in-weblogic-server-embedded-ldap-programatically/ (but for the second one I get an error on the java:comp/env/jmx/runtime line)
However, I cannot get my set up to recognize "t3" protocols to connect to my weblogic. the weird thing is I can connect via a t3 protocol using jython in a separate standalone script and to the console that way.
There is a section in first link above to make sure that wljmxclient.jar is added to the classpath. I set up a classpath to add that. I even use PHP to exec Weblogic's setWLSenv.cmd right before the connection to my Weblogic server is made to set my classpath . . . it shows the jar file in question being added. Still won't work. I then copied the jar file to the JavaBirde/WEB-INF/lib folder. Still wont' work.
I did try IIOP protocol but then I started down an new path of errors where "not bound in this context" was indicated. I tried switching between the 3 Mservers mentioned in the Oracle doc link above. No luck there either.
I see that others have run into this "t3 protocol not supported" message but I don't see any solutions.
Here is my code:
<?php
require_once("java/Java.inc");
$output=exec("C:\Oracle\Middleware\wlserver_12.1\server\bin\setWLSenv.cmd");
$protocol = "t3";
$hostname = "localhost";
$port="7001";
$jndiroot="/jndi/";
$mserver="weblogic.management.mbeanservers.domainruntime";
$united = $jndiroot.$mserver;
$serviceURL = new java("javax.management.remote.JMXServiceURL",$protocol, $hostname, $port,$united);
$h = new java("java.util.Hashtable");
$h->put("javax.naming.Context.SECURITY_PRINCIPAL", "myUID");
$h->put("javax.naming.Context.SECURITY_CREDENTIALS", "myPWD");
$h->put("javax.management.remote.JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES",
"weblogic.management.remote");
$connector = new java("javax.management.remote.JMXConnectorFactory");
$connector->connect($serviceURL,$h);
?>
This is how I FINALLY connected to my Weblogic:
1) I installed Tomcat 7.0 zip file instead of the installer and set it up manually. In my
setenv.bat file it looks like:
set CATALINA_HOME=C:\Program Files (x86)\Apache Software Foundation\apache-tomcat-7.0.34
set CATALINA_BASE=C:\Program Files (x86)\Apache Software Foundation\apache-tomcat-7.0.34
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_09
set JRE_HOME=C:\Program Files (x86)\Java\jdk1.7.0_09\jre
set JAVA_OPTS=-Djava.ext.dirs=C:\Oracle\Middleware\wlserver_12.1\server\lib
set CLASSPATH=.;C:\Oracle\Middleware\wlserver_12.1\server\lib\wljmxclient.jar
exit /b 0
2) I enabled IIOP protocol in weblogic through the weblogic console and added a userid/password which I used in num 3 for the userID/password
3) My php script on Tomcat 7 with the PHP/Java Bridge (not the JMXServerURL . . . nowhere did I find that you had to use "rmi" as the protocol")
$serviceURL = new java("javax.management.remote.JMXServiceURL","rmi","localhost","7001","/jndi/iiop://localhost:7001/weblogic.management.mbeanservers.edit");
//"service:jmx:iiop://localhost:7001/jndi/weblogic.management.mbeanservers.edit");
$env = new java("java.util.Hashtable");
$env->put("javax.management.remote.JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES","weblogic.management.remote");
$env->put("javax.naming.Context.SECURITY_PRINCIPAL", "myuserID");
$env->put("javax.naming.Context.SECURITY_CREDENTIALS", "mypassword");
$jmxCon = java("javax.management.remote.JMXConnectorFactory")->newJMXConnector($serviceURL, $env);
$jmxCon->connect();
$connection = $jmxCon->getMBeanServerConnection();
$mbeans = $connection->queryNames(null,null);
foreach($mbeans as $key=>$value) {
echo $key. "=". $value;
}
It connected and printed out all the mbeans for my admin server and my two managed servers that I created for testing.
I have a Java application, which uses Apache Derby. Using Eclipse Export option, I exported it as JAR file. When I am running Eclipse, and the server is connected to port 1527, the JAR executes correctly.
However when eclipse is closed, (and the server is not connected to 1527) on executing jar, i get this error
java.sql.SQLNonTransientConnectionException: java.net.ConnectException
: Error connecting to server localhost on port 1527 with message
Connection refused.
This is understandable. But i want to distribute the JAR. So is there a way to start the server programmatically, whenever JAR is executed?
You can start the NetworkServer programmatically:
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621)
serverControl.shutdown();
Simplest is to use embedded Derby
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
conn = DriverManager.getConnection("jdbc:derby:" + DATA_STORE + ";create=true");
You need to start the server programmatically.
How this is done is documented in the manual:
http://db.apache.org/derby/docs/10.8/adminguide/tadminconfig814963.html
This question already has answers here:
Eclipse Error: "Failed to connect to remote VM"
(26 answers)
Closed 9 years ago.
When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused.
What's the problem may be? I already tried with most of the solutions out in the web but none of that solved my issue. Could any one can assist me to fix this? Advance thanks..
when you have Failed to connect to remote VM Connection refused error, restart your eclipse
Which server are you using?
Like already said:
In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
You'll have to set the JVM property of the server to debug
For Glassfish:
Log in to admin-console > Configurations > server-config > JVM-Settings > check DEBUG checkbox > restart server
For Tomcat:
create file debug.bat/.sh (depending on your OS) in %TOMCAT_HOME%/bin directory and write
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start
in it.
After you've created this file start server by executing debug.bat/.sh.
Now you should be able to debug remotely in Eclipse after you set the necessary properties in your debug configuration.
Hope this helped! Have Fun!
EDIT
If you're running tomcat in a Win environment as a service you don't have a catalina.bat file in the bin-directory of your tomcat installation.
To set your server into debug-mode please try the following:
Run the Configuration option in Windows Menu or run %catalina_home%/bin/tomcat6w.exe
In Java tab, add this line to Java:
options:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Sometimes the port which you are trying to access, gets occupied and won't be released.
Try some tools to find whether the port is in use or not.
I also faced the same issue. I tried giving different port numbers but unfortunately it didn't work. I tried restarting the system (not the application server), and it worked :)
I faced the same issue. But i resolved it by changing my port numbers to different one.
The port number in the Eclipse configuration and the port number of
your application might not be the same.
You might not have been started your application with the right
parameters.
Those are the simple problems when I have faced "Connection refused" error.
As suat said, most of the time the connection refused is due to the fact that the port you set up is in use or there is a difference between the port number in your remote application debugging configuration in Eclipse and the port number used in the address attribute in
-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n.
Check those things. Thanks!
If you need to debug an application working on Tomcat, make sure that your Tomcat-folder/bin/startup.bat (if using windows) contains the following lines:
set JPDA_TRANSPORT="dt_socket"
set JPDA_ADDRESS=8000
call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
I ran into this problem debugging play framework version 2.x, turned out the server hadn't been started even though the play debug run command was issued. After a first request to the webserver which caused the play framework to really start the application at port 9000, I was able to connect properly to the debug port 9999 from eclipse.
[info] play - Application started (Dev)
The text above was shown in the console when the message above appeared, indicating why eclipse couldn't connect before first http request.