Help coderanch get a
new server
by contributing to the fundraiser

michael modenese

Greenhorn
+ Follow
since Mar 22, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by michael modenese

Thank you very much for your reply !!

It works exactly the way I needed to have it ! Since you mentioned the Firewall-Issue:

As said, to preset the "ServicePort" for ActiveMQ:

<managementContext>
<managementContext createConnector="true" connectorPort="10120" rmiServerPort="10135" jmxDomainName="my-broker" connectorPath="/jmxrmiaq" />
</managementContext>

Where 10120 is the Registry port and 10135 the ServicePort where the socketcommunication happens.


To do the same in Java-Code, the url-String for the JMXServiceURL needs to be something rather cryptic:

String url = "service:jmx:rmi://localhost:10136/jndi/rmi://localhost:10120/jmxapp1";
// original String without fixed ServicePort: String url = "service:jmx:rmi:///jndi/rmi://localhost:10120/jmxapp1";
JMXServiceURL serviceURL = new JMXServiceURL(url);
JMXConnectorServer server = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbs);
System.out.println("\nStarting monitored app @ " + url);
server.start();


Michael







12 years ago
Hello
I am trying to manage multiple Java processes on serverside with JMX. I have AcitveMQ setup and I can specify in the activemq.xml config file:
....
<managementContext>
<managementContext connectorPort="10120" rmiServerPort="10135" jmxDomainName="my-broker" connectorPath="/jmxrmione" />
</managementContext>
....
so the registry ist startet at port 10120 and the serviceport is 10135. the "stub" ist exportet with the name jmxrmione. I can connect tot it with JConsole using:

service:jmx:rmi:///jndi/rmi://SERVERNAME:10120/jmxrmione

Now I have a Java-Serverprocess and i really like to have it also manageable on Port 10120. So i could connect to it with the JConsole using the fill connection:

service:jmx:rmi:///jndi/rmi://SERVERNAME:10120/jmxrmitwo

Now the questions are:

How can I specify the Name of the "Stub" for a Java-Process ? Default seems always to be rmijmx.
How can I set the ServicePort for JMX for that Java-Process ? The Registryport can be set with the property com.sun.management.jmxremote=xxxx.

I could live with if I have to use a different registry for every JVM just for the sake of JMX, (although it seems very strange since I would use different names for the exportet stub) but the arbirtary Port is really a pain.

Thank you for kind reply

Michael Modenese





12 years ago
Hello Chinna

thank you for your reply.
I've tried your suggestions. Unfortunately with no success. Still got the
java.rmi.ConnectIOException: non-JRMP server at remote endpoint

May i point out that the same code, but WITHOUT SSL-Factories ist working fine (even with "rmi://"):

int PORT_BARE = 2029;
Registry registry = LocateRegistry.createRegistry(PORT_BARE);
HelloImpl objBARE = new HelloImpl(PORT_BARE);
// works fine:
Naming.rebind("rmi://localhost:" + PORT_BARE + "/" + "HelloServer", objBARE);
// registry.rebind("HelloServer", objBARE);

So i recon the point must be somehow in the SSLSocketFactories. But i cant figure out what the type of the SocketFactories has to do with the binding mechanism.

Any idea ?

Thanks

Michael



14 years ago
Hello
i am trying this code:

int PORT_SSL = 2019;
Registry registrySSL = LocateRegistry.createRegistry(PORT_SSL, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory());
HelloImpl objSSL = new HelloImpl(PORT_SSL, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory());
// not null :
Registry temp = LocateRegistry.getRegistry(PORT_SSL);
// does not work: ???
Naming.rebind("rmi://localhost:" + PORT_SSL + "/" + "HelloServer", objSSL);
// does work !!!
registrySSL.rebind("HelloServer", objSSL);

and get the Exception:
java.rmi.ConnectIOException: non-JRMP server at remote endpoint
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:230)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at ServerStarter.main(ServerStarter.java:37)

but isn't Naming.rebind() supposet to just delegate the call to Registry.rebind() ?
What am i missing ? What is the deal with SSLSocketFactories ?

Help appreciated

Michael





14 years ago
Hello,
i have a swing-client that should be deployed using webstart both via webserver and filesystem.
when i put the jnlp file and the jars on a windows-server the application starts fine but i cant change it on the windows-server because it is locked which makes it pretty much usless in a CLient-Server context where there are usually updates concerning the client.
Now my question is: is it a generel problem ? is it because of the windows filesystem and is there a way around it ? or do i really need a webserver to make things work ?
also with the new 1.6.0_18 the "offline" problem should have been fixed. I did try, but nope. Starting from the flisystem my application refused to start offline if the original downloadlocation was not available. anyone else having the same problem ?

thank you for replies

miike
14 years ago
hello,

i thought it is a bit complicated. but:
i got the uri/url of my images directory:

jar:file:/d:/jars_unsigned/software.jar!/images

how exactly do i make a file object to be used via webstart ?

with new file(uri) not possible.

thank you for your reply

michael



15 years ago
Hello,
i am trying to load ALL icons i have in my jar file.
i start with:
.....
Class clazz = Class.forName("com.xxx.IconSelectionDialog");
String me = clazz.getName().replace(".", "/") + ".class";
dirURL = clazz.getClassLoader().getResource(me);
if (dirURL.getProtocol().equals("jar")) {
String jarPath = dirURL.getPath().substring(6, dirURL.getPath().indexOf("!")); //strip out only the JAR file

JarFile jar = new JarFile(jarPath );

Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
while (entries.hasMoreElements()) {
JarEntry nextEntry = entries.nextElement();
String jarEntryName = nextEntry.getName();
.......
.......
}

this works fine while im am debugging from a local jws installation but fails when i start the software with realwebstart from a link.
the error seems to be that the JarFile jar cannot be found even though it has the proper jarPath. can anyone help ?
is there another way to load resources from a jar 8not single named resources, but kind of all *.jpg or similar)

thank you

michael








15 years ago
Hello
I am doing a RMI Application where the server is behind a firewall. some clients are inside the firewall and some are outside. in order zu get the clients to work though the firewall my networkadministrator can open the ports i need. my problem is that i have to start the java application on serverside with the option "java -Djava.rmi.server.hostname=....." now the clients inside the firewall do not run anymore, but those outside the firewall run fine. any idea how i can fix this problem

thanks for help
17 years ago
Hi there,
i have a question concerning the jdk version i used to compile and jar my project. is there a way to find out from the jar file with what version the project has been compiled ? the "Created-By:" (example : Created-By: 1.5.0_09-b01 (Sun Microsystems Inc.)) from the manifest file in my jar is the version of my jar tool.

thanks, mike
17 years ago
hi there,
i have 2 java applications and one needs to check if the other is still running by setting a variable and wait, so in the meantime the other application can change the value of the same variable, so to prove that it is still running. each application has a thread doing this checking.
any idea what mechanism i can use for storing this variable ? is there something like a env.variable i can use ? ore properties stored outside the java applications ? i would prefer not to use a file....

thx
18 years ago
...ok single sign on is what i thouth first., but i need to check whether an other java application is running or crashed.... something like a taskmanager monitor....
18 years ago
hi there. i have the following problem: i need my java application to check whether an other java application is allready running on my machine or not (...and then do a kind of autologin) is this possible ? on windows ? do i need some special dll's ?

thx
18 years ago