Search Results

Search found 1197 results on 48 pages for 'jvm'.

Page 24/48 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Class unloading in java

    - by java_geek
    When a classloader is garbage collected, are the classes loaded by it unloaded? When the JVM is running is verbose mode, all the loaded classes are o/p. Similarly will the JVM log when it unloads a class? I wrote a custom class loader to test this, but could not see any verbose log for unloading of the classes. CustomClassLoader loader = new CustomClassLoader(new URL[]{}, CustomClassLoader.class.getClassLoader()); loader.addURL("D:\workspace\ClassLoaderTest\implementation.jar"); Class c = null; try { c = Class.forName("Horse",false,loader); if (c != null) { try { Animal animal = (Animal)c.newInstance(); animal.eat(); } catch(Exception ex) { ex.printStackTrace(); } } } catch(Exception e) { e.printStackTrace(); } loader = null; byte[] b = new byte[58*1024*1024]; System.gc(); ClassLoadingMXBean clBean = ManagementFactory.getClassLoadingMXBean(); System.out.println("Number of classes currently loaded " + clBean.getLoadedClassCount()); System.out.println("Number of classes loaded totally " + clBean.getTotalLoadedClassCount()); System.out.println("Number of classes unloaded " + clBean.getUnloadedClassCount()); Even the ClassLoadingMXBean gives number of unloaded classes as 0. How can i know that a class is unloaded when the class loader is GCed?

    Read the article

  • Accessing global variable in multithreaded Tomcat server

    - by jwegan
    I have a singleton object that I construct like thus: private static volatile KeyMapper mapper = null; public static KeyMapper getMapper() { if(mapper == null) { synchronized(Utils.class) { if(mapper == null) { mapper = new LocalMemoryMapper(); } } } return mapper; } The class KeyMapper is basically a synchronized wrapper to HashMap with only two functions, one to add a mapping and one to remove a mapping. When running in Tomcat 6.24 on my 32bit Windows machine everything works fine. However when running on a 64 bit Linux machine (CentOS 5.4 with OpenJDK 1.6.0-b09) I add one mapping and print out the size of the HashMap used by KeyMapper to verify the mapping got added (i.e. verify size = 1). Then I try to retrieve the mapping with another request and I keep getting null and when I checked the size of the HashMap it was 0. I'm confident the mapping isn't accidentally being removed since I've commented out all calls to remove (and I don't use clear or any other mutators, just get and put). The requests are going through Tomcat 6.24 (configured to use 200 threads with a minimum of 4 threads) and I passed -Xnoclassgc to the jvm to ensure the class isn't inadvertently getting garbage collected (jvm is also running in -server mode). I also added a finalize method to KeyMapper to print to stderr if it ever gets garbage collected to verify that it wasn't being garbage collected. I'm at my wits end and I can't figure out why one minute the entry in HashMap is there and the next it isn't :(

    Read the article

  • Scale an image which is stored as a byte[] in Java

    - by Sergio del Amo
    I upload a file with a struts form. I have the image as a byte[] and I would like to scale it. FormFile file = (FormFile) dynaform.get("file"); byte[] fileData = file.getFileData(); fileData = scale(fileData,200,200); public byte[] scale(byte[] fileData, int width, int height) { // TODO } Anyone knows an easy function to do this? public byte[] scale(byte[] fileData, int width, int height) { ByteArrayInputStream in = new ByteArrayInputStream(fileData); try { BufferedImage img = ImageIO.read(in); if(height == 0) { height = (width * img.getHeight())/ img.getWidth(); } if(width == 0) { width = (height * img.getWidth())/ img.getHeight(); } Image scaledImage = img.getScaledInstance(width, height, Image.SCALE_SMOOTH); BufferedImage imageBuff = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); imageBuff.getGraphics().drawImage(scaledImage, 0, 0, new Color(0,0,0), null); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ImageIO.write(imageBuff, "jpg", buffer); return buffer.toByteArray(); } catch (IOException e) { throw new ApplicationException("IOException in scale"); } } If you run out of Java Heap Space in tomcat as I did, increase the heap space which is used by tomcat. In case you use the tomcat plugin for Eclipse, next should apply: In Eclipse, choose Window Preferences Tomcat JVM Settings Add the following to the JVM Parameters section -Xms256m -Xmx512m

    Read the article

  • Running an RMI registry on one computer and connecting to it from another

    - by Hippopotamus
    Hello. I am doing a student assignment, using java RMI. I've programmed a simple RMI-server application that provides method which return some strings to the client. When I start the server on localhost and connect to it by client on the same computer, everything goes well. However, I am not able to do this between two computers on home network. The computers both have no trouble of connecting by a simple C program with similar functionality, so I guess the problem is with JVM here. I am binding the class to rmiregistry with try{ ComputeImpl R = new ComputeImpl(); Naming.rebind("rmi://localhost/ComputeService",R); } catch(Exception e){ System.out.println("Trouble: " +e); } And I'm doing the lookup for RMI registry in the client application with providing the argument while launching the application: StringBuffer rmi_address = new StringBuffer(); rmi_address.append("rmi://").append(args[1]).append("/ComputeService"); Compute R = (Compute) Naming.lookup(rmi_address.toString()); Is the problem with my code or with JVM? Thanks in advance.

    Read the article

  • Class initialization and synchronized class method

    - by nybon
    Hi there, In my application, there is a class like below: public class Client { public synchronized static print() { System.out.println("hello"); } static { doSomething(); // which will take some time to complete } } This class will be used in a multi thread environment, many threads may call the Client.print() method simultaneously. I wonder if there is any chance that thread-1 triggers the class initialization, and before the class initialization complete, thread-2 enters into print method and print out the "hello" string? I see this behavior in a production system (64 bit JVM + Windows 2008R2), however, I cannot reproduce this behavior with a simple program in any environments. In Java language spec, section 12.4.1 (http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html), it says: A class or interface type T will be initialized immediately before the first occurrence of any one of the following: T is a class and an instance of T is created. T is a class and a static method declared by T is invoked. A static field declared by T is assigned. A static field declared by T is used and the reference to the field is not a compile-time constant (§15.28). References to compile-time constants must be resolved at compile time to a copy of the compile-time constant value, so uses of such a field never cause initialization. According to this paragraph, the class initialization will take place before the invocation of the static method, however, it is not clear if the class initialization need to be completed before the invocation of the static method. JVM should mandate the completion of class initialization before entering its static method according to my intuition, and some of my experiment supports my guess. However, I did see the opposite behavior in another environment. Can someone shed me some light on this? Any help is appreciated, thanks.

    Read the article

  • Calling into a saved java object via JNI from a different thread

    - by Drake Amara
    I have a java object which calls into a C++ shared object via JNI. In C++, I am saving a reference to the JNIEnv and jObject. JavaVM * jvm; JNIEnv * myEnv; jobject myobj; JNIEXPORT void JNICALL Java_org_api_init (JNIEnv *env, jobject jObj) { myEnv = env; myobj = jObj; } I also have a GLSurface renderer and it eventually calls the C++ shared object mentioned above on a different thread, the GLThread. I am then trying to call back into my original Java object using the jobject I saved initially, but I think because I am on the GLThread, I get the following error. W/dalvikvm(16101): JNI WARNING: 0x41ded218 is not a valid JNI reference I/dalvikvm(16101): "GLThread 981" prio=5 tid=15 RUNNABLE I/dalvikvm(16101): | group="main" sCount=0 dsCount=0 obj=0x41d6e220 self=0x5cb11078 I/dalvikvm(16101): | sysTid=16133 nice=0 sched=0/0 cgrp=apps handle=1555429136 I/dalvikvm(16101): | schedstat=( 0 0 0 ) utm=42 stm=32 core=1 The code calling back into Java : void setData() { jvm->AttachCurrentThread(&myEnv, 0); jclass javaClass = myEnv->FindClass("com/myapp/myClass"); if(javaClass == NULL){ LOGD("ERROR - cant find class"); } jmethodID method = myEnv->GetMethodID(javaClass, "updateDataModel", "()V"); if(method == NULL){ LOGD("ERROR - cant access method"); } // this works, but its a new java object //jobject myobj2 = myEnv->NewObject(javaClass, method); //this is where the crash occurs myEnv->CallVoidMethod(myobj, method, NULL); } If instead I create a new jObject using env-NewObject, I can succuessfully call back into Java, but it is a new object and I dont want that. I need to get back to my original Java Object. Is it a matter of switching threads before I call back into Java? If so, how do I do so ?

    Read the article

  • Scala path dependent return type from parameter

    - by Rich Oliver
    In the following code using 2.10.0M3 in Eclipse plugin 2.1.0 for 2.10M3. I'm using the default setting which is targeting JVM 1.5 class GeomBase[T <: DTypes] { abstract class NewObjs { def newHex(gridR: GridBase, coodI: Cood): gridR.HexRT } class GridBase { selfGrid => type HexRT = HexG with T#HexTr def uniformRect (init: NewObjs) { val hexCood = Cood(2 ,2) val hex: HexRT = init.newHex(selfGrid, hexCood)// won't compile } } } Error message: Description Resource Path Location Type type mismatch; found: GeomBase.this.GridBase#HexG with T#HexTr required: GridBase.this.HexRT (which expands to) GridBase.this.HexG with T#HexTr GeomBase.scala Why does the compiler think the method returns the type projection GridBase#HexG when it should be this specific instance of GridBase? Edit transferred to a simpler code class in responce to comments now getting a different error message. package rStrat class TestClass { abstract class NewObjs { def newHex(gridR: GridBase): gridR.HexG } class GridBase { selfGrid => def uniformRect (init: NewObjs) { val hex: HexG = init.newHex(this) //error here } class HexG { val test12 = 5 } } } . Error line 11:Description Resource Path Location Type type mismatch; found : gridR.HexG required: GridBase.this.HexG possible cause: missing arguments for method or constructor TestClass.scala /SStrat/src/rStrat line 11 Scala Problem Update I've switched to 2.10.0M4 and updated the plug-in to the M4 version on a fresh version of Eclipse and switched to JVM 1.6 (and 1.7) but the problems are unchanged.

    Read the article

  • tomcat wont start up on linux machine

    - by David
    hi, im new to linux but after spending the day i have got linux running. installed java and tomcat. my goal is host my app with this linux box i've just set up. i know it all works fine from my windows based machine but it is my laptop so i'm planning this as my dedicated server. following many many forums i've now got tomcat 7 installed. however i cannot get it to start. changing to the tomcat directory and "./startup.sh" i get output Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local.tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: usr/lib/jvm/java-6-sun/ Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local.tomcat/bin/c\tomcat-juli.jar thats the end of theoutput. however localhost:8080 is not up. and in the tomcat log file is the error "eval: 1: usr/lib/jvm/java-6-sun//bin/java: not found" hopfully there is some expert here who can help me with this problem. please note that im a novice when it comes to linux. thankyou oh and my version of linux is Ubuntu 10.04 LTS - the Lucid Lynx

    Read the article

  • Which options do I have for Java process communication?

    - by Dmitriy Matveev
    We have a place in a code of such form: void processParam(Object param) { wrapperForComplexNativeObject result = jniCallWhichMayCrash(param); processResult(result); } processParam - method which is called with many different arguments. jniCallWhichMayCrash - a native method which is intended to do some complex processing of it's parameter and to create some complex object. It can crash in some cases. wrapperForComplexNativeObject - wrapper type generated by SWIG processResult - a method written in pure Java which processes it's parameter by creation of several kinds (by the kinds I'm not meaning classes, maybe some like hierarchies) of objects: 1 - Some non-unique objects which are referencing each other (from the same hierarchy), these objects can have duplicates created from the invocations of processParam() method with different parameter values. Since it's costly to keep all the duplicates it's necessary to cache them. 2 - Some unique objects which are referencing each other (from the same hierarchy) and some of the objects of 1st kind. After processParam is executed for each of the arguments from some set the data created in processResult will be processed together. The problem is in fact that jniCallWhichMayCrash method may crash the entire JVM and this will be very bad. The reason of crash may be such that it can happen for one argument value and not for the other. We've decided that it's better to ignore crashes inside of JVM and just skip some chunks of data when such crashes occur. In order to do this we should run processParam function inside of separate process and pass the result somehow (HOW? HOW?! This is a question) to the main process and in case of any crashes we will only lose some part of data (It's ok) without lose of everything else. So for now the main problem is implementation of transport between different processes. Which options do I have? I can think about serialization and transmitting of binary data by the streams, but serialization may be not very fast due to object complexity. Maybe I have some other options of implementing this?

    Read the article

  • Slowing process creation under Java?

    - by oconnor0
    I have a single, large heap (up to 240GB, though in the 20-40GB range for most of this phase of execution) JVM [1] running under Linux [2] on a server with 24 cores. We have tens of thousands of objects that have to be processed by an external executable & then load the data created by those executables back into the JVM. Each executable produces about half a megabyte of data (on disk) that when read right in, after the process finishes, is, of course, larger. Our first implementation was to have each executable handle only a single object. This involved the spawning of twice as many executables as we had objects (since we called a shell script that called the executable). Our CPU utilization would start off high, but not necessarily 100%, and slowly worsen. As we began measuring to see what was happening we noticed that the process creation time [3] continually slows. While starting at sub-second times it would eventually grow to take a minute or more. The actual processing done by the executable usually takes less than 10 seconds. Next we changed the executable to take a list of objects to process in an attempt to reduce the number of processes created. With batch sizes of a few hundred (~1% of our current sample size), the process creation times start out around 2 seconds & grow to around 5-6 seconds. Basically, why is it taking so long to create these processes as execution continues? [1] Oracle JDK 1.6.0_22 [2] Red Hat Enterprise Linux Advanced Platform 5.3, Linux kernel 2.6.18-194.26.1.el5 #1 SMP [3] Creation of the ProcessBuilder object, redirecting the error stream, and starting it.

    Read the article

  • Running 32bit eclipse on 64bit windows.

    - by james
    I am trying to use a 32bit installation of eclipse on my 64bit windows machine. I have eclipse extracted to my C: Drive and Java installed in ProgramFiles(x86) When I go to start eclipse I get the error:Failed to load the JNI shared Library"C:Program Files(x86)\Java\jre6\bin\jvm.dll" I looked and the file is not there. I am setting something up wrong?Just did a fresh install of Java before trying to run eclipse.

    Read the article

  • sybase ase 15.0.3 64 bit install error

    - by scot
    Hi , I have a 32bit machine installed with 64 bit suse10 linux. I then tried installing a 64bit sybase on it but the sybase installation fails the moment i launch ./setup with below error: Unhandled error...try running with is:debug system property. the install shield wizard fails to launch.. I tried replacing the JVM folder in sybase installation dump but it doesn't help. how do i use this is:debug property? has any one encountered such an error?

    Read the article

  • How can I connect to weblogic JMX via an SSH tunnel?

    - by Zubair
    I am trying to connect to weblogic via an SSH tunnel. When I connect to the web interface it works fine, but when I try to connect via JMX I get the message: javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://127.0.0.1:7001: Bootstrap to 127.0.0.1/127.0.0.1:7001 failed. It is likely that the remote side declared peer gone on this JVM] Does anyone know what this means?

    Read the article

  • tomcat 6 start mode setting for production [windows]

    - by Ryan Fernandes
    Tomcat 6 (as a windows service) seems to have a 'Start Mode' with options of 'java, jvm or exe' which can be set via the Tomcat Monitor (system tray icon). if I set this to 'java', I can see a forked 'java.exe' process for tomcat, if I chose either of the other two, I dont see a separate process. Anyway, would like to know if anyone has any information about what these settings mean and which one would be most appropriate in production.

    Read the article

  • tomcat 6 start mode setting for production

    - by Ryan Fernandes
    Tomcat 6 (as a windows service) seems to have a 'Start Mode' with options of 'java, jvm or exe' which can be set via the Tomcat Monitor (system tray icon). if I set this to 'java', I can see a forked 'java.exe' process for tomcat, if I chose either of the other two, I dont see a separate process. Anyway, would like to know if anyone has any information about what these settings mean and which one would be most appropriate in production.

    Read the article

  • Tomcat+BlazeDS+AMF - first response is VERY slow, config issue?

    - by beynar
    Hi, My web server container is Tomcat 6.0.14 JVM 1.6.0_17-b04 BlazeDS 3.2.0.3978 Im sending request from the same local machine via AMF to BlazeDS server and only first request takes about 10secend to proceed. Each next request is preceeding correctly (very fast, less than 0.5s). Anyone know what's the reason of soo slow responsing? I'm a developer, not administrator so please be patient :)

    Read the article

  • How to determine JAVA_HOME on Debian/Ubuntu?

    - by Witek
    On Ubuntu it is possible to have multiple JVMs at the same time. The default one is selected with update-alternatives. But this does not set the JAVA_HOME environment variable, due to a debian policy. I am writing a launcher script (bash), which starts a java application. This java application needs the JAVA_HOME environment variable. So how to get the path of the JVM which is currently selected by update-alternatives?

    Read the article

  • What could cause this Java UnsatisfiedLinkError?

    - by ahlatimer
    The first part of the stack-trace is as follows: "UnsatisfiedLinkError (/usr/lib/jvm/java-1.5.0-sun-1.5.0.19/jre/lib/i386/libawt.so: libmlib_image.so: cannot open shared object file: No such file or directory):" Both libawt.so and libmlib_image.so exist and are in the same directory. Does libawt.so look in a different directory? Is there an environment option I'm missing? This is part of a Rails application using Rjb (ruby-java bridge). Any help is much appreciated.

    Read the article

  • which linux flavour should I use to for my hosting server?

    - by rabbit
    Hi, We plan to host our website on a linux server. The site is created using java based technologies and will run on multiple instances of tomcat with apache in the front. I want to go in for a 64 bit linux OS so that I can install 64bit jvm. So my options are : Ubuntu Fedora CentOS which one (and which version) would be the most stable?

    Read the article

  • New on the Java Channel: Low-Latency Applications, JavaFX on Raspberry PI, and more

    - by terrencebarr
    If you haven’t checked out the Java YouTube channel lately … here is some of the stuff you’re missing: Understanding the JVM and Low Latency Applications (picture) JavaFX on the Raspberry Pi 55 New Java 7 Features: Part 3 – Concurrency Properties and Binding with JavaFX 2 Intro And something fun & cool: Java @ Maker Faire 2012 Much more on the Java Channel. Enjoy! Cheers, – Terrence Filed under: Mobile & Embedded Tagged: Embedded Java, Java 7, Java Channel, Java Embedded, JavaFX, Maker Faire, Raspberry Pi, video, webcast, YouTube

    Read the article

  • Error in destroying object in Box2D/LibGDX

    - by Crypted
    I'm trying to delete an object when a collision happens. I have put the following code in the render method of the object so it would be outside of the physics calculations. public void render(SpriteBatch spriteBatch) { // some other code... body.setActive(false); body.getWorld().destroyBody(body); But I'm getting an run-time error which crashes the JVM and shows, AL lib: alc_cleanup: 1 device not closed Assertion failed! Program: C:\Program Files\Java\jre6\bin\javaw.exe File: /var/lib/hudson/jobs/libgdx-git/workspace/gdx/jni/Box2D/Dynamics/b2World.cpp, Line 133 Expression: m_bodyCount 0 Can anyone help me here?

    Read the article

  • IntelliJ IDEA 10 est-il « l'EDI Java le plus intelligent » ? Sa nouvelle version met en avant Android, Spring et GWT

    IntelliJ IDEA est-il « l'IDE Java le plus intelligent » ? Sa version 10 met en avant Android, Spring et GWT JetBrains est une entreprise de conception de logiciels connue pour son environnement de développement intégré ? et primé - Java IntelliJ IDEA. L'IDE vient de sortir officiellement hier en version 10. Une version majeure grâce à une série de nouvelles fonctionnalités, y compris dans son édition gratuite. La plus importante étant certainement le support d'Android. JetBrains décrit son IDE d'outil de « développement polyglotte basé sur JVM ». La version 10 apporte de nombreuses améliorations aux nombreuses technologies et structures qu'il s...

    Read the article

  • JBoss AS Performance Tuning de Francesco Marchioni, critique par Gomes Rodrigues Antonio

    Bonjour, Vous pouvez trouver sur http://java.developpez.com/livres/?p...L9781849514026 la critique de l'excellent livre "JBoss AS Performance Tuning" [IMG]http://images-eu.amazon.com/images/P/184951402X.01.LZZZZZZZ.jpg[/IMG] Comme il couvre plus que seulement le tuning de JBoss, je préfère mettre cette discussion ici A propos du livre, il couvre la création d'un test de charge avec Jmeter, le tuning de JBoss, le profiling de l'application et de la JVM, de l'OS ... Il se lit plutôt bien et on y trouve pas mal d'informations Si vous avez un avis sur ce livre, je serais intéressé de le connaitre...

    Read the article

  • Tuning GlassFish for Production

    - by arungupta
    The GlassFish distribution is optimized for developers and need simple deployment and server configuration changes to provide the performance typically required for production usage. The formal Performance Tuning Guide provides an explanation of capacity planning and tuning tips for application, GlassFish, JVM, and the operating system. The GlassFish Server Control (only with the commercial edition) also comes with Performance Tuner that optimizes the runtime for optimal throughput and scalability. And then there are multiple blogs that provide more insights as well: • Optimizing GlassFish for Production (Diego Silva, Mar 2012) • GlassFish Production Tuning (Vegard Skjefstad, Nov 2011) • GlassFish in Production (Sunny Saxena, Jul 2011) • Putting GlassFish v3 in Production: Essential Surviving Guide (JeanFrancois, Nov 2009) • A GlassFish Tuning Primer (Scott Oaks, Dec 2007) What is your favorite source for GlassFish Performance Tuning ?

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >