JMX-Log4j Appender problem

Dear listers
we wrote thefollowing code to log the loglevel's dynamically.
Following is the code
public class MyApp implements MyAppMBean {     
private static Logger logger = Logger.getLogger(MyApp.class);
public void go() throws Exception{
while(true){
logger.debug("DEBUG") ;
logger.info("INFO") ;
logger.warn("WARN");
logger.error("ERROR");
logger.fatal("FATAL");
Thread.sleep(2000);
public void setLoggingLevel(String level){
logger.info("Setting logging level to: " + level);
Level newLevel = Level.toLevel(level, Level.INFO);
Logger.getRootLogger().setLevel(newLevel);
public String getLoggingLevel(){                       
return Logger.getRootLogger().getLevel().toString() ;
public static void main(String[] args) throws Exception
DOMConfigurator.configure("log4j.xml");
MyApp app = new MyApp();
//Lookup for the mbean server
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
//Create and register the top level log4j MBean
HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
ObjectName mbo = new ObjectName("log4j:logger=root");
System.out.println("Debug10");
server.registerMBean(hdm, mbo);
LoggerRepository r = LogManager.getLoggerRepository();
Enumeration<Logger> elogs = r.getCurrentLoggers();
Logger logger = null;
while(elogs.hasMoreElements())
//need to show the elements of teamcenter only.
logger = (Logger)elogs.nextElement();
hdm.addLoggerMBean(logger.getName());
} System.out.println(Logger.getRootLogger().getLevel().toString());
int portNumber=9999;
ObjectName htmlName = new ObjectName("log4j:logger=root,port=" + portNumber) ;
HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
html.setPort(portNumber);
server.registerMBean(html, htmlName);
html.start();
app.go();
When setting the attributes for the appenders under log4j from htmladapter it gives the following message.
*477 All Attributes Not Set*
*1/8 attribute(s) were not set:*
appender%3DTaskAppender%2Clayout%3Dorg.apache.log4j.PatternLayout
Please advice how can we solve this issue ~Vilas

Dear listers
we wrote thefollowing code to log the loglevel's dynamically.
Following is the code
public class MyApp implements MyAppMBean {     
private static Logger logger = Logger.getLogger(MyApp.class);
public void go() throws Exception{
while(true){
logger.debug("DEBUG") ;
logger.info("INFO") ;
logger.warn("WARN");
logger.error("ERROR");
logger.fatal("FATAL");
Thread.sleep(2000);
public void setLoggingLevel(String level){
logger.info("Setting logging level to: " + level);
Level newLevel = Level.toLevel(level, Level.INFO);
Logger.getRootLogger().setLevel(newLevel);
public String getLoggingLevel(){                       
return Logger.getRootLogger().getLevel().toString() ;
public static void main(String[] args) throws Exception
DOMConfigurator.configure("log4j.xml");
MyApp app = new MyApp();
//Lookup for the mbean server
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
//Create and register the top level log4j MBean
HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
ObjectName mbo = new ObjectName("log4j:logger=root");
System.out.println("Debug10");
server.registerMBean(hdm, mbo);
LoggerRepository r = LogManager.getLoggerRepository();
Enumeration<Logger> elogs = r.getCurrentLoggers();
Logger logger = null;
while(elogs.hasMoreElements())
//need to show the elements of teamcenter only.
logger = (Logger)elogs.nextElement();
hdm.addLoggerMBean(logger.getName());
} System.out.println(Logger.getRootLogger().getLevel().toString());
int portNumber=9999;
ObjectName htmlName = new ObjectName("log4j:logger=root,port=" + portNumber) ;
HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
html.setPort(portNumber);
server.registerMBean(html, htmlName);
html.start();
app.go();
When setting the attributes for the appenders under log4j from htmladapter it gives the following message.
*477 All Attributes Not Set*
*1/8 attribute(s) were not set:*
appender%3DTaskAppender%2Clayout%3Dorg.apache.log4j.PatternLayout
Please advice how can we solve this issue ~Vilas

Similar Messages

  • Log4j time problem in Solaris

    Hi,
    I have different behavior of log4j on windows and Solaris.
    I get wrong time entry in log file for march month in Solaris machine.
    i.e if the console displays date & time as Thu Mar 29 06:29:39 EDT 2007
    then i get [29 Mar 2007 05:29]
    but i gives me correct time for all other months & in windows.
    Why it occurs. please give me solution for this
    Thanks in advance

    hi, i meet another problem, my log4j cannot log into the log file, the properties code as following
    log4j.rootLogger=INFO, LOGFILE
    log4j.appender.LOGFILE=org.apache.log4j.FileAppender
    log4j.appender.LOGFILE.File=myApplication.log
    log4j.appender.LOGFILE.Append=false
    log4j.appender.LOGFILE.Threshold=DEBUG
    log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.LOGFILE.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss a}  (%c %M:Line %L)%n%p - %m%nmy code was work in windowXP with weblogic, but failed in Solaris with weblogic.
    Do you have any idea?

  • Reassign stderr/stdout to a Log4J appender.

    Does anyone know if there is a 'quick-and-dirty' way to reassign Java stderr and stdout to a Log4J Appender? Both Google and the log4j mailing lists are pretty sparse on this subject...

    This is the dirty way of doing it. If anyone knows
    the better way please mention it here.This is just putting a band-aid on a wound which will not be cured by a band-aid. It only masks the problem, and may introduce further problems (such as: What if you actually don't want to "log" certain things that were only intended for System.out?)
    The better way would be to re-design the code so that it logs messages to loggers rather than writing to System.out.
    I suspect the OP and you both know that, but just pointing it out in case.

  • [help~~~~]log4j dailyrollingfileappender problem

    I'm feeling very confused when I use log4j.I want to get log output everyday to files whose names are with time postfix.the java property file is in the below:
    log4j.logger.DEL=WARN,Dellog4j.appender.Del=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.Del.File=LOG/20
    log4j.appender.Del.DatePattern=yyMMdd-'deleteLog.txt'log4j.appender.Del.layout=org.apache.log4j.PatternLayout
    log4j.appender.Del.layout.ConversionPattern=%-d [%c]-[%p] %m %-d{yyyy-MM-dd HH:mm:ss}%n
    But I can't get what I want,instead I got error like this:
    log4j:ERROR Failed to rename [LOG/20] to [LOG/20.2006-03-28]
    when I run the project under Linux system,I can get the right result.But I really want to use it under Windows system.Could somebody do me a favor to help me??

    I don't use the slash second time,I just don't want to rewrite the same thing once more.I think the slash is ok,when I run it a folder would be create,therefore I followed you to delete that slash,but I still have that problem.If you don't want to help me,you can keep silent,why do you say those words??I saw one person asked about log4j,but it's of year2005,so I think maybe I can get help here,but you made me so upset.I think to a programmer,to be patient is very important,I am patient,but I can't keep patient for 3 days to solve only one problem with so many things left to do!

  • Log4j RollingFileAppender problem

    We are having problems using the RollingFileAppender in a Weblog 7 application.
    We are noticing that there are missing backups on our server. Here is the log4j
    configuration file:
    ===========================================
    #set the level of the root logger at debug and define the appender
    log4j.rootLogger=DEBUG, R
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=logs/WB.log
    #size the log file at 10MB
    log4j.appender.R.MaxFileSize=10MB
    # Keep ten backup files
    log4j.appender.R.MaxBackupIndex=10
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c -> %m%n
    #turn off logging for the apache classes
    log4j.logger.org.apache=OFF
    ==============================================
    One other thing we noticed was that Weblogic appears to open the base log file
    as soon as the server is started. It does not relinquish control of the file.
    Is this the case?
    The directory of our server looks like this today:
    WB.log
    WB.log.9
    WB.log.10
    Any help is appreciated.
    Thanks,
    Will

    I've got a question about log4j.
    I'm working with an application that generates a lot
    of logging. When I'm trying to figure out problems in
    the application it's hard to read the log files
    because they get updated/overwritten all the time.
    The mechanism of the RollingFileAppender of log4j is
    that when the maximum file size is reached a new log
    file is created with <filename>.1 and the name of
    every file that already existed is increased with 1.
    So when I try to read my logfiles they get
    overwritten while I'm reading it because the
    e application generates a new logfile sometimes 4
    times per minute. That's very annoying, so what I
    would like to have is that everytime a new logfile is
    created it's number is increased with 1 until a
    maximum of files and then start over.That's not Log4J's problem. That's your problem for treating log files like production data. Maybe you need to use something else, like writing this supposedly persistent data to a database.
    I've been trying to find this mechanism somewhere but
    can't find it. The DailyRollingFileAppender kinda
    does what I want but you can't set a maximum of files
    and I can't have that because of the space available
    on the server.What stops you from introducing another periodic process, to purge old log files? That's what most would do.

  • Log4j message Problem

    Problem description: my logger.info statements from my classes are logged in to the app.log file which is my application log file and also on my Websphere console (System out.log ) staements are displaying , actually my requirement is to see logger statements in my application log file i.e. (app.log file) but not in console. how to stop my logging statements to appear in console?
    Is thereanything i am missing here !!!
    I am loading log4j. properties using the following line in one of my classes ...
    PropertyConfigurator.configure(/usr/log/log4j.properties);
    Log4j.properties
    log4j.rootLogger=ERROR
    # Specify where to log by packages.
    log4j.logger.com.abc.example=INFO,dest1
    log4j.appender.dest1=org.apache.log4j.RollingFileAppender
    log4j.appender.dest1.File=app.log
    log4j.appender.dest1.MaxFileSize=10000KB
    log4j.appender.dest1.MaxBackupIndex=30
    log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
    #log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    #log4j.appender.stdout.Target=System.out
    #log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    #log4j.appender.sdtout.Threshold=ERROR
    Thanks in Advance,
    J.P.Sastry (SCJP,SCWCD,SCBCD)
    Edited by: PunnayyaSastryJandhyala on May 8, 2008 8:07 PM

    don't use System.out.println, it always prints at server console.
    in fact we implement LOG4J to avoid writing System.out.println statements, log all System.out.println statements with Logger.info.
    pvmk
    Edited by: pvmk on May 9, 2008 12:29 AM

  • RollingFileAppender/Log4J question (problem with reading logging)

    Hi everyone,
    I've got a question about log4j.
    I'm working with an application that generates a lot of logging. When I'm trying to figure out problems in the application it's hard to read the log files because they get updated/overwritten all the time.
    The mechanism of the RollingFileAppender of log4j is that when the maximum file size is reached a new log file is created with <filename>.1 and the name of every file that already existed is increased with 1.
    So when I try to read my logfiles they get overwritten while I'm reading it because the application generates a new logfile sometimes 4 times per minute. That's very annoying, so what I would like to have is that everytime a new logfile is created it's number is increased with 1 until a maximum of files and then start over.
    I've been trying to find this mechanism somewhere but can't find it. The DailyRollingFileAppender kinda does what I want but you can't set a maximum of files and I can't have that because of the space available on the server.
    Does anyone know how to solve this?

    I've got a question about log4j.
    I'm working with an application that generates a lot
    of logging. When I'm trying to figure out problems in
    the application it's hard to read the log files
    because they get updated/overwritten all the time.
    The mechanism of the RollingFileAppender of log4j is
    that when the maximum file size is reached a new log
    file is created with <filename>.1 and the name of
    every file that already existed is increased with 1.
    So when I try to read my logfiles they get
    overwritten while I'm reading it because the
    e application generates a new logfile sometimes 4
    times per minute. That's very annoying, so what I
    would like to have is that everytime a new logfile is
    created it's number is increased with 1 until a
    maximum of files and then start over.That's not Log4J's problem. That's your problem for treating log files like production data. Maybe you need to use something else, like writing this supposedly persistent data to a database.
    I've been trying to find this mechanism somewhere but
    can't find it. The DailyRollingFileAppender kinda
    does what I want but you can't set a maximum of files
    and I can't have that because of the space available
    on the server.What stops you from introducing another periodic process, to purge old log files? That's what most would do.

  • Log4j jdbcAppender problem

    Hi,
    I'm having trouble configuring jdbcAppender for log4j.
    I have successfully configured it by specifying a SQL statement in the properties file:
    log4j.appender.JDBC2.sql=INSERT INTO TEST (TIMESTAMP, CATEGORY, ERROR_MSG) VALUES (sysdate, @CAT@, @MSG@)
    The trouble with this is that I have to truncate the MSG to the ERROR_MSG field size. I do not want to use a JDBCSQLHandler class as this would mean that I will have to change the class every time the table and column names change.
    Instead, I tried the alternate configuration method:
    log4j.appender.JDBC2.table=test
    log4j.appender.JDBC2.column=id~EMPTY
    log4j.appender.JDBC2.column=timestamp~TIMESTAMP
    log4j.appender.JDBC2.column=category~CAT
    log4j.appender.JDBC2.column=error_msg~MSG
    I will add a JDBCColumnHandler class that will do the truncating.
    But this configuration is not working for me. I get the following error msg:
    "log4j:ERROR Not ready to append ! Column ID is not nullable, and must be specified by setLogType() !"
    The ID Column has a trigger associated with it that automatically populates it. I have come to the conclusion that only the last column definition is being configured. If I move the column=id~EMPTY to be the last column defined in the properties file, I no longer get that error msg. But no records are created, possibly because the only column defined was ID and it was configured as EMPTY and hence was ignored.
    It works if I use the same configuration style in an xml file:
              <param name="table" value="test" />
              <param name="column" value="id~EMPTY" />
              <param name="column" value="timestamp~TIMESTAMP" />
              <param name="column" value="category~CAT" />
              <param name="column" value="error_msg~MSG" />
    I would appreciate any help you could provide.
    Cheers,
    Nim

    To all the JAVA GURUS,
    I need to have an audit feature in my application which keeps a track(history) of changes made at any instance.
    To be very precise say i have some values say 8, 5, 10, 12... if i modify any one of these value the utility should be able to trace out the changes made and other information like logger's id timestamp etc etc.... but only when the value is actually changed in a sense, suppose the value is 8 and was erased and again set to 8 then it is not considered a change...
    I want to have a solution using log4j which can record these changes in Oracle database... along with additional infornmation related to the change(may be the reason for the change).
    Thanks!!!
    [email protected]

  • Log4j, appender and InstantiationException

    Hi,
    I have written my own appender in an Eclipse project that uses log4j. When I try to use the appender I get the following exception:
    log4j:ERROR Could not instantiate class [test.appender.NewFileAppender].
    java.lang.InstantiationException: test.appender.NewFileAppender
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:329)
         at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:120)
         at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:629)
         at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
         at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:533)
         at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:417)
         at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:316)
         at org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:682)
         at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
         at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:57)
         at org.apache.log4j.PropertyWatchdog.<init>(PropertyConfigurator.java:674)
         at org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:382)
         at se.micronic.argos.main.Main.initLogging(Main.java:305)
         at se.micronic.argos.main.Main.<init>(Main.java:272)
         at se.micronic.argos.main.Main.main(Main.java:1339)
    log4j:ERROR Could not instantiate appender named "argos".My property file looks like this:
    log4j.appender.argos=test.appender.NewFileAppender
    log4j.appender.argos.file=logs/MArgos.logThe other appenders in the property file work fine.
    Any ideas?
    Thanks
    Markus

    could be you don't have a no-args constructor? show us the NewFileAppender class
    is that the entire stack trace? there's no other underlying exception being thrown?

  • Log4j appender question

    I need some log4j help. Hope anyone can help me.
    Question 1:
    I need to log information to 4 different files. As far as I can tell from the log4j docs, I will then need to create 4 different appenders in the log4j.properties file. How can I do that?
    Looking at examples, it looks like I will need to add 4 new sections similar to this one. Is that correct?
    # Logfile 1
    log4j.appender.log1=org.apache.log4j.RollingFileAppender
    log4j.appender.log1.File=C:/Sun/logs/logme1.log
    Question 2:
    After that is done, how can I actually write to the files? When logging I was thinking just using: logger.info("log something").
    How can I specify which file that will log to? Is that even the correct way to log?
    Hope someone can help!

    After that is done, how can I actually write to the files? When logging I
    was thinking just using: logger.info("log something").
    How can I specify which file that will log to? Is that even the correct
    way to log?apperantly, it doesn't seem like you have understand how log4j works. that's probably why warnerja tell you to perform some search.
    understand the technology first..then ask specific question here.
    it will be useless just handling out answers to everyone. i think they're here just not to provides answers, but to educate other along the way...but they need to see an effort was made first.
    you're right..there are time when one doesn't have enough time to understand the whole technology..or the technology is too difficult to comprehend..or the documentation is poor., but i think there are plenty of good documentation on log4j. Futhermore..what you are asking is not usually shown in the documentation, but a google search would probably provides you with the answer you seek..you just need to find a good keyword.
    Futhermore, I suggest you read some tutorial on log4j if you plan to use the technology..it will not takes all day..maybe an hour or so..just to get how the technology works
    anyway,
    your appender tell the logger where the log the message to (depends on the level you specified) .. so if you have 3 appender that specified
    the level to be INFO, and you have logger.info("This is an INFO message"), then the message will be log to all three files.
    log4j.threshold=ALL
    log4j.rootLogger=ALL, stdout, DebugAppender, InfoAppender,
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%n
    log4j.logger.DebugAppender.access=DEBUG
    log4j.appender.DebugAppender=org.apache.log4j.RollingFileAppender
    log4j.appender.DebugAppender.File=.${file.separator}log${file.separator}ex_debug.log
    log4j.appender.DebugAppender.MaxFileSize=10KB
    log4j.appender.DebugAppender.MaxBackupIndex=1
    log4j.appender.DebugAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.DebugAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p --
    %m%n
    log4j.logger.InfoAppender.access=INFO
    log4j.appender.InfoAppender=org.apache.log4j.RollingFileAppender
    log4j.appender.InfoAppender.File=.${file.separator}log${file.separator}ex_info.log
    log4j.appender.InfoAppender.MaxFileSize=10MB
    log4j.appender.InfoAppender.MaxBackupIndex=2
    log4j.appender.InfoAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.InfoAppender.layout.ConversionPattern=%c %d{ISO8601} -- %p -- %m%nthe
    log4j.rootLogger=
    tell what appender to use...so include all your appender in this property.
    you appender specified the logging level INFO, WARN, DEBUG,
    ERROR, or FATAL. I'm not sure how to specified the min and max level
    for an appender using a property file..for xml configuartion file..look at
    the example provide in previous reply.
    now if you do :
    logger.info("This is an info message") and want it to log to file1 and file2
    and log.info("This is another info message") and you want this to log to file3
    you can't do that...a way around this is to create your own level..and the
    appender will specifies that level.
    if you plan to use an XML configuration file, then make sure you include the <root> node
    <root>
       <priority value="debug"/>
       <appender-ref ref="DEBUG"/> 
       <appender-ref ref="INFO"/>
       <appender-ref ref="MY_APPENDER_NAME"/>
    </root>
    </log4j:Configuration>

  • LOG4J Appender  to Webservices

    Hello,
    I have a question.
    Is there an LOG4J Appender to Webservices?
    I founded a lot of kinds of appenders on www.apache.org, but nothing about webservices.
    Thanks for any help!!

    Thanks. I'm using a startup class. I could easily check if log4j is in the server classpath, and attach my appender. However, if log4j is not in server classpath, and in the application classpath, I need to check for this. I was using ApplicationContainerFactory in weblogic 8 like so:
    appContainerFactory.getApplicationContainer(applicationName).getApplicationClassLoader()
    which is not available in weblogic 9. And I can't find in the docs anywhere to indicate it's replacement, or any type of alternative.

  • JTextArea append problem

    I have the following problem:
    I am creating a JFrame with a JTextArea in it.
    After all components are added to the JFrame
    I call:
    setLocation(100, 100);
    pack();
    setVisible(true);
    Then a method is called that generates files and uses
    jTextArea.append(".");
    to add a "." to the JTextArea for each created file
    to show the progress.
    Now the problem is that the dots are not shown one after the other.
    The window pops up AFTER all the dots are written and not when
    setVisible(true);
    is called.
    What do I have to do that every single dot is shown in the
    JTextArea right after it is appended ?

    Move your actual file generating process to a different thread. The best way to do it is using SwingWorker. There is a tutorial on the Sun's web site at http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html that demonstrates how to use SwingWorker.
    Hope this helps
    Sai Pullabhotla

  • Record appending problem in the flat file

    Hi everybody,
    I am using this code I have to append records one by one(in next line) in a text file, But the records are getting appended side by side how to solve this problem.
    code is like this
    <%
    String varValue="042204ccc";
    String loginID="xxxx";
    String str= varValue+"="+loginID;
    FileWriter fw = new FileWriter(new File("details.txt"),true);
    fw.write(str);
    fw.close();
    %>
    thanks in advance.

    Better yet, append System.getProperty("line.separator"). That's platform independent.
    MOD

  • Regsitering log4j appender to a logger in a class in a web app

    During weblogic 9.2 server startup I would like to register a Handler with any number of log4j Loggers in all deployed web apps. I was thinking I could somehow get a reference to the applications classloader, and see if it has log4j, then register with the root logger. I used to do this in WLS 8, using ApplicationContainerFactory, but this is no longer available in WLS 9. Is there another way to do this in WLS 9? Thank for any help.

    Thanks. I'm using a startup class. I could easily check if log4j is in the server classpath, and attach my appender. However, if log4j is not in server classpath, and in the application classpath, I need to check for this. I was using ApplicationContainerFactory in weblogic 8 like so:
    appContainerFactory.getApplicationContainer(applicationName).getApplicationClassLoader()
    which is not available in weblogic 9. And I can't find in the docs anywhere to indicate it's replacement, or any type of alternative.

  • JMX over t3 problem (WLS 10.0)

    Has anyone attempted to retrieve JMX data from a WebLogic 10 instance and succeeded? I am attempting to connect to a out-of-the-box installation of Weblogic Server. I am using the sample code at http://e-docs.bea.com/wls/docs100/jmx/accessWLS.html#wp1112969, yet whenever I connect I get the exception pasted below. Nothing shows up in the servers logs, but I have verified with TCPdump that the connection is occurring.
    If I connect via iiop instead of t3 and set a default name/password on the iiop config page, it works. Doing so is rather insecure so I'd like to avoid that.
    The exception is:
    Exception in thread "main" java.io.IOException
    at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:156)
    at weblogic.management.remote.common.ClientProviderBase.newJMXConnector(ClientProviderBase.java:79)
    at javax.management.remote.JMXConnectorFactory.newJMXConnector(JMXConnectorFactory.java:326)
    at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:247)
    at MyConnection.initConnection(MyConnection.java:55)
    at MyConnection.main(MyConnection.java:123)
    Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
            java.io.EOFException]
    at weblogic.jrmp.Context.lookup(Context.java:189)
    at weblogic.jrmp.Context.lookup(Context.java:195)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at weblogic.management.remote.common.ClientProviderBase.makeConnection(ClientProviderBase.java:144)
    ... 5 more
    Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
    java.io.EOFException
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:273)
    at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
    at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:306)
    at weblogic.jrmp.BaseRemoteRef.invoke(BaseRemoteRef.java:221)
    at weblogic.jrmp.RegistryImpl_Stub.lookup(Unknown Source)
    at weblogic.jrmp.Context.lookup(Context.java:185)
    ... 8 more
    Caused by: java.io.EOFException
    at java.io.DataInputStream.readByte(DataInputStream.java:243)
    at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:215)
    ... 13 more

    It turned out my problem was my classpath. I pared it down to just wlclient.jar and wljxmclient.jar and that did it.

Maybe you are looking for