CODE running in MAIN but not in a model class called by servlet

Here is my simple code to connect Weblogic server 10.3.3 using iiop protocol to use the MBeanServer. It is running perfectly when it is run as a simple java application in main() but when I try to call this code from a servlet placing it in a simple method to get an arraylist it is throwing Exception.
* I have an Admin Server and a Managed server in 10.0.32.145
* and another Managed Server on 10.0.32.146. I need to monitor these servers in a portal.
* I have a jsp which refreshes in every 10 seconds and invoke a servlet,that calls this
* method to populate data in three beans(AdminServerBean,ManSer1Bean,ManSer2Bean),add these
* beans into arraylist and return to the servlet.The servlet adds these attributes to the
* request scope and send back to jsp.
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXServiceURL;
import javax.management.remote.JMXConnectorFactory;
import com.beans.*; //My Beans package
import java.util.ArrayList;
import java.util.Hashtable;
public class JMXCore {
     @SuppressWarnings("unchecked")
     public ArrayList<Object> connect2FetchData() throws Exception {
     ArrayList<Object> arr = new ArrayList<Object>();
JMXConnector jmxCon1 = null;
JMXConnector jmxCon2 = null;
JMXConnector jmxCon3 = null;
ObjectName on1 = new ObjectName("com.bea:ServerRuntime=AdminServer,Name=AdminServer,Type=JVMRuntime"); // Admin Server
ObjectName on2 = new ObjectName("com.bea:ServerRuntime=ManSer1,Name=ManSer1,Type=JVMRuntime"); // Managed Server 1
ObjectName on3 = new ObjectName("com.bea:ServerRuntime=ManSer2,Name=ManSer2,Type=JVMRuntime"); // Managed Server 2
try {
JMXServiceURL serviceUr1 = new JMXServiceURL("service:jmx:iiop://10.0.32.145:7001/jndi/weblogic.management.mbeanservers.runtime");
JMXServiceURL serviceUr2 = new JMXServiceURL("service:jmx:iiop://10.0.32.145:9001/jndi/weblogic.management.mbeanservers.runtime");
JMXServiceURL serviceUr3 = new JMXServiceURL("service:jmx:iiop://10.0.32.146:9001/jndi/weblogic.management.mbeanservers.runtime");
System.out.println("Connecting to: " + serviceUr1);
System.out.println("Connecting to: " + serviceUr2);
System.out.println("Connecting to: " + serviceUr3);
Hashtable env = new Hashtable();
env.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES,"weblogic.management.remote");
env.put(javax.naming.Context.SECURITY_PRINCIPAL, "contact");
env.put(javax.naming.Context.SECURITY_CREDENTIALS, "contact158");
jmxCon1 = JMXConnectorFactory.newJMXConnector(serviceUr1, env);
jmxCon2 = JMXConnectorFactory.newJMXConnector(serviceUr2, env);
jmxCon3 = JMXConnectorFactory.newJMXConnector(serviceUr3, env);
jmxCon1.connect();
System.out.println("Hello");
MBeanServerConnection con1 = jmxCon1.getMBeanServerConnection(); // MBean Server Connection No 1
System.out.println("CONNECTION TO WEBLOGIC 10.3 ESTABLISHED VIA jmxCon1");
Integer jvm_AdminServ = (Integer)con1.getAttribute(on1,"HeapFreePercent");
String status_AdminServ = null;
if(jvm_AdminServ<10){status_AdminServ = "red";} else {status_AdminServ = "lime";}
AdminServerBean asb = new AdminServerBean(String.valueOf(con1.getAttribute(on1,"Uptime")),String.valueOf(jvm_AdminServ),(String)con1.getAttribute(on1,"JavaVersion"),(String)con1.getAttribute(on1,"OSVersion"),String.valueOf(con1.getAttribute(on1,"HeapFreeCurrent")),String.valueOf(con1.getAttribute(on1,"HeapSizeMax")),String.valueOf(con1.getAttribute(on1,"HeapSizeCurrent")),(String)con1.getAttribute(on1,"OSName"),status_AdminServ);
arr.add(asb);
jmxCon2.connect();
MBeanServerConnection con2 = jmxCon2.getMBeanServerConnection(); // MBean Server Connection No 2
System.out.println("CONNECTION TO WEBLOGIC 10.3 ESTABLISHED VIA jmxCon2");
Integer jvm_ManServ1 = (Integer)con2.getAttribute(on2,"HeapFreePercent");
String status_ManServ1 = null;
if(jvm_ManServ1<10){status_ManServ1 = "red";} else {status_ManServ1 = "lime";}
ManSer1Bean msb1 = new ManSer1Bean(String.valueOf(con2.getAttribute(on2,"Uptime")),String.valueOf(jvm_ManServ1),(String)con2.getAttribute(on2,"JavaVersion"),(String)con2.getAttribute(on2,"OSVersion"),String.valueOf(con2.getAttribute(on2,"HeapFreeCurrent")),String.valueOf(con2.getAttribute(on2,"HeapSizeMax")),String.valueOf(con2.getAttribute(on2,"HeapSizeCurrent")),(String)con2.getAttribute(on2,"OSName"),status_ManServ1);
System.out.println("Manserver1 Heap Free : "+String.valueOf(jvm_ManServ1));
arr.add(msb1);
jmxCon3.connect();
MBeanServerConnection con3 = jmxCon3.getMBeanServerConnection(); // MBean Server Connection No 3
System.out.println("CONNECTION TO WEBLOGIC 10.3 ESTABLISHED VIA jmxCon3");
Integer jvm_ManServ2 = (Integer)con3.getAttribute(on3,"HeapFreePercent");
String status_ManServ2 = null;
if(jvm_ManServ2<10){status_ManServ2 = "red";} else {status_ManServ2 = "lime";}
ManSer1Bean msb2 = new ManSer1Bean(String.valueOf(con3.getAttribute(on3,"Uptime")),String.valueOf(jvm_ManServ2),(String)con3.getAttribute(on3,"JavaVersion"),(String)con3.getAttribute(on3,"OSVersion"),String.valueOf(con3.getAttribute(on3,"HeapFreeCurrent")),String.valueOf(con3.getAttribute(on3,"HeapSizeMax")),String.valueOf(con3.getAttribute(on3,"HeapSizeCurrent")),(String)con3.getAttribute(on3,"OSName"),status_ManServ2);
arr.add(msb2);
System.out.println("MBean SERVER CONNECTION OBTAINED...ArrayList Created");
     return arr;
catch(Exception e){
     System.out.println("in Catch");
     System.out.println(e.getMessage());
     e.printStackTrace();
     return null;
     finally {
          jmxCon1.close();
          jmxCon2.close();
     jmxCon3.close();
     System.out.println("CONNECTION CLOSED");
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is the original stacktrace:
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: Name weblogic.management.mbeanservers.runtime is not bound in this Context
     at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
     at javax.management.remote.rmi.RMIConnector.connect(Unknown Source)
     at com.tcs.sbi.psg.monitoring.models.JMXCore.connect2FetchData(JMXCore.java:57)
     at com.tcs.sbi.psg.monitoring.servlets.Weblogic_10_Connect.doGet(Weblogic_10_Connect.java:23)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
     at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
     at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
     at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
     at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.NameNotFoundException: Name weblogic.management.mbeanservers.runtime is not bound in this Context
     at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
     at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
     at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
     at javax.naming.InitialContext.lookup(Unknown Source)
     at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(Unknown Source)
     at javax.management.remote.rmi.RMIConnector.findRMIServer(Unknown Source)
     ... 20 more
getMessage() returns this:
Failed to retrieve RMIServer stub: javax.naming.NameNotFoundException: Name weblogic.management.mbeanservers.runtime is not bound in this Context
-------------------------------------------------------------------------------------

Similar Messages

  • My codes run in windows but not in Linux what is wrong?

    //I have 4 codes in total but heres is one for example
    import java.util.*;
    // This state accepts numeric input less than 100 and subtracts
    // 1 from each input number before exiting the state.
    // We exit the state if the input is exactly 100.
    public class AState extends State {
    public AState (String n, boolean d ) {
    super(n,d);
    public void RUN () {
    int ch = 0;
    entry();
    Scanner stdin = new Scanner(System.in);
    ch = stdin.nextInt();
    while ( ch != 100 ) {
    ch--;
    System.out.print(" " + ch);
    ch = stdin.nextInt();
    // change state from AState to BState
    Controller.state = Controller.states[Controller.BSTATE];
    // this will be the AState version of exit().
    exit();
    //It runs perfectly in windows but once I compile in a terminal of Linux it doesn't run it show like 8 errors, why is that, can somebody tell me what can I do about it

    public class AState extends State {
    ^
    Astate.java:18: cannot find symbol
    symbol : method entry()
    location: class AState
    entry();
    ^
    ./Controller.java:8: class BState is public, should be declared in a file named BState.java
    public class BState extends State {
    ^
    ./Controller.java:8: cannot find symbol
    symbol: class State
    public class BState extends State {
    ^
    Astate.java:31: cannot access Controller
    bad class file: ./Controller.java
    file does not contain class Controller
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    Controller.state = Controller.states[Controller.BSTATE];
    ^
    6 errors
    //As i said before, this run perfently through windows the same exactly code.

  • HT4628 Why does internet connection on my Time Capsule cut out (on main but not guest network)?

    Hi - I just got a time capsule 802.11n to use with my Macbook (OSX 10.6.8).
    My wireless connectivity on my main (but not guest) network cuts out EVERY FRICKEN DAY multiple times.  The internet phone connection + guest network still work, so the internet connection is there -- something with the main network is going wrong.
    When I reset the time capsule (remove plug and plug back in), it works fine again.
    Can anyone recommend a solution so this connectivity problem stops?  Never had any issues with my Netgear wireless router, so at the moment, I'm really disappointed in this Apple product.  Hopefully there is a setting I can switch to fix this (or something else simple one of you smart people out there can recommend)
    Thanks,
    JLG

    In any event, if your OS X version is 10.7.x, download and install AirPort Utility 5.6 for Lion:
    Lion: AirPort Utility 5.6.
    If your OS X version is 10.5.x or 10.6.x, download and install AirPort Utility 5.5.3:
    Leopard, Snow Leopard: AirPort Utility 5.5.3.
    After you install the appropriate version of AirPort Utility, open it. The program will be located in your Utilities folder, which in turn is found in your Applications folder.
    To open the Utilities folder, go to the Finder and select "Utilities" from the Go menu:
    AirPort Utility 5.6 looks like this:
    ... but make sure you use the version of AirPort Utility you just downloaded.
    Launch AirPort Utility and select your Time Capsule. Click Manual Setup, then the Guest Menu tab, then you can elect to disable the guest network, or to establish whatever security settings you want.
    The window looks somewhat like this:
    If your version of AirPort Utility does not look anything like that, you are probably not using the one you just downloaded. Find it and start over.
    When you are finished configuring your Time Capsule, click Update and allow the Time Capsule to restart.

  • I want a user to use only import, it run with export but not import

    Hi,
    i create a user for use only for import and for export.
    batch_export with exp_full_database role <- It run
    batch_import with imp_full_database role <- don't run
    P:\>sqlplus batch_export/batch
    SQL*Plus: Release 10.1.0.2.0 - Production on Lun. Ao¹t 21 17:21:58 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    ERROR:
    ORA-00604: une erreur s'est produite au niveau SQL rÚcursif 1
    ORA-20000: Connexion refusee
    ORA-06512: Ó ligne 41
    Entrez le nom utilisateur :
    P:\>sqlplus batch_import/batch@rfsage
    SQL*Plus: Release 10.1.0.2.0 - Production on Lun. Ao¹t 21 17:03:36 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    ConnectÚ Ó :
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> exit
    the trigger as run
    create or replace trigger batch_export.check_connexion after logon on database
    declare
    V_MODULE SYS.V_$SESSION.module%TYPE;
    V_TERMINAL SYS.V_$SESSION.terminal%TYPE;
    V_SID SYS.V_$SESSION.SID%TYPE;
    V_SERIAL SYS.V_$SESSION.SERIAL#%TYPE;
    V_COMMAND varchar2(100);
    V_CURRENT_USER varchar2(20);
    V_CURRENT_SID SYS.V_$SESSION.SID%TYPE;
    cursor connexion is
    select substr(module,1,7) module, substr(terminal,1,12) terminal, sid, serial# from v$session T1 where schemaname='BATCH_EXPORT';
    cursor ID_CUR is
    select user from dual;
    cursor SID_CUR is
    select SYS_CONTEXT('USERENV','SID') sessionid from dual;
    --select SYS_CONTEXT('USERENV','CURRENT_USERID') current_userid from dual;
    Begin
    open SID_CUR;
    loop
    fetch SID_CUR into V_CURRENT_SID ;
    EXIT WHEN SID_CUR%NOTFOUND;
    dbms_output.put_line('V_CURRENT_SID:'||V_CURRENT_SID);
    end loop;
    close SID_CUR;
    open ID_CUR;
    loop
         fetch ID_CUR into V_CURRENT_USER ;
         EXIT WHEN ID_CUR%NOTFOUND;
         if V_CURRENT_USER='BATCH_EXPORT' then
         open connexion;
         loop
              fetch connexion into V_MODULE,V_TERMINAL,V_SID,V_SERIAL ;
              EXIT WHEN connexion%NOTFOUND;
              if V_MODULE<>'EXP.EXE' then
              dbms_output.put_line('V_SID:'||V_SID);
              dbms_output.put_line('V_CURRENT_USER:'||V_CURRENT_USER);
                   if V_CURRENT_SID=V_SID then
                   dbms_output.put_line('MODULE:'||V_MODULE);
                   RAISE_APPLICATION_ERROR (-20000,'Connexion refusee');
                   end if;
              end if;
         end loop;
         close connexion;
         end if;
    end loop;
    close ID_CUR;
    End;
    as the same for import user.
    I try with role in trigger but it don't, i see this in forum Oracle.
    But i think EXP_FULL_DATABASE have not DBA rule, but IMP_FULL_DATABASE have.
    How i do this ?
    I want just to use a user to imp utilities, but not connexion in sqlplus.
    Thanks for your help
    Christophe

    thanks for your help.
    it run !
    for example :
    as the system user
    SQL> INSERT INTO PRODUCT_USER_PROFILE values ('SQL*Plus', 'BATCH', 'CONNECT',null,null, 'DISABLED', NULL, NULL);
    1 ligne créée.
    SQL> grant create session to batch;
    Autorisation de privilèges (GRANT) acceptée.
    SQL> INSERT INTO PRODUCT_USER_PROFILE values ('SQL*Plus', 'BATCH', 'SELECT',null,null, 'DISABLED', NULL, NULL);
    1 ligne créée.
    the result
    oracle@debian:~$ sqlplus batch/batch;
    SQL*Plus: Release 10.2.0.1.0 - Production on Mar. Août 22 06:53:00 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connecté à :
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select user from dual;
    SP2-0544: Commande "select" désactivée dans le profil utilisateur du produit
    SQL>
    oracle@debian:~$ exp batch/batch owner=batch file=test.dump
    Export: Release 10.2.0.1.0 - Production on Mar. Août 22 06:54:32 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connecté à : Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export fait dans le jeu de car WE8DEC et jeu de car NCHAR AL16UTF16
    le serveur utilise le jeu de caractères WE8ISO8859P1 (conversion possible)
    Prêt à exporter les utilisateurs spécifiés ...
    . export des actions et objets procéduraux de pré-schéma
    . export des noms de bibliothèque de fonctions étrangères pour l'utilisateur BATCH
    . export des synonymes de type PUBLIC
    . export des synonymes de type PRIVATE
    Thanks for all

  • Code works in DW8 but not DW CS3

    Why would the following code work in Dreamweaver 8 but not in
    Dreamweaver CS3?
    Expires in
    <select name="mnuExpires" id="mnuExpires">
    <option value="0"
    >0</option>
    <option value="30" <% if true then
    response.write("selected") %>
    >30</option>
    <option value="60"
    >60</option>
    <option value="90"
    >90</option>
    <option value="120"
    >120</option>
    </select> days.
    Dreamweaver CS3 shuts down after throwing an error: "Adobe
    Dreamweaver CS3 has encountered a problem and needs to close. We
    are sorry for the inconvenience." Event ID 1000 appears in the
    Application Events Log.

    Brad Boyink wrote:
    > Dreamweaver CS3 shuts down after throwing an error:
    "Adobe Dreamweaver CS3 has
    > encountered a problem and needs to close. We are sorry
    for the inconvenience."
    > Event ID 1000 appears in the Application Events Log.
    http://www.adobe.com/go/kb402776
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Query running in Quality but not in Production

    Hi Folks,
    we are running a query AQICSDUSERS=====MOVEMENTLIST4= which used to get executed previously,but all of a sudden now after running for an hour or so it is coming back to  sap easy access screen without displaying the report.It is running and giving the report in Quality but not in Production.
    What could be the reason?
    K.Kiran.

    Hi Folks,
    From DUMP I got this:-
    <b>You should usually execute long-running programs as batch jobs.
    If this is not possible, increase the system profile parameter
    "rdisp/max_wprun_time".</b>
    I want to know how to increase the system profile parameter
    "rdisp/max_wprun_time".
    Thanks,
    K.Kiran.

  • Non-UB runs on Intel but not as plugin?

    I was under the impression that AU was the requisite format to run a plugin within Logic and universal binary was additionally required for anything to run on Intel macs. Zero-G Vocal Forge is stated as being AU but not necessarily UB. The stand alone version works fine on my Intel iMac however, the plugin does not show up in my Logic 8 or Ableton Live 6 plugin menus. I tried the AU scanner in Logic to no avail. The component does show up in the correct folder. I thought that if something wasn't UB, it just wouldn't run at all on an intel Mac but it runs fine, just not as a plugin. I wouldn't even bother asking, except that the stand alone is operational. Will I have to wait for UB, or am I doing something wrong? Thanks. - Emile

    Hi,
    The reason the Stand=Alone version of your plugin works, is that under an Intel mac, there is a shell, called "Rosetta". What this does, is that when you open a non-Intel, or non-Universal Binary version of a software, the computer tries to open it, and runs it inside the Rosetta shell. This is not a very efficient way of running software, but it allows you to open things that are not yet Universal Binaries.
    The Audio Unit portion of your plugin, is NOT Universal binary, and because it is not, it does not show up when you open Logic, which IS Universal binary. Logic is not being run under the Rosetta shell, because it does not need to.
    If you want to use it as a Plugin-In inside of Logic, you will have to wait until the company releases a UB version.
    Cheers

  • Semantics of running with DB_INIT_TXN but not DB_INIT_LOCK

    What are the semantics of enabling the logging and transactional subsystems, but not the locking subsystem? Ideally this would give the write ahead logging properties of running with transactions, but no isolation or atomicity guarantees. Is this, in fact, what will happen, or will this configuration lead to something else?
    Thanks!

    I'm not totally clear here though, does BDB provide isolation and atomicity guarantees even if I don't enable the locking subsystem? No exaclty. BDB provides those guarantees to ensure that every single method in the API works well. But it doesn't take care of concurrency control for your own application. I guess it might help you understand better if you refer to http://www.oracle.com/technology/documentation/berkeley-db/db/ref/lock/intro.html.
    That seems odd as it would have to be using some internal locking system for that. What I'd like is for BDB to provide me write ahead logging but no concurrency control and I'll provide my own concurrency control above BDB so I can ensure that only one thread will be reading/writing a key at the same time. Does DB_INIT_TXN, DB_INIT_LOG give me that?Yes, you could use DB_INIT_TXN, DB_INIT_LOG and write your own concurrency control.
    Regards,
    Emily Fu, Oracle Berkeley DB

  • App is running on simulator but not in Playbook device

    Hi,
    I have developped an app that has been approved and it's present on app world.
    The app is running perfectly on the simulator but customers write reviews saying that they can't save data on the device and no error message is displayed.
    I have used AIR SDK and a SQLIte database.
    As I'm in Europe and Playbook is not available, I can't debug the app on a real device.
    Has anybody an idea about why the app work on the simulator but not on the real device.
    Thanks.

    Scocam - that's not a particularly helpful comment. A great deal of the apps in AppWorld have not been tested on the PlayBook yet as there ard a number of developers still waiting to receive their PlayBooks.
    If they live outside of North America then they have no other way of getting one except for waiting for RIM to ship them out. In the meantime, we use the simulators that RIM provide us and hope the apps behave the same on the real devices. This isn't always the case.
    But a great way to demonstrate your ignorance with an unhelpful pithy comment. Well done.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!

  • Able to send main but not recieve

    Hello,
    Has there been a problem in receiving email on the original iphone? I am able to send from my iphone, but not receive. I have checked my mail on my home computer and am receiving there. I am using a verizon email address. Any help would be appreciated. Thanks alot.

    Hi Navymom,
    If not at you you might want to completely quit mail so it is not retrieving the email from the server and deleting it.
    The iphone by default is set to leave the email on the server so you can still access it from your home computer.
    One more thing is that you can set your email app on the computer to leave a copy on the server.
    This article might help if you want to leave a copy on server.
    http://docs.info.apple.com/article.html?path=Mail/3.0/en/9954.html
    Hope this helps.

  • The application runs from netbeans, but not the command-line

    Hi
    I have developed a GUI application using NetBeans. All source code files are compiling without problems and the program runs just fine when i press "run <app name>" in NetBeans. However, when i try to execute the jar file using the command "java -jar <name of jar>", then i get this error message (im standing in the same directory as the jar file which is the dist directory:
    $ java -jar /home/icebyte/NetBeansProjects/TripPlanner/dist/TripPlanner.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: tripplanner/Main
    Caused by: java.lang.ClassNotFoundException: tripplanner.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:221)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    Does someone know why i am getting this error ? I would be nice to find out. I have also tried to go into the src directory of the netbeans project and compile all files there which works fine, but when i try to run the program with "java <file that contains main method>" i get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: MainMenu (wrong name: tripplanner/MainMenu)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:638)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:281)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:216)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
    Error: Could not find the main class.
    Error: A JNI error has occurred, please check your installation and try again
    I have JDK and JRE installed on the system (it came with netbeans). I have tried setting the JAVA_HOME variable, but there is no difference. Anyone? Thanks for all help.

    Hmm, i solved the problem now. I looked at this problem yesterday and couldnt find out why i was getting these stack traces, but now i know :)

  • Applet notinited .. it runs in eclipse, but not in web browser --urgent

    hi,
    firstly i'm sorry for the "urgent" remark in the title, but I actually really need some help to this problem, since I have to pass up this assignment in about 2 more hours.
    on to the question,this is my full code:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import javax.swing.event.DocumentEvent;
    import javax.swing.event.DocumentListener;
    public class reza extends JApplet{
         public static void main(String[] args){
              JFrame myWindow = new JFrame("Sample reza");
              myWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              reza testReza = new reza();
              myWindow.setContentPane(testReza);//add to the window
              myWindow.pack();
              myWindow.setVisible(true);
         double sum;     //sum of values entered by user
         private ImageIcon board;
         private JPanel topPanel,boardPanel;
         private JLabel l1,l2,l3,l4,l5,l6,lTotal,lAndryusha,lBorya,lVolodya,lGiveUp,lGiveUp2,boardLabel,lRules;
         private JTextField a[],aTotal, b[], bTotal, c[], cTotal;
         private JButton clear,checkAnswer,solve;
         private Container container;
         String A1,A2,A3,A4,A5,A6,ATOTAL,B1,B2,B3,B4,B5,B6,BTOTAL,C1,C2,C3,C4,C5,C6,CTOTAL;
         public reza(){
              container = getContentPane();
             container.setLayout(new BorderLayout());
             topPanel = new JPanel(new GridLayout(6,8,5,5));
             boardPanel = new JPanel(new GridLayout(1,2,5,5));
             board = new ImageIcon("board.jpg");
             boardLabel = new JLabel(board);
             topPanel.setBackground(Color.WHITE);
             boardPanel.setBackground(Color.white);
             //utk handle button clear ngan solve
             ButtonHandler handler = new ButtonHandler();
             lGiveUp = new JLabel("           Give up?");
             lGiveUp2 = new JLabel("Press this >>>");
             lRules = new JLabel("Rules: User may only use the number shown in the dart board");
             l1 = new JLabel("   1");
             l2 = new JLabel("   2");
             l3 = new JLabel("   3");
             l4 = new JLabel("   4");
             l5 = new JLabel("   5");
             l6 = new JLabel("   6");
             lTotal = new JLabel("   Total");
             lAndryusha = new JLabel("Andryusha");
             lBorya = new JLabel("Borya");
             lVolodya = new JLabel("Volodya");
             a = new JTextField[7];
             b = new JTextField[7];
             c = new JTextField[7];
             aTotal = new JTextField();
             bTotal = new JTextField();
                cTotal = new JTextField();
                clear = new JButton("CLEAR");
             solve = new JButton("SOLVE");
             checkAnswer = new JButton("ANSWER");
             topPanel.add(new JLabel("       "));
             topPanel.add(l1);
             topPanel.add(l2);
             topPanel.add(l3);
             topPanel.add(l4);
             topPanel.add(l5);
             topPanel.add(l6);
             topPanel.add(lTotal);
             topPanel.add(lAndryusha);
             int i=1;
             for (i=1;i<=6;i++){
                  a[i] = new JTextField();
                  a.getDocument().addDocumentListener(new textFieldListenerA());
              topPanel.add(a[i]);
         topPanel.add(aTotal);
         topPanel.add(lBorya);
         for (i=1;i<=6;i++){
              b[i] = new JTextField();
              b[i].getDocument().addDocumentListener(new textFieldListenerB());
              topPanel.add(b[i]);
         topPanel.add(bTotal);
         topPanel.add(lVolodya);
         for (i=1;i<=6;i++){
              c[i] = new JTextField();
              c[i].getDocument().addDocumentListener(new textFieldListenerC());
              topPanel.add(c[i]);
         topPanel.add(cTotal);
         clear.addActionListener(handler);
         solve.addActionListener(handler);
         checkAnswer.addActionListener(handler);
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(clear);
         topPanel.add(solve);
         topPanel.add(new JLabel(" "));
         topPanel.add(lGiveUp);
         topPanel.add(lGiveUp2);
         topPanel.add(checkAnswer);
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         topPanel.add(new JLabel(" "));
         boardPanel.add(boardLabel,BorderLayout.WEST);
         boardPanel.add(lRules,BorderLayout.EAST);
         container.add(boardPanel,BorderLayout.NORTH);
         container.add(topPanel,BorderLayout.CENTER);
         setSize(750,700);
         setVisible(true);
         class textFieldListenerA implements DocumentListener{
              public void insertUpdate(DocumentEvent e){
                   int i,count=0;
                   for (i=1;i<=6;i++){
                        try{                    
                             count = count + Integer.parseInt(a[i].getText());
                        }catch(Exception e1){
                   aTotal.setText("" + count);
              public void changedUpdate(DocumentEvent e){
              public void removeUpdate(DocumentEvent e){               
         class textFieldListenerB implements DocumentListener{
              public void insertUpdate(DocumentEvent e){
                   int i,count=0;
                   for (i=1;i<=6;i++){
                        try{                    
                             count = count + Integer.parseInt(b[i].getText());
                        }catch(Exception e1){                         
                   bTotal.setText("" + count);
              public void changedUpdate(DocumentEvent e){
              public void removeUpdate(DocumentEvent e){               
         class textFieldListenerC implements DocumentListener{
              public void insertUpdate(DocumentEvent e){
                   int i,count=0;
                   for (i=1;i<=6;i++){
                        try{                    
                             count = count + Integer.parseInt(c[i].getText());
                        }catch(Exception e1){
                   cTotal.setText("" + count);
              public void changedUpdate(DocumentEvent e){
                   int i,count=0;
                   for     (i=1;i<=6;i++){
                        try{                    
                             count = count + Integer.parseInt(c[i].getText());
                        }catch(Exception e1){
                   cTotal.setText("" + count);
              public void removeUpdate(DocumentEvent e){
                   int i,count=0;
                   for (i=1;i<=6;i++){
                        try{                    
                             count = count + Integer.parseInt(c[i].getText());
                        }catch(Exception e1){
                   cTotal.setText("" + count);
         private class ButtonHandler implements ActionListener{
              //handle button event
              public void actionPerformed(ActionEvent event){
                   //clear all the text fields
                   if (event.getActionCommand().equals("CLEAR")){
                        int i=0;
                        for (i=1;i<=6;i++){
                             a[i].setText("");
                        aTotal.setText("");
                        for (i=1;i<=6;i++){
                             b[i].setText("");
                        bTotal.setText("");
                        for (i=1;i<=6;i++){
                             c[i].setText("");
                        cTotal.setText("");                    
                   else if (event.getActionCommand().equals("SOLVE")){
                        int aCount[],bCount[],cCount[],i,aTotal=0,bTotal=0,cTotal=0;
                        aCount = new int[7];
                        bCount = new int[7];
                        cCount = new int[7];
                        //make sure all fields have been filled in
                        if (a[1].getText().equals("") || a[2].getText().equals("") || a[3].getText().equals("")|| a[4].getText().equals("")|| a[5].getText().equals("")|| a[6].getText().equals("")|| b[1].getText().equals("")|| b[2].getText().equals("")|| b[3].getText().equals("")|| b[4].getText().equals("")|| b[5].getText().equals("")|| b[6].getText().equals("")|| c[1].getText().equals("")|| c[2].getText().equals("")|| c[3].getText().equals("")|| c[4].getText().equals("")|| c[5].getText().equals("")|| c[6].getText().equals("")){
                             JOptionPane.showMessageDialog(null,"Please fill in ALL the scores!!");
                        //if yes, then only proceed
                        else{
                             //for andryusha
                             for (i=1;i<=6;i++){
                                  try{
                                       aCount[i] = Integer.parseInt(a[i].getText());
                                       aTotal = aTotal + aCount[i];
                                  }catch(Exception e1){
                             //check andryusha's 1st and 2nd shots. They must be equal to 22 when added
                             if (aCount[1] + aCount[2] != 22){
                                  JOptionPane.showMessageDialog(null,"Andryusha's 1st + 2nd shots must be equal to 22!!");
                             if (aTotal==71){
                                  JOptionPane.showMessageDialog(null,"Andryusha's scores is right! Well done!!");
                             }else if (aTotal !=71){
                                  JOptionPane.showMessageDialog(null,"You got it wrong for Andryusha's scores. Please try again.");
                             //for Borya
                             for (i=1;i<=6;i++){
                                  try{
                                       bCount[i] = Integer.parseInt(b[i].getText());
                                       bTotal = bTotal + bCount[i];
                                  }catch(Exception e1){
                             if (bTotal==71){
                                  JOptionPane.showMessageDialog(null,"Borya's scores is right! Well done!!");
                             }else if (bTotal !=71){
                                  JOptionPane.showMessageDialog(null,"You got it wrong for Borya's scores. Please try again.");
                             //for Volodya
                             for (i=1;i<=6;i++){
                                  try{
                                       cCount[i] = Integer.parseInt(c[i].getText());
                                       cTotal = cTotal + cCount[i];
                                  }catch(Exception e1){
                             if (cCount[1] != 3){
                                  JOptionPane.showMessageDialog(null,"Volodya's first score is wrong!!");
                             if (cTotal==71){
                                  if (cCount[2] == 50 || cCount[3] == 50 || cCount[4] == 50 || cCount[5]==50 || cCount[6]==50){
                                       JOptionPane.showMessageDialog(null,"Volodya's score is right! Well done!!");
                                  }else if (cCount[2] != 50 && cCount[3] != 50 && cCount[4] != 50 && cCount[5]!=50 && cCount[6]!=50){
                                       JOptionPane.showMessageDialog(null,"Volodya hits the bull's eye once!!");
                             }else if (cTotal!=71){
                                  JOptionPane.showMessageDialog(null,"Volodya's score is wrong!!");
                   }else if(event.getActionCommand().equals("ANSWER")){
                        a[1].setText("20");
                        a[2].setText("2");
                        a[3].setText("25");
                        a[4].setText("3");
                        a[5].setText("20");
                        a[6].setText("1");
                        aTotal.setText("71");
                        b[1].setText("25");
                        b[2].setText("20");
                        b[3].setText("20");
                        b[4].setText("3");
                        b[5].setText("2");
                        b[6].setText("1");
                        bTotal.setText("71");
                        c[1].setText("3");
                        c[2].setText("50");
                        c[3].setText("10");
                        c[4].setText("5");
                        c[5].setText("2");
                        c[6].setText("1");
                        cTotal.setText("71");
         }//end private class ButtonHandler
    I run the program using Eclipse; run as> Java applet
    and in runs perfectly well. I then tried running it using internet explorer and firefox, but only a gray box appeared and the browser says "applet notinited" and "Loading Java Applet Failed.."
    what did i do wrong? any help is really appreciated.. thanks

    thank God i already found the cause of the problem..
    it's because the application has an ImageIcon which links to a local jpeg file, so perhaps security restriction on the browser doesn't allow my applet to access local file, that's why it fails to load.
    either using signed applet (not tested) or removing the picture solved my problem.
    thanks anyway :)

  • SSIS Package Runs OK Manually But Not From SQL Server Agent...Permissions?

    I have a problem where I have an SSIS package (SQL Server 2005) that won't run properly from SQL Server Agent, but it runs fine when kicked off manually from Integration Services -> Run Package or when run in debug from Visual Studio.
    The first step in the package checks for the existance of a file via a script task.  The script looks like this...
    Code Block
    Public Sub Main()
    Dim TaskResult As Integer
    Dim ImportFile As String = CStr(Dts.Variables("BaseDirectory").Value) + CStr(Dts.Variables("ImportDirectory").Value) + CStr(Dts.Variables("ImportFile").Value)
    If Dir(ImportFile) = "" Then
    Dts.TaskResult = Dts.Results.Failure
    Else
    Dts.TaskResult = Dts.Results.Success
    End If
    Return
    End Sub
    This script runs fine and the file is seen as expected when I run the package manually.  But as a step in a SQL Server Agent job, it doesn't see the file.
    The SQL Server Agent service is set to start up / log on as a Local System Account.  I've also tried setting up a credential / proxy (using an account that I know can see and even move / rename the file) to run the job as but that didn't seem to help.
    The package is being run from SQL Server (stored in MSDB) and is set to rely on SQL Server for sensitive information, so I don't think that's an issue; other packages are set up like this in terms of sensitive data and run fine.
    Any ideas why my script can't "see" the file I'm looking at when it's kicked off by SQL Server agent?  I've looked and looked...I can't seem to figure this out.  I would really appreciate any help you might be able to offer up.

    If the variables are fine, then I think it is very likely that this is security related. Since the Agent is running under the local system account, have you verified that the local account can access the file? When you tried the proxy account, are you positive that it was set up properly, and that the account had the permissions to read the file?
    Another thing to check - is this a local file or is on another computer? If it is on another computer, make sure you are using a UNC path and not a mapped drive.

  • Jmxri running under javaw but not from java web start

    Hi all
    I've got following problem.
    I've got application that uses special jar that requires jmxri.jar This jar is black box for me. It provides some interface to get data from server.
    When I run my application using jmxri.jar and mentioned black box (jar) from command line with javaw, it is working fine.
    javaw -Xmx256m -classpath application.jar;jmxri.jar;(blackbox.jar); CClient
    In case I use jnlp, everything is same, I've got following error meassage.
    cia4all:name=Cia4allFactory.... Exception ........................................
    javax.management.InstanceNotFoundException: cia4all:name=Cia4allFactory
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown Source)
         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(Unknown Source)
         at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(Unknown Source)
         at de.siemens.cc.b2b.cia4all.client.Cia4allClientFactory.createLdap(Unknown Source)     
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)Cia4allClientFactory - is class in mentioned black box jar
    The jnlp looks like
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0+" codebase="file:/D:\" href="my.jnlp">
       <security>
          <all-permissions/>
       </security>
       <resources>
          <j2se version="1.4+" max-heap-size="256m"/>
          <jar href="application.jar" main="true" download="eager"/>
          <jar href="blackbox.jar" download="eager"/>
          <jar href="jmxri.jar" download="eager"/>
       </resources>
       <application-desc main-class="CClient">
       </application-desc>
    </jnlp>Any idea what must be configured in jnlp or missing ?
    Edited by: svist001 on Aug 28, 2008 12:56 AM

    The default remote apps webpage will be shown with these demos. In order to remove them for all-users, You need to change the default remote apps url, not in the user configuration file, but in a system config file.
    unfortunately, because of bug 4933851, you can not just put a deployment.properties file in the javaws directory (untill update release 1.4.2_05, where this is fixed). Instead you have to put it in what they call ${deployment.system.home} which on unix is /etc/.java/.deployment, but on windows is ${windows dir}\Application Data\Sun\Java\Deployment
    /Dietz

  • JMF code working under linux but not windows XP

    Hello everyone,
    I'm currently working on a nice cross-platform project involving sound producing. I decided to take a look at JMF and test it a bit to know if its features can suit me. I tried to make it works under windows, using a very simple sample of code. The system seems to play the sound as some console output detects the start and the end, but all i hear is a very short noise ( 1/2second ) like a "CLIK" and nothing else. I tested the code under linux, using the same computer and it works just fine, playing the same wave nicely and entirely.
    some info:
    -i used the cross platform JMF, no performance pack ( i tried it , but still no result )
    -the code just opens a file dialog and plays the selected file
    -the selected file was always a very simple .wav
    -i did not use system classpath variables because i don't like it, i rather use local classpath ( which works fine too, no doubt about it )
    -i tested this little soft on 2 other computer using windows XP, and still got the same result.
    Please, have you got an idea about what's going on ?
    Thanks a lot for any answer!
    Maxime - Paris . France
    Code Sample:
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import javax.media.*;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class JMFSound extends Object implements ControllerListener {
         File soundFile;
         JDialog playingDialog;
         public static void main (String[] args) {
              JFileChooser chooser = new JFileChooser();
              chooser.showOpenDialog(null);
              File f = chooser.getSelectedFile();
              try {
                   JMFSound s = new JMFSound (f);
              } catch (Exception e) {
                   e.printStackTrace();
         public JMFSound (File f) throws NoPlayerException, CannotRealizeException,     MalformedURLException, IOException {
              soundFile = f;
              // prepare a dialog to display while playing
              JOptionPane pane = new JOptionPane ("Playing " + f.getName(), JOptionPane.PLAIN_MESSAGE);
              playingDialog = pane.createDialog (null, "JMF Sound");
    playingDialog.pack();
              // get a player
              MediaLocator mediaLocator = new MediaLocator(soundFile.toURL());
              Player player =     Manager.createRealizedPlayer (mediaLocator);
    player.addControllerListener (this);
    player.prefetch();
    player.start();
    playingDialog.setVisible(true);
         // ControllerListener implementation
         public void controllerUpdate (ControllerEvent e) {
    System.out.println (e.getClass().getName());
         if (e instanceof EndOfMediaEvent) {
                   playingDialog.setVisible(false);
                   System.exit (0);
    Message was edited by:
    Monsieur_Max

    Hello everyone,
    I'm currently working on a nice cross-platform project involving sound producing. I decided to take a look at JMF and test it a bit to know if its features can suit me. I tried to make it works under windows, using a very simple sample of code. The system seems to play the sound as some console output detects the start and the end, but all i hear is a very short noise ( 1/2second ) like a "CLIK" and nothing else. I tested the code under linux, using the same computer and it works just fine, playing the same wave nicely and entirely.
    some info:
    -i used the cross platform JMF, no performance pack ( i tried it , but still no result )
    -the code just opens a file dialog and plays the selected file
    -the selected file was always a very simple .wav
    -i did not use system classpath variables because i don't like it, i rather use local classpath ( which works fine too, no doubt about it )
    -i tested this little soft on 2 other computer using windows XP, and still got the same result.
    Please, have you got an idea about what's going on ?
    Thanks a lot for any answer!
    Maxime - Paris . France
    Code Sample:
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import javax.media.*;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class JMFSound extends Object implements ControllerListener {
         File soundFile;
         JDialog playingDialog;
         public static void main (String[] args) {
              JFileChooser chooser = new JFileChooser();
              chooser.showOpenDialog(null);
              File f = chooser.getSelectedFile();
              try {
                   JMFSound s = new JMFSound (f);
              } catch (Exception e) {
                   e.printStackTrace();
         public JMFSound (File f) throws NoPlayerException, CannotRealizeException,     MalformedURLException, IOException {
              soundFile = f;
              // prepare a dialog to display while playing
              JOptionPane pane = new JOptionPane ("Playing " + f.getName(), JOptionPane.PLAIN_MESSAGE);
              playingDialog = pane.createDialog (null, "JMF Sound");
    playingDialog.pack();
              // get a player
              MediaLocator mediaLocator = new MediaLocator(soundFile.toURL());
              Player player =     Manager.createRealizedPlayer (mediaLocator);
    player.addControllerListener (this);
    player.prefetch();
    player.start();
    playingDialog.setVisible(true);
         // ControllerListener implementation
         public void controllerUpdate (ControllerEvent e) {
    System.out.println (e.getClass().getName());
         if (e instanceof EndOfMediaEvent) {
                   playingDialog.setVisible(false);
                   System.exit (0);
    Message was edited by:
    Monsieur_Max

Maybe you are looking for

  • Telephone number in address

    Hi all,   i am displaying the vendor address in PO form by passing the address number to the address node in smart form. My problem is communication details like Telephone number, Fax and email id is not printing in the output. I want to print the co

  • Opening pdfs with ibooks ipad: problem

    Hi, I found that many people have this problem: opening a pdf (that's attached to an email) with ibooks, used to work perfectly. And now it doens't anymore. Sometimes (1 on 20 tries) it does work. Often the pdf lights up for a second in ibooks, and t

  • Installation & Configurations Pre-requisites

    Hi all, from several posts regarding installations, I see that there are problems regarding pre-requistes. Apart from the certification matrix, which provides information on OS, database repository there are certain other mandatory requirements for i

  • Pluggable Mapping Won't Fully Synchronize

    I'm hoping there is perhaps just a config setting of some kind that governs how a pluggable mapping is embedding in a real mapping that is causing my problems. The situation: -Mapping A is my actual mapping. -Mapping B is my pluggable mapping which i

  • Firefox keeps asking to change settings whenever i open it.

    Everytime i open firefox it ask for it to allow to make changes. I have gone into properties and made sure comparability has been unchecked. also my firefox runs so slow, freezes a lot, crashes a lot and scrolling is laggy. I'm running on an i5 surfa