Sun's Unsafe Class

First up I'm wondering why we aren't allowed to use this class. That is how they got all the buffer's to work in NIO without making JNI calls. Second question is why is there no source code or documentation on this class. My third question is, is there anyone that know how to use this class? I'm getting a security exception when I try and run my code. I'll post the code if anyone wants to see it. Thanks for anyone's help.

I wrote this little hack to experiment with Unsafe, have fun!
import sun.misc.Unsafe;
import java.lang.reflect.Field;
public class UnsafeDemo {
public static void main(String[] args) throws Exception {
  Unsafe unsafe = getUnsafe();
  System.out.println("Unsafe = " + unsafe);
  System.out.println("  addressSize() = " + unsafe.addressSize());
  System.out.println("  pageSize() = " + unsafe.pageSize());
  System.out.println("  pageSize() = " + unsafe.pageSize());
  unsafe.putByte((long)0xa000, (byte)47);
public static Unsafe getUnsafe() throws Exception {
  Unsafe unsafe = null;
  try {
   Class uc = Unsafe.class;
   Field[] fields = uc.getDeclaredFields();
   for (int i = 0; i < fields.length; i++) {
    if (fields.getName().equals("theUnsafe")) {
fields[i].setAccessible(true);
unsafe = (Unsafe) fields[i].get(uc);
break;
catch (Exception ignore) {}
return unsafe;

Similar Messages

  • Java.lang.OutOfMemoryError  at sun.misc.Unsafe.allocateMemory(Native Metho

    Hi All,
    I have noticed the below OOM exception in one of my TCP Node. This OOM didn't cause the JVM to crash. The JVM seems to be running and The node seems to be part of the Cluster. However this TCP node is not receiving and request and not logging anything since the error.
    Has anyone experinced this exception/behaviour with JVM/coherence ?
    Regards
    S
    An exception occ
    urred while encoding a Response for Service=Proxy:ExendTcpProxyService:TcpAcceptor: java.lang.OutOfMemoryError
    at sun.misc.Unsafe.allocateMemory(Native Method)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor$BufferPool.instantiateResource(TcpAcceptor.CDB:8)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor$BufferPool.acquire(TcpAcceptor.CDB:25)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor$BufferPool.allocate(TcpAcceptor.CDB:3)
    at com.tangosol.io.MultiBufferWriteBuffer.advance(MultiBufferWriteBuffer.java:903)
    at com.tangosol.io.MultiBufferWriteBuffer.write(MultiBufferWriteBuffer.java:311)
    at com.tangosol.io.AbstractWriteBuffer.write(AbstractWriteBuffer.java:110)
    at com.tangosol.io.AbstractWriteBuffer$AbstractBufferOutput.writeBuffer(AbstractWriteBuffer.java:1276)
    at com.tangosol.io.MultiBufferWriteBuffer$MultiBufferOutput.writeBuffer(MultiBufferWriteBuffer.java:648)
    at com.tangosol.io.pof.WritingPofHandler.onOctetString(WritingPofHandler.java:637)
    at com.tangosol.io.pof.PofBufferWriter.writeBinary(PofBufferWriter.java:602)
    at com.tangosol.io.pof.PofBufferWriter.writeObject(PofBufferWriter.java:1329)
    at com.tangosol.io.pof.PofBufferWriter$UserTypeWriter.writeObject(PofBufferWriter.java:2092)
    at com.tangosol.io.pof.PofBufferWriter.writeMap(PofBufferWriter.java:1739)
    at com.tangosol.io.pof.PofBufferWriter.writeObject(PofBufferWriter.java:1421)
    at com.tangosol.io.pof.PofBufferWriter$UserTypeWriter.writeObject(PofBufferWriter.java:2092)
    at com.tangosol.coherence.component.net.extend.message.Response.writeExternal(Response.CDB:15)
    at com.tangosol.coherence.component.net.extend.Codec.encode(Codec.CDB:23)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.encodeMessage(Peer.CDB:23)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.peer.acceptor.TcpAcceptor.encodeMessage(TcpAcceptor.CDB:8)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.send(Peer.CDB:16)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer.post(Peer.CDB:23)
    at com.tangosol.coherence.component.net.extend.Channel.post(Channel.CDB:25)
    at com.tangosol.coherence.component.net.extend.Channel.send(Channel.CDB:6)
    at com.tangosol.coherence.component.net.extend.Channel.receive(Channel.CDB:55)
    at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Peer$DaemonPool$WrapperTask.run(Peer.CDB:9)
    at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
    at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:63)
    at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
    at java.lang.Thread.run(Thread.java:619)

    So there are 2 parallel approaches to tackle this
    1) Try to figure out if your objects being exchanged are large and if there are bursts of traffic. i.e is the size of your nio buffer sufficient to handle your load. If so, check if the node doing the processing is unable to deal with events in a timely manner.
    2) Open a ticket. What I heard from training is that in 3.5 coherence should have started choking traffic to the TCP node once it recognized the nio buffers are approaching capacity. So, this is not working
    Fixing 2 will not solve 1. It will just delay the problem in my opinion.
    Bottom line is that there is too much data backlogging in the buffer, either because of unexpected bursts, or because of large objects or because of slowdown in processing in the node.

  • Jasper Reports error LINUX "sun.misc.Unsafe.ensureClassInitialized(Native "

    I have a servlet generating Reports using jasper reports. Its working perfectly on windows machine but on LINUX RHEL 4 SERVER it is throwing some error which is I am trying to tackle.
    TOMCAT :5.0.28
    JDK 1.4.2_08
    I installed the deprecated libraries for X-windows server.
    I think its JRloader which is throwing error but i have no clue how should I remove it.
    I hope someone knows this problem.
    error
    javax.servlet.ServletException
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:682)
         org.apache.jsp.Login.MCRServlet_jsp._jspService(MCRServlet_jsp.java:220)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NoClassDefFoundError
         sun.misc.Unsafe.ensureClassInitialized(Native Method)
         sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:20)
         sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
         java.lang.reflect.Field.acquireFieldAccessor(Field.java:779)
         java.lang.reflect.Field.getFieldAccessor(Field.java:760)
         java.lang.reflect.Field.getLong(Field.java:398)
         java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1478)
         java.io.ObjectStreamClass.access$400(ObjectStreamClass.java:47)
         java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:335)
         java.security.AccessController.doPrivileged(Native Method)
         java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:333)
         java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:253)
         java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:453)
         java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
         java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
         java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
         java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         java.util.ArrayList.readObject(ArrayList.java:554)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
         java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
         java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:88)
         net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64)
         ReportGenerator.ReportServlet.getCompiledReport(ReportServlet.java:210)
         ReportGenerator.ReportServlet.doPost(ReportServlet.java:55)
         ReportGenerator.ReportServlet.doGet(ReportServlet.java:39)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    jaumev wrote:
    I have exactly th e same problem.
    Have someone solved it?
    Thanks in advancePlease, don't resurrect old threads. Start a new thread if you have a specific question. I'm locking this one.
    Kaj

  • Documentation of sun.awt.shell-classes?

    Hi,
    I am searching for the api of any sun.-classes.
    Where i can find this?
    regards
    Olek

    But it is not bad for the user to understand the art
    of working of the classes when part of this is not
    documented?It is bad. Knowing what every little tidbit does is a breach in encapsulation, makes you possibly rely on implementation instead of interfaces/contracts, and even (although on a different level) Fred Brooks himself realized later that "all information to everybody" doesn't work or is even helpful.
    In other words: using a black-box approach is delegation, "knowing what everything does" is micromanagement.

  • How to find sun/applet/AppletViewer class?

    Hello, everyone,
    I have successfully deployed Form Server Applications in several
    ways as following:
    1. Using Jinitiator 1.1.7.11 plug in to run Forms inside Web
    browser in Windows 98 OS &IE4.0 SP1.
    2. In Windows 98 OS DOS Command prompt line,using Appletviewer
    to run remote NT
    Server's Forms application with format: C:\>Appletview
    http://appserver:9999/webhtml/example.html. The
    form runs smoothly in a AppletViewer window.
    3. In NT4.0 OS SP3, run form inside IE4.0 SP1 browser without
    Jinitiator 1.1.7.11 plug in program, but I
    must set CLASSPATH Env variable including
    C:\ORANT\JDK\LIB\CLASSES.ZIP & C:\ORANT\FORMS60\JAVA, or else
    the error message shows: class no found:sun/applet/appletviewer.
    But I even encounter some problem:
    1. In the above first way, jinit.exe(Jinitiator 1.1.7.11
    version) can not run in my NT4.0 SP3 OS. So the
    above first way of running Form can only succeed in my Windows98
    OS. Has anybody installed jinit.exe
    successfully in NT4.0 SP3?
    2. In the above third way, I try to run Form inside my IE4.0 SP1
    in Windows98 OS. I tried to set the
    CLASSPATH correctly as above describled, but I failed. I always
    got the above mentioned error message. I
    don't know why in windows98 the appletviewer class can not be
    found but in NT it can.
    Anyone can help me out? Thanks in advance.
    Robby
    null

    but problem is:
    the class name is a string "JFrame", which is
    how to solve the problem?It is simply not possible.
    If you have javax.swing.JFrame, you can use Class.forName(). But then you've already got the package.
    Beyond that, if you've ever decompiled code, you'd have seen that import statements don't exist in bytecode and all class references are by their full names. There is no facility in java to get the list of loaded classes, or to search for a class this way

  • Over-riding the class javax.faces.context.FacesContext: SUN App Server 9.1

    The method to over ride the faces context has changed between SUN Application Server 8.2 and 9.1, as a result the instructions which were previously provided on the MyFaces wiki (http://wiki.apache.org/myfaces/Installation_and_Configuration) no longer work. What I am looking for is instructions that will allow me to use our own faces jars and not (javaee.jar) which is provided as part of the application server.
    What I need to do is to get Sun Application Server 9.1 to allow me to over ride the faces context /javax/faces/context/ with that from my local jars, in version 8.X the following steps were enough:
    Start 8.X instructions:
    1. Change the config security file so that MyFaces <http://wiki.apache.org/myfaces/MyFaces> can delete it's temporary files.
    Change permission
        java.io.FilePermission <http://wiki.apache.org/myfaces/FilePermission> "<<ALL FILES>>", "read,write";to
      java.io.FilePermission <http://wiki.apache.org/myfaces/FilePermission> "<<ALL FILES>>", "read,write,delete";2. Prevent the sun reference implementation from being used
    In your WEB-INF, create a sun-web.xml file containing
        <?xml version="1.0" encoding="UTF-8"?>
        <sun-web-app>
        <class-loader delegate="false"/>
        </sun-web-app>3. That way, myfaces classes will be loaded instead of Sun RI ones.
    And prevent MyFaces <http://wiki.apache.org/myfaces/MyFaces> from loading the Sun RI context listener
    By creating in your webapp a "fake"
    com.sun.faces.config.ConfigureListener
    <http://wiki.apache.org/myfaces/ConfigureListener> that will be loaded BEFORE the sun RI one's.
    The war file I am making available as a test case has just such a file in my case it is called fakefaces.jar
    End instructions for 8.2
    However these steps have changed for version 9.1 as following the exact same procedures does not result in the Application Server using the correct jars, the following is a test using a simple find.jsp, notice how Application Server 9.1 is still using the default jars and not the ones shipping with included as part of my testApp.
    Within the war file is a jsp called find.jsp using this I can check which jar file file is being used for any class in my case I'm interested in the the /javax/faces/context/FacesContext.class, in 9.1 it always uses teh copy from javaee.jar and never teh local copy:
    For example running: http://<ip address>:<port>/test/find.jsp?class=javax.faces.context.FacesContext
    Version 9.1 returns: file:/u01/software/Apps/SunAppServer9.1/lib/javaee.jar!/javax/faces/context/FacesContext.class
    Version 8.2 returns: file:/u01/software/Apps/SunAppServer8.2/domains/domain1/applications/j2ee-apps/TestApp/test_war/WEB-INF/lib/myfaces-api.jar!/javax/faces/context/FacesContext.class
    Hence 9.1 is still using the copy provided by SUN and not our copy.
    The code for find.jsp is:
    <%
        String className = request.getParameter("class");
        Class theClass;
        try
            theClass = Class.forName(className);
            java.net.URL url = theClass.getResource("/" + theClass.getName().replace('.', '/') + ".class");
            out.println(url.getFile());
        catch (ClassNotFoundException e)
            // TODO Auto-generated catch block
            out.println(e);
    %>-------------------------------------------------
    Any idea how to over-ride the FacesContext class in version 9.1 to allow for similar functionality as 8.X
    Thanks,
    ERIC GANDT

    Alright, I've narrowed it down to my Customization Class. I attempted to have my customization class PortalCC in a JAR file, excluded it from the WAR file and added the JAR in the lib directory of the EAR file, as described on:
    http://docs.oracle.com/cd/E23943_01/web.1111/e16272/deploy_java_ee_app.htm#CHDGGFEB

  • NoClassDefFoundError in Unsafe.ensureClassInitialized

    Hi all
    I am getting a NoClassDefFoundError thrown by sun.misc.Unsafe.ensureClassInitialized(), but there is no indication of which class is not found (getMessage() returns null).
    Can anyone tell me how to find out which class it cannot find ?

    Sorry, that was not the original de-serializing error. This is...
    java.lang.NoClassDefFoundError
         at sun.misc.Unsafe.ensureClassInitialized(Native Method)
         at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:20)
         at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
         at java.lang.reflect.Field.acquireFieldAccessor(Field.java:779)
         at java.lang.reflect.Field.getFieldAccessor(Field.java:760)
         at java.lang.reflect.Field.getLong(Field.java:398)
         at java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1478)
         at java.io.ObjectStreamClass.access$400(ObjectStreamClass.java:47)
         at java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:335)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.io.ObjectStreamClass.(ObjectStreamClass.java:333)
         at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:253)
         at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:453)
         at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
         at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         at java.util.ArrayList.readObject(ArrayList.java:547)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
         at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
         at dori.jasper.engine.util.JRLoader.loadObject(JRLoader.java:134)
         at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:288)
         at dori.jasper.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:281)
         at com.obas.servlets.ReportManager.runReport(ReportManager.java:169)
         at com.obas.servlets.MainServlet.doReport(MainServlet.java:338)
         at com.obas.servlets.MainServlet.doPost(MainServlet.java:293)
         at com.obas.servlets.MainServlet.doGet(MainServlet.java:199)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:457)
         at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:576)
         at java.lang.Thread.run(Thread.java:534)

  • Java Class and JSP file

    Hi everyone,
    I build a class in java, and now i wanna use this class in my jsp file.
    I put that class into web-inf/classes in Apache Tomcat, but don't work.... Anyone can help me?
    Greetings!

    Put the class with its package such as com.sun.ejb.MyClass
    -- > /WEB-INF/classes/com/sun/ejb/MyClass.class
    then use it
    http://www.skillipedia.com

  • Sun Studio 10 Linux, RHEL3 U4, install fails on openmotif21.

    Hello everyone,
    As a long-time user of Sun WorkShop... I mean Forte.. I mean Studio; it was with great anticipation that I downloader Sun Studio 10 for Linux.
    On one machine it failed to install and on another it installed properly.
    Here are the details:
    - Machine 1: RHEL3 U2 (x86/i686), small install: Installation of Studio 10 went fine.
    - Machine 2: RHEL3 U4 (x86/i686), complete install : Installation of Studio 10 failed. The following can be gathered from the logs under /var/opt/sun:
    [....snip....]
    Installing Sun Studio Software
    Log file: /var/opt/sun/install/logs/Sun_Studio_Software_install.A04060111
    Installed: /var/prod/com.sun.studio_10/uninstall_Sun_Studio_Software.class
    Uninstaller is at: /var/prod/com.sun.studio_10/uninstall_Sun_Studio_Software.class
    Standalone Tools: Building Software
    Installing RPM: sun-dmake-10.0-1
    [....snip....]
    System packages supporting Sun Studio Software
    Installing RPM: openmotif-2.1.31-2_IST
    error: Failed dependencies:
    openmotif < 2.2.2 conflicts with openmotif21-2.1.30-9.RHEL3.4
    Error: RPM openmotif-2.1.31-2_IST install failed}.
    Install complete. Package: openmotif-2.1.31-2_IST
    rpm: Skipping rpm remove of openmotif-2.1.31-2_IST, not installed.
    rpm: Skipping rpm remove of sun-svc-locale-zh-10.0-1, not installed.
    [....snip....]
    And everything is removed. Is this issue documented somewhere? Is there a workaround?
    Thanks for reading,
    Vincent

    Deselecting 'system supporting packages' from the Sun Studio 10 installation list made the trick and Studio finished installing.
    However, I have a few concerns:
    1) Since Studio will be using the system's openmotif, will it be supported? (I guess not).
    2) Since openmotif-2.1.31-2_IST.i386.rpm from the Studio 10 IDE kits lands under /usr/OpenMotif-2.1.31 and should not conflict with any kind of other/system openmotif, why didn't SUN just create a sun-openmotif-support package? This would prevent a naming conflict when trying to install on RHEL3 if RHEL's openmotif21 is already installed?
    3) It appears to work fine, even without SUN's provided openmotif.
    Cheers,
    Vincent

  • What classes are loaded into JVM? rt.jar 1.3 or 1.4?

    Hi,
    I am trying to run a stored procedure on the DB release 2.
    On Linux I get:
    OTHER EXCEPTION caught -29532 ORA-29532: Java call terminated by uncaught Java
    exception: java.lang.RuntimeException: java.lang.ClassNotFoundException:
    sun/java2d/loops/OpaqueCopyAnyToArgb
    This particular class is a part of 1.4, but not 1.3... I don't use it directly, so I am wondering where it is being referenced?
    I don't think trying to load rt.jar would be a particularly good idea. But it appears to me that there is a mix of graphics2d?
    The full stack trace is:
    java.lang.RuntimeException: java.lang.ClassNotFoundException:
    sun/java2d/loops/OpaqueCopyAnyToArgb
    at
    sun.java2d.loops.GraphicsPrimitiveProxy.instantiate(GraphicsPrimitiveProxy.java:74)
    at sun.java2d.loops.GraphicsPrimitiveMgr.locate(GraphicsPrimitiveMgr.java:222)
    at
    sun.java2d.loops.GraphicsPrimitiveMgr.locatePrim(GraphicsPrimitiveMgr.java:179)
    at sun.java2d.loops.GraphicsPrimitiveMgr.locate(GraphicsPrimitiveMgr.java:132)
    at sun.java2d.loops.Blit.locate(Blit.java:45)
    at sun.java2d.loops.Blit.getFromCache(Blit.java:59)
    at
    sun.java2d.loops.GraphicsPrimitive.createConverter(GraphicsPrimitive.java:503)
    at
    sun.java2d.loops.GraphicsPrimitive.setupGeneralBinaryOp(GraphicsPrimitive.java:473)
    at sun.java2d.loops.MaskBlit.makePrimitive(MaskBlit.java:115)
    at sun.java2d.loops.GraphicsPrimitiveMgr.locate(GraphicsPrimitiveMgr.java:139)
    at sun.java2d.loops.MaskBlit.locate(MaskBlit.java:43)
    at sun.java2d.loops.MaskFill$General.<init>(MaskFill.java:134)
    at sun.java2d.loops.MaskFill.makePrimitive(MaskFill.java:115)
    at sun.java2d.loops.GraphicsPrimitiveMgr.locate(GraphicsPrimitiveMgr.java:139)
    at sun.java2d.loops.MaskFill.locate(MaskFill.java:44)
    at sun.java2d.loops.DrawGlyphList$General.<init>(DrawGlyphList.java:76)
    at sun.java2d.loops.DrawGlyphList.makePrimitive(DrawGlyphList.java:65)
    at sun.java2d.loops.GraphicsPrimitiveMgr.locate(GraphicsPrimitiveMgr.java:139)
    at sun.java2d.loops.DrawGlyphList.locate(DrawGlyphList.java:32)
    at sun.java2d.SurfaceData.makeRenderLoops(SurfaceData.java:488)
    at sun.awt.image.BufImgSurfaceData.getSolidLoops(BufImgSurfaceData.java) at sun.awt.image.BufImgSurfaceData.initSolidLoops(BufImgSurfaceData.java)
    at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java)
    at sun.java2d.SurfaceData.getSurfaceDataFromImage(SurfaceData.java:104)
    at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:62)
    at sun.java2d.pipe.DrawImage.transformImage(DrawImage.java:137)
    at sun.java2d.pipe.DrawImage.transformImage(DrawImage.java:819)
    at sun.java2d.pipe.ValidatePipe.transformImage(ValidatePipe.java:184)
    at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2892)
    at logoUtils.insertLogo(InsertLogo:59)
    This particular procedure crashes on Windows with the following in the database alert log:
    Wed Sep 14 11:54:08 2005
    Errors in file d:\oracle\product\10.2.0\admin\orcl10gr2\udump\orcl10gr_ora_2640.trc:
    ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] [unable_to_trans_pc] [PC:0xF92D18C] [ADDR:0x4] [UNABLE_TO_READ] []

    Sounds like a bug; suggest you log a TAR.
    In the mean time, if you are feeling very adventurous, you could try loading and resolving just the missing classes. This is extremely not supported and your mileage may vary:
    % $JDKHOME/bin/jar -xf rt.jar META-INF/MANIFEST.MF
    % more META-INF/MANIFEST.MF
    Manifest-Version: 1.0
    Specification-Title: Java Platform API Specification
    Created-By: 1.4.2_04 (Sun Microsystems Inc.)
    Implementation-Title: Java Runtime Environment
    Specification-Vendor: Sun Microsystems, Inc.
    Specification-Version: 1.4
    Implementation-Version: 1.4.2_04
    Implementation-Vendor: Sun Microsystems, Inc.
    % $JDKHOME/bin/jar -xf rt.jar sun/java2d/loops/OpaqueCopyAnyToArgb.class sun/java2d/loops/OpaqueCopyArgbToAny.class sun/java2d/loops/XorCopyArgbToAny.class
    % loadjava -g public -s sun/java2d/loops/*.class
    % sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Sep 15 16:34:35 2005
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning option
    SQL> select object_name, object_type, status from all_objects where object_name in
    2 (dbms_java.shortname('sun/java2d/loops/OpaqueCopyAnyToArgb'),
    3 dbms_java.shortname('sun/java2d/loops/OpaqueCopyArgbToAny'),
    4 dbms_java.shortname('sun/java2d/loops/XorCopyArgbToAny')) and
    5 object_type = 'JAVA CLASS';
    OBJECT_NAME OBJECT_TYPE STATUS
    /302f5f36_XorCopyArgbToAny JAVA CLASS INVALID
    /f7814203_OpaqueCopyArgbToAny JAVA CLASS INVALID
    /a248592e_OpaqueCopyAnyToArgb JAVA CLASS INVALID
    SQL>
    SQL> alter java class "/f7814203_OpaqueCopyArgbToAny" resolve;
    Java altered.
    SQL> alter java class "/302f5f36_XorCopyArgbToAny" resolve;
    Java altered.
    SQL> alter java class "/a248592e_OpaqueCopyAnyToArgb" resolve;
    Java altered.
    SQL> select object_name, object_type, status from all_objects where object_name in
    2 (dbms_java.shortname('sun/java2d/loops/OpaqueCopyAnyToArgb'),
    3 dbms_java.shortname('sun/java2d/loops/OpaqueCopyArgbToAny'),
    4 dbms_java.shortname('sun/java2d/loops/XorCopyArgbToAny')) and
    5 object_type = 'JAVA CLASS';
    OBJECT_NAME OBJECT_TYPE STATUS
    /302f5f36_XorCopyArgbToAny JAVA CLASS VALID
    /f7814203_OpaqueCopyArgbToAny JAVA CLASS VALID
    /a248592e_OpaqueCopyAnyToArgb JAVA CLASS VALID
    SQL> conn scott/tiger
    Connected.
    SQL> create or replace java source named Test as
    package sun.java2d.loops;
    public class Test {
    public static String tryLoad() throws Exception {
    return Class.forName("sun.java2d.loops.OpaqueCopyAnyToArgb").getName();
    / 2 3 4 5 6 7 8
    Java created.
    SQL> create or replace function runtest return varchar2 as language java name
    'sun.java2d.loops.Test.tryLoad() return java.lang.String';
    2 3
    Function created.
    SQL>
    SQL> select runtest from dual;
    RUNTEST
    sun.java2d.loops.OpaqueCopyAnyToArgb
    If the test procedure (which forced the class to be loaded and initialized) succeeds, then you are probably in fairly good shape.

  • No need for Xerces jars since Sun includes it in the jvm?

    Hey Everybody,
    If one would like to use Xerces in a java app, why should they download it from Apache when it's included in Sun's jvm releases as of 1.4?
    I noticed that the "rt.jar" in Sun's jvm for Windows contains an apache folder: jdk1.6.0_11\jre\lib\rt.jar\com\sun\org\apache\,
    that contains the following apache folders: bcel, regexp, xalan, xerces, xml, xpath
    How does one tell what version of Xerces is being released with a particular Sun jvm release? I looked all over the Sun site - it seems they haven't documented that they are using files from Xerces. They even took the trouble of burying the "org/apache" folder down under the "com/sun" folder -- as if to hide the fact that apache is being used....maybe to take credit for it to make it look like the functionality was developed by Sun?
    Is there a chance that one could successfully compile java code that has references to Xerces classes where the developer's project does not contain Xerces jars, but instead relies on the Sun bundled xerces classes -- and while that code would compile file, there could exist runtime exceptions due to potential classes from Xerces that Sun did not include in its jvm -- while if the project did include the Xerces jars - there would be no runtime errors?
    Thanks!

    EnNuages wrote:
    Hey Everybody,
    If one would like to use Xerces in a java app, why should they download it from Apache when it's included in Sun's jvm releases as of 1.4?One reason could be because the apache one is newer and thus is better in some way.
    >
    I noticed that the "rt.jar" in Sun's jvm for Windows contains an apache folder: jdk1.6.0_11\jre\lib\rt.jar\com\sun\org\apache\,
    that contains the following apache folders: bcel, regexp, xalan, xerces, xml, xpath
    How does one tell what version of Xerces is being released with a particular Sun jvm release? I looked all over the Sun site - it seems they haven't documented that they are using files from Xerces. They even took the trouble of burying the "org/apache" folder down under the "com/sun" folder -- as if to hide the fact that apache is being used....maybe to take credit for it to make it look like the functionality was developed by Sun?
    No.
    More likely the choice of location was without thought. Or because they might want to change it or remove it.
    Is there a chance that one could successfully compile java code that has references to Xerces classes where the developer's project does not contain Xerces jars, but instead relies on the Sun bundled xerces classes -- and while that code would compile file, there could exist runtime exceptions due to potential classes from Xerces that Sun did not include in its jvm -- while if the project did include the Xerces jars - there would be no runtime errors?No. You can't compile using classes that don't exist.

  • Sun.awt.image.ToolkitImage

    Hi
    I'm integrating with a 3rd party package which delivers various images.
    These come in different objects, mostly BASE64DecoderStream and BufferedImage. But, GIF files are delivered as a ToolkitImage object.
    For the BufferedImage I do something like
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    ImageIO.write(image, "JPG", stream);and puts it in DB. I just can't figure out a way to do the same for ToolkitImage.
    My questions are:
    1. Is there a way to convert/cast the ToolkitImage so i can format/encode it and put it in DB, similar to the example above?
    2. Where is the API documentation for the internal classes in package "sun.awt.image"?
    Hope you experts can help me out here :)

    > Didn't know it could be casted to an Image.
    Do you know of any documentation on sun.awt.image in general?
    Why Developers Should Not Write Programs That Call 'sun' Packages
    The classes that Sun includes with the Java 2 SDK, Standard Edition, fall into package groups java.*, javax.*, org.* and sun.*. All but the sun.* packages are a standard part of the Java platform and will be supported into the future. In general, packages such as sun.*, that are outside of the Java platform, can be different across OS platforms (Solaris, Windows, Linux, Macintosh, etc.) and can change at any time without notice with SDK versions (1.2, 1.2.1, 1.2.3, etc). Programs that contain direct calls to the sun.* packages are not 100% Pure Java. In other words:
    The java.*, javax.* and org.* packages documented in the Java 2 Platform Standard Edition API Specification make up the official, supported, public interface.
    If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.
    The sun.* packages are not part of the supported, public interface.
    A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.
    For these reasons, there is no documentation available for the sun.* classes. Platform-independence is one of the great advantages of developing in the Java programming language. Furthermore, Sun and our licensees of Java technology are committed to maintaining backward compatibility of the APIs for future versions of the Java platform. (Except for code that relies on serious bugs that we later fix.) This means that once your program is written, the class files will work in future releases.
    Each company that implements the Java platform will do so in their own private way. The classes in sun.* are present in the SDK to support the Sun implementation of the Java platform: the sun.* classes are what make the Java platform classes work "under the covers" for the Sun Java 2 SDK. These classes will not in general be present on another vendor's Java platform. If your Java program asks for a class "sun.package.Foo" by name, it may fail with ClassNotFoundError, and you will have lost a major advantage of developing in Java.
    Technically, nothing prevents your program from calling into sun.* by name. From one release to another, these classes may be removed, or they may be moved from one package to another, and it's fairly likely that their interface (method names and signatures) will change. (From the Sun point of view, since we are committed to maintaining the Java platform, we need to be able to change sun.* to refine and enhance the platform.) In this case, even if you are willing to run only on the Sun implementation, you run the risk of a new version of the implementation breaking your program.
    In general, writing java programs that rely on sun.* is risky: they are not portable, and are not supported.
    ~

  • J2EE .class file compiling for jar, ear files.

    I know that using the former Sun/present Oracle .class java source code compiler,
    I create a platform independet class file which can be used by the java language
    on any OS environment with the appropriate Java Runtime Environment installed.
    I know that there are obfuscation tools available to prevent the .class file decompilation
    related issues.
    I have also been using the GNU gcj compiler with great success. However,
    I havn't been able to find a non-commercial purchase compiler that can create
    .class files, with the same platform independence, but that can't be easily decompiled
    based on the simple content in .class files. Can someone point me to someone on the net
    for a free for commercial development java compiler, past about 1.5.X ?

    If it were possible, don't you think Oracle would have built the compiler like that themselves?

  • Com.sun.j3d -  not in API Specification

    Where can i find the classes of this package?

    What do you mean? It's all in the Java3D javadocs, which you can download from the same place as the sdk. I don't think there are any com.sun.j3d.* classes, they are all in .utils, .loaders or .javasound.

  • Need help! Unable to follow the Sun WBT practice.(Simple program)

    Exception in thread "main" java.lang.NoSuchMethodError: main
    Due to the above error, I can't follow the Sun's WBT program. I think something is missing in my Java environment since Sun provided instruction should be correct.
    Please let me know to troubleshoot this.
    Below causes error.(Followed the Sun WBT)
    public class Customer {
         public int customerID = 0; // Default ID for the customer
         public char status = 'N'; // default
         public double totalPurchases= 0.0; // default
         // This method displays the value for an item
         public void displayCustomerInfo() {
              System.out.println("Customer ID:" +customerID);
              System.out.println("Status: " +status);
              System.out.println("Purchases: " +totalPurchases);
    } // end of display method
    } // end of the class
    Below works since I did not use WBT instruction:
    public class Customer2 {
         public static void main( String args[] ) {
         int customerID = 0; // Default ID for the customer
         char status = 'N'; // default
         double totalPurchases= 0.0; // default
              System.out.println("Customer ID:" +customerID);
              System.out.println("Status: " +status);
              System.out.println("Purchases: " +totalPurchases);
    } // end of ????( I do not know how to say here)
    } // end of the class

    public class Customer {
    public int customerID = 0; // Default ID for the customer
    public char status = 'N'; // default
    public double totalPurchases= 0.0; // default
    // This method displays the value for an item
    public void displayCustomerInfo() {
    System.out.println("Customer ID:" +customerID);
    System.out.println("Status: " +status);
    System.out.println("Purchases: " +totalPurchases);
    } // end of display method
    } // end of the class
    NOTE: IF I run the above program, it does not run due to exception. I can compile it without error. Since above coding is used in the Sun WBT course, I think I have Java environment problem. Are you able to run the above program?

Maybe you are looking for

  • Purpose of Keychain?

    What is the purpose of Keychain in Tiger? Is this intended to be a program to securely store passwords? If so, is it just for passwords that programs in mac os need, or can other passwords such as, credit card #'s and phone numbers be entered in it?

  • How do I get a photo from my mac to my iPod touch?

    How do I get a photo from my MacBook to my iPod Touch?

  • Business Content for CRM

    All, We are in the Blue Print phase of our CRM project.  During the Integration of CRM 7 EHP 1 to our BW 7 EHP 1 system we notice a parcular issue.  After executing all the necessary steps on both the CRM side and the BW side, we notice that only a h

  • Attributes for the sys event EC_DEVICE_ADD

    Hi, There are some changes in the Solaris 11 sysevent Attributes. How to know what are the attributes for the event EC_DEVICE_ADD. Earlier these were listed in dev.h now I do not find that header file on Solaris 11. -Sachin

  • Corrupted DMG

    I am having problems downloading Xcode 6 beta. Repeated attempts always result in an unable to open image - file corrupted message. This happens on both my MBP and Mac Mini so I cannot attribute to a disc problem - notheless have run disk utily to ve