[ 
https://issues.apache.org/jira/browse/CASSANDRA-1832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969018#action_12969018
 ] 

Ran Tavory commented on CASSANDRA-1832:
---------------------------------------

I think there's a confusion. 
There are two ports in business, one is the JMX port (default is 8080) and one 
is the MX4J port (default 8081)
If the JMX port is used when cassandra starts you see the following exception, 
which is different from what's pasted in this bug report:

apache-cassandra-0.7.0-rc1 $ bin/cassandra -f 
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port 
already in use: 8080; nested exception is: 
        java.net.BindException: Address already in use

If mx4j's port, by default 8081, is used, then you see the report from above, 
which btw isn't fatal, the server operates correctly but without mx4j.

WARN 20:22:25,123 Could not start register mbean in JMX
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.cassandra.utils.Mx4jTool.maybeLoad(Mx4jTool.java:67)
        at 
org.apache.cassandra.service.AbstractCassandraDaemon.setup(AbstractCassandraDaemon.java:169)
        at 
org.apache.cassandra.thrift.CassandraDaemon.setup(CassandraDaemon.java:55)
        at 
org.apache.cassandra.service.AbstractCassandraDaemon.activate(AbstractCassandraDaemon.java:216)
        at 
org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:134)
Caused by: java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at 
mx4j.tools.adaptor.PlainAdaptorServerSocketFactory.createServerSocket(PlainAdaptorServerSocketFactory.java:24)
        at 
mx4j.tools.adaptor.http.HttpAdaptor.createServerSocket(HttpAdaptor.java:672)
        at mx4j.tools.adaptor.http.HttpAdaptor.start(HttpAdaptor.java:478)
        ... 9 more


So the problem in this case. I believe was that mx4j's port was bound to a 
different process.
To control the port used by mx4j use  -Dmx4jport=8082. See 
https://issues.apache.org/jira/browse/CASSANDRA-1068 for more details.

I think this is not a bug and recommend to close it as such.
I will, however, attach a patch for trunk to make this more obvious and add 
-Dmx4jport=8081 to conf/cassandra-env.sh

> mx4j does not load
> ------------------
>
>                 Key: CASSANDRA-1832
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1832
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 0.7.0 rc 1
>         Environment: CentOS 5.5
>            Reporter: Rustam Aliyev
>            Priority: Minor
>             Fix For: 0.7.0
>
>
> Adding mx4j-tools.jar (latest) to the library causes following exception:
> {code}
>  WARN 20:22:25,123 Could not start register mbean in JMX
> java.lang.reflect.InvocationTargetException
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at org.apache.cassandra.utils.Mx4jTool.maybeLoad(Mx4jTool.java:67)
>       at 
> org.apache.cassandra.service.AbstractCassandraDaemon.setup(AbstractCassandraDaemon.java:169)
>       at 
> org.apache.cassandra.thrift.CassandraDaemon.setup(CassandraDaemon.java:55)
>       at 
> org.apache.cassandra.service.AbstractCassandraDaemon.activate(AbstractCassandraDaemon.java:216)
>       at 
> org.apache.cassandra.thrift.CassandraDaemon.main(CassandraDaemon.java:134)
> Caused by: java.net.BindException: Address already in use
>       at java.net.PlainSocketImpl.socketBind(Native Method)
>       at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
>       at java.net.ServerSocket.bind(ServerSocket.java:319)
>       at java.net.ServerSocket.<init>(ServerSocket.java:185)
>       at 
> mx4j.tools.adaptor.PlainAdaptorServerSocketFactory.createServerSocket(PlainAdaptorServerSocketFactory.java:24)
>       at 
> mx4j.tools.adaptor.http.HttpAdaptor.createServerSocket(HttpAdaptor.java:672)
>       at mx4j.tools.adaptor.http.HttpAdaptor.start(HttpAdaptor.java:478)
>       ... 9 more
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to