JMX doesn't work in Tomcat - java

I have the following configuration:
I deployed a sample SymmetricDS engine in Tomcat 8. It should have a JMX MBean I have to connect to. The configuration file symmetric-server.properties has the following values:
# Enable Java Management Extensions (JMX) web console.
#
jmx.http.enable=true
# Port number for Java Management Extensions (JMX) web console.
#
jmx.http.port=31417
# Enable Java Management Extensions (JMX) remote agent.
#
jmx.agent.enable=true
# Port number for the Java Management Extensions (JMX) remote agent.
#
jmx.agent.port=31418
And yet when I go to localhost:31417 I get 404 and when I launch the JConsole this application is nowhere to be found.
But when I start SymmetricDS with command bin\sym and it launches using the embedded jetty server, I can see the HTTP Adaptor on localhost:31417 and can connect via JConsole to the local application, yet I cannot connect remotely to localhost:31418:
I downloaded the sources of the SymmetricDS and in the file
symmetric-server\src\main\java\org\jumpmind\symmetric\SymmetricWebServer.java
there are only three configuguration taken from file symmetric-server.properties -- from default values it seems that they are jmx.http.port for HTTP Adaptor, https.port for HTTPS and http.port for SymmetricWebServer.
I also tried changing jmx.agent.enable to false and manually overriding java command line options in sym_service.conf by adding:
wrapper.java.additional.13=-Dcom.sun.management.jmxremote
wrapper.java.additional.14=-Dcom.sun.management.jmxremote.port=31417
wrapper.java.additional.15=-Dcom.sun.management.jmxremote.authenticate=false
wrapper.java.additional.16=-Dcom.sun.management.jmxremote.ssl=false
to no avail.
Could you please help me, what am I doing wrong?
Update
After greping sources I found SystemConstants.java, in which again there were ports for http, https and jmx.http, but none for remote agent

Related

Where to see console log in Openshift?

Recently, I've deployed my JSP project into Openshift server. Now my wish is to see the Console log.
Suppose, if I print System.out.println("Message"); into my JSP project, how do I see that message printed into Console log in Openshift server?
EDITED:
DL is deprecated, please use Fiddle
rajendra # http://code-programmersplace.rhcloud.com/
(uuid: 54d19a5be0b8cd9bf9000082)
-------------------------------------------------
Domain: programmersplace
Created: Feb 04 9:34 AM
Gears: 1 (defaults to small)
Git URL: ssh://54d19a5be0b8cd9bf9000082#code-programmersplace.rhcloud.com/~/gi
t/rajendra.git/
SSH: 54d19a5be0b8cd9bf9000082#code-programmersplace.rhcloud.com
Deployment: auto (on git push)
jbossews-2.0 (Tomcat 7 (JBoss EWS 2.0))
---------------------------------------
Gears: 1 small
You have access to 1 application.
C:\Users\rajendra>
The first thing you need is to connect via SSH to your application on OpenShift. If the name of your app is awesome, run the following command:
rhc ssh -a awesome
If you've forgotten the name of your application, execute rhc apps in order to see your current apps. See the lines with something similar to hereisthename # http://... or .../~/git/hereisthename.git/.
Once you're connected via SSH, you can see the log using the tail command:
Tomcat 7 (JBoss EWS 2.0)
tail -f -n 100 app-root/logs/jbossews.log
JBoss Application Server 7
tail -f -n 100 app-root/logs/jbossas.log
The OpenShift Client Tools are required. See Installing the OpenShift Client Tools. See also Getting Started with OpenShift Online.
RELATED: rhc ssh [No system SSH available] error

Moskito inspect monitoring tool integration with Java web application issue

I have an issue setting up an rmi port on Apache Tomcat server
(set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401)
Here are the steps i have done and getting the error respectively.
Issue with MoSKito tool while configuring RMI port on Tomcat
I am also tried to configure MoSkito inspect on my java web application. as part of it, i have been trying to make RMI port using "set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401" on catalina.bat. there is no error as such but 9401 is not getting connected.
Steps followed:
1) My OS is Windows 7
2) I have installed Apache Tomcat v7
3) I have downloaded Moskito inspect .war file from http://www.moskito.org/download.html and
4) Installed Moskito inspect on my tomcat server, the MoSKito inspect web UI is loading good.
5) I have created a sample java web application and deployed on same tomcat server. and web application also working good.
6) Now i have taken step to configure RMI port 9041 using below command on \bin\catalina.bat file(since i am on Windows OS).
I have put the below command on top of the file in \bin\catalina.bat
set JAVA_OPTS=%JAVA_OPTS% -DlocalRmiRegistryPort=9401
7) and started tomcat server, and then opened Moskito application on browser and gone to Quick Connect option on and given localhost and rmi port 9401 to call remote invocation.
Its failed.... its always giving error as MoSKito encountered an error:
Cannot connect to localhost#localhost:9401, due: Can not resolve manually set reference. Server at localhost, port: 9401 is down or not properly configured
[net.anotheria.moskito.webui.util.APILookupUtility.findRemote(APILookupUtility.java:168), net.anotheria.moskito.webui.util.APILookupUtility.findRemote(APILookupUtility.java:142), net.anotheria.moskito.webui.util.APILookupUtility.getAdditionalFunctionalityAPI(APILookupUtility.java:113),
Q1: How to set -DlocalRmiRegistryPort=9401 on tomcat on Windows OS.
Q2: Once we set port, how to ensure port is set properly and its up and ready state for connection.
Q3: Once port is set properly, then how to set / configure specified java web application needs to be configured for MoSKito, since we could have more than one java web application on same tomcat server.
Please guide me, thank you :)
in order to be able to connect to a MoSKito monitored application you have to enable an agent that binds itself to port 9401 and answers your replies. To do so, you have to add a dependency to your pom (if you are using maven):
<!-- Enabling MoSKito Inspect Embedded -->
<dependency>
<groupId>net.anotheria</groupId>
<artifactId>moskito-inspect-remote</artifactId>
<version>${moskito.version}</version>
</dependency>
Please keep in mind that the current MoSKito version is 2.5.4
If you are using a servlet 3.0 compatible container (tomcat 7, jboss wildfly) you are done. If you are using an older container you may need to add following to your web.xml:
<listener>
<listener-class>net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemoteListener</listener-class>
</listener>
If you are using no container at all, you can start it manually:
net.anotheria.moskito.webui.embedded.StartMoSKitoInspectBackendForRemote.startMoSKitoInspectBackend()
Now for you questions:
Q1: via catalina.bat. You were doing it correctly.
Q2: if the agent is configured everything will work correctly.
Q3: You may want to check out step by step guide here:
http://blog.anotheria.net/msk/the-complete-moskito-integration-guide-step-1/
Regards
Leon

GWT - Netbeans cant start dev mode

I have netbeans with the GWT4NB plugin installed. My code can compile and works with production mode. But when I try to launch the dev mode aka hosted mode in Netbeans the GWTShell window doesn't load. Getting this to work would be greatly useful for debugging. Here is my error in the console:
GWT4NB https://gwt4nb.dev.java.net
GWT installation directory: C:\Users\Guillaume\.netbeans\6.9\framework\gwt-2.1.0
init:
debug-connect-gwt-shell-hosted-15:
Unknown argument: -style
Google Web Toolkit 2.1.0
GWTShell [-noserver] [-port port-number | "auto"] [-whitelist whitelist-string] [-blacklist blacklist-string] [-logdir directory] [-logLevel level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort port-number | "auto"] [-out dir] [url]
where
-noserver Prevents the embedded web server from running
-port Specifies the TCP port for the embedded web server (defaults to 8888)
-whitelist Allows the user to browse URLs that match the specified regexes (comma or space separated)
-blacklist Prevents the user browsing URLs that match the specified regexes (comma or space separated)
-logdir Logs to a file in the given directory, as well as graphically
-logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
-gen Debugging: causes normally-transient generated types to be saved in the specified directory
-bindAddress Specifies the bind address for the code server and web server (defaults to 127.0.0.1)
-codeServerPort Specifies the TCP port for the code server (defaults to 9997)
-out The directory to write output files into (defaults to current)
and
url Automatically launches the specified URL
Java Result: -1
init:
The problem seems to be the unknown -style argument. I tried changing this argument in build-gwt.xml under the gwt 2.0 section, no changes. Why isnt gwt 2.1 not in the xml config file also?
I have the same issue and fix it manually on every restart by setting the gwt version as '2.0' even if I am actually on 2.2.
The problem is caused by the fact that the GWT4NB does not undertand the version of GWT you are using and so tries with GWT 1.5, that is pretty different from modern ones.

Glassfish Server Webservice behind Apache HTTP Server

Hi
We started to create our applications with J2EE. We now created a Webservice and deployed it to the Glassfish Server. We have written an apache proxy rule to access it via https://our.server.com/webservice-war (only https port is open to that server):
ProxyRequests Off
ProxyPass /webservice-war http://our.server.com:8080/webservice-war
ProxyPassReverse /webservice-war http://our.server.com:8080/webservice-war
Now everything works fine, but when we go to the to the ServiceEndpoint page (which is automatically generated) there is a link to the WSDL page:
http://our.server.com:8080/webservice-war/HostaliasSearchImplService?wsdl
which is obously wrong (Glassfish listens to port 8080). and also https is changed to http
Anyone an idea how I can fix it, that the automatically generated link is:
https://our.server.com/webservice-war/HostaliasSearchImplService?wsdl
BR, Rene
I discovered what I consider to be a very simple and elegant way to deal with the issue: use mod_substitute. Since those of us with this problem are already using Apache, and it's built in and simple, I liked this approach best.
I put a block similar to the below in one of my Apache conf files and found joy:
<Location />
AddOutputFilterByType SUBSTITUTE text/xml
Substitute "s|http://internal:8080/foo|https://external/foo|ni"
</Location>
Found the solution!
Anonym gave me a good hint about mod_jk. So here the complete configuration (for RHEL5).
First of all Download the mod_jk module for apache: http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.31/x86_64/
Put in in the modules directory /etc/httpd/modules and make it executeable:
chmod +x mod_jk-1.2.31-httpd-2.2.x.so
After that create /etc/httpd/conf/workers.properties:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
The Port 8009 is the where the Glassfish jk connector listens (we come to that later).
No we have to configure mod_jk, therefore create the file: /etc/httpd/conf.d/mod_jk.conf with the following content:
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.x.so
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel debug
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send everything for context /atsi-war to worker named worker1 (ajp13)
JkMount /yourapp-war/* worker1
(This means everything from your http://apache.webserver.com/yourapp-war/ will bi redirected to Glassfish yourapp-war application context)
Important, if you are using virtual hosts on apache, you have to set the option:
JkMountCopy On
for your virtual servers. Explication:
If this directive is set to "On" in
some virtual server, the mounts from
the global server will be copied to
this virtual server, more precisely
all mounts defined by JkMount or
JkUnMount.
Now we have to create the jk connecter in glassfish:
asadmin create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server jk-connector
asadmin set configs.config.server-config.network-config.network-listeners.network-listener.jk-connector.jk-enabled=true
Restart Glassfish, and everything sould work.
As for rewriting the https -> http, I'm not sure that's possible(yet) without using mod_jk, see here
, but see also this little guide
Though, generally, you'll need configure Glassfish and set http.proxyPort (and probably http.proxyHost too). Hopefully that should reflect in the autogenerated WSDL URL.
Here's 3 different ways to do this:
1
Use asadmin (in the Glassfish bin/ directory, run
asadmin create-jvm-options "-Dhttp.proxyPort=80"
asadmin create-jvm-options "-Dhttp.proxyHost=our.server.com"
2
Edit domain.xml and add under the <java-config> element
<jvm-options>-Dhttp.proxyPort=80</jvm-options>
<jvm-options>-Dhttp.proxyHost=our.server.com</jvm-options>
3.
Open the Glassfish admin web page, under Application Server -> VM Settings -> JVM Options and add these options
http.proxyPort=80
http.proxyHost=our.server.com
Setting
server-config.network-config.protocols.protocol.http-listener-1.http.server-name=MyHost:80
on GlassFish Server Open Source Edition 3.1.2.2 (build 5) solved problem to me.

Unable to deploy in Netbeans 6.7.1 and Glassfish v2.1.1

I am trying to deploy a simple WebService in Netbeans 6.7.1 and Glassfish v2.1.1 and am getting the following error. I am using GlassfishESBv2.2 and windows 7 machine. I have tried googling and implemented things as shown in
http://forums.netbeans.org/topic10055-0-asc-0.html . Still unable to deploy. Though the message says that application server is not started, from the Server tab , I am able to see a message which indicates Glassfish has started.Also , doing a netstat after trying to deploy returns this, which means that Glassfish is running.
C:>netstat -an | findstr "4848"
TCP 0.0.0.0:4848 0.0.0.0:0 LISTENING
I have been trying real hard to get this resolved. Any help is highly appreciated.
Error Message :
The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
- IDE timeout: refresh the server node to see if it's running now.
- Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
- Incorrect server configuration (domain.xml to be corrected manually)
- Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
- Invalid installation location.
C:\Users\xyz\Documents\NetBeansProjects\HWebService\nbproject\build-impl.xml:564: Deployment error:
The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
- IDE timeout: refresh the server node to see if it's running now.
- Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
- Incorrect server configuration (domain.xml to be corrected manually)
- Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
- Invalid installation location.
See the server log for details.
BUILD FAILED (total time: 29 seconds)
I've described the solution please visit here...
http://forums.netbeans.org/post-65058.html

Categories