WS 7.0 seemingly not honoring class-loader delegate="false"
I have a JSF web application that I ship with MyFaces jars.
I have added a sun-web.xml file in WEB-INF telling the server not to delegate class loading to its parent classloader.
However, it seems that the server chooses to use the JSF implementation that comes with the server (lib/jsf-api.jar and lib/jsf-impl.jar).
Of course, the exact same application worked perfectly with WS 6.1 (but JSF was not included in the server distribution).
Is there something I am missing?
Here is a sample index.jsp I use to determine where my classes come from.
When I type something like "javax.faces.FactoryFinder" it finds the class in
Classloader: sun.misc.Launcher$AppClassLoader@1ba34f2
URL=jar:file:/C:/soft/SunWebServer7/lib/jsf-api.jar!/javax/faces/FactoryFinder.class
This is not what I expected, since I embedded an alternate JSF implementation in my web application.
Strangely enough, when I embed, say, ant in my webapp, it's the right class that is found, not the one in the lib/ directory on the server.
Does JSF have a special status?
<%@page contentType="text/html; charset=ISO-8859-1"%>
<%@page import="java.net.URL"%>
<%@page import="java.io.ByteArrayOutputStream"%>
<%@page import="java.io.PrintStream"%>
<html>
<head>
<title>Test Sun Server 7.0</title>
</head>
<body>
Only a static text.
<br>
<form>Resource:<input type="text" name="classname"></input><br>
<input type="submit"></input><br>
</form>
<%
String us = "<null>";
String c = "<null>";
try {
c = request.getParameter("classname");
Class cl = Class.forName(c);
out.println("Classloader: " + cl.getClassLoader() + "<br>");
String[] parts = c.split("\\.");
String small = parts[parts.length - 1];
URL u = cl.getResource(small + ".class");
us = u.toString();
} catch (Throwable t) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
PrintStream o = new PrintStream(baos);
t.printStackTrace(o);
o.flush();
o.close();
us = baos.toString();
us = us.replaceAll("\\n", "<br>");
%>
<br>
<br>
CLASS=<%=c%><br>
URL=<%=us%><br>
</body>
</html>
Similar Messages
-
class-loader delegate="true"/
Does the above mean,
A) I will try to find every thing in my web-inf/classes, web-inf/lib directories FIRST, IF NOT FOUND, go up the chain
B) Always go up the chain, even if what I am looking for is in my web-inf/classes or web-inf/lib directoriesThanks. I may be missing some thing.
The stateless-simple application(EAR) in the samples diretory, contains a WAR and a EJB-JAR. The EJB_JAR is also inside the web-inf/lib directory of the WAR. In that scenario, why do we have <class-loader delegate="true" /> in the web-inf.xml ?
I seem to consistently get a classloader exception if I do NOT have <class-loader delegate="true" /> in the web-inf.xml!
Thanks
Sunil -
What means class-loader delegate=
Hello:
What means <class-loader delegate="true"/> tag into sun-web.xml ?
And if the 'delegate' value is 'false' ?
Where can I find information about this property ?
Thanks a lot in advance
Best regardsThanks.
I'm working with SUN ONE AS 7, and I found its equivalent link
http://docsun.cites.uiuc.edu/sun_docs/C/solaris_9/SUNWadoc/SONEAPPSVRWEBAPP/dwdeploy.html#66152
The problem is that I have to include this tag for my WAR file for all works fine, but isn't a Web Service ( as documentation says )
This WAR calls EJB components in another server instance, being a IIOP client.
If I don't write this tag, some libraries ( Ibatis jars) have problems to load instaces dynamically ( with new Instance() ). This problem is a ClassCastException
This libraries are stored into <server-instance>/lib directory , and not into WEB-INF/lib
Indedd, if I store them into WEB-INF/lib, and not into <server-instance>/lib, same exception happens.
Classloaders are common for all server instance or every server instance has own classloaders hierarchy ?
Does anynone know why I have to delegate to parent classloader ( EJB classloader ) to find jars stored into <server-instance>/lib ?
Thanks a lot in avance
Best regards -
Seemingly random errors (Class Loading)
Hi,
I wonder if anyone out there could help me or point me in the right direction to solve this problem im having.
For a Uni project I am writing a Java application that takes three components stored in seperate Jar files (GUI, AI, and Model) dynamically from user defined locations by a central loading class.
eg GUIAddress = "c:/java/guis/gui.jar"
Each has a loading class defined in a MANIFEST.MF file within each Jar file and these are in turn defined by interfaces within my central loading program.
I have set it out like this to allow me to quickly test out different components without changing the main structure of the program.
The problem im having is that I keep getting different ClassFormatErrors depending on what I have changed. Errors include:
Local variable name has bad constant pool index
Extra bytes at the end of the class file
Code segment has wrong length
Illegal constant pool index
Code of a method has length 0All these errors are produced with the same compiler (JRE1.4.2) and with minimal changes to the source code.
For example I get the program to a stage where it works then add the un-used constant to a classprivate int foobar = 10; recompile and reload and i get the error Extra bytes at the end of the class file if I take it out again recompile and rerun and alls better.
Now to me that one line shouldnt make a differene to the program in any significant way. But anyway thats just a small example to show you what my problem is.
These problems started when i made a class Span (http://rex.homeip.net/~matt/java/gui/src/gui/graphs/Span.java) which as you can see does nothing special, but when i use it from another class (http://rex.homeip.net/~matt/java/gui/src/gui/GraphViewer.java) all hell breaks loose. Now i know the class is being loaded and methods can be called from it (line 84) but if i try to call setSpan() then i get the error Local variable name has bad constant pool indexIf anyone has any clues please let me know, im getting sick of going round in circles.
Cheers in advance.
Matt
links
Main loading class: http://rex.homeip.net/~matt/java/loader/src/loader/Loader.java
Class Loader: http://rex.homeip.net/~matt/java/loader/src/loader/setup/SetupManager.java
GUI: http://rex.homeip.net/~matt/java/gui/src/gui/Gui.java
GraphViewer: http://rex.homeip.net/~matt/java/gui/src/gui/GraphViewer.java
Span: http://rex.homeip.net/~matt/java/gui/src/gui/graphs/Span.javaI think I have the solution....
I had the same exact (seemingly random) ClassFormatExceptions being thrown from my custom Class-Loader as well. I would get the same variety of debug prints as you (Invalid constant pool, Code segment has wrong length, etc). At times it seemed to happen randomly to different classes that I loaded, depending on small changes I made to the code.
Here is the background and how I solved it.
I dervied from ClassLoader to make my custom class-loader. I overrode the findClass() method, and NOT the loadClass() method. This is the Java 2 method of making class-loaders, which is simplier than implementing your own loadClass() as in the older Java 1.1way of doing things.
My custom class-loader (called JarFileClassLoader, BTW) already had a list of JAR files that it searched when its findClass() method was called from its parent. I was using a JarFile object to examine the contents of a particular JAR file. Once it found the JarEntry that represented the class I wanted to load, it asked for the InputStream by calling:
JarEntry desiredEntry = // assigned to the JarEntry that represents the class you want to load
InputStream myStream = myJar.getInputStream( desiredEntry );
Then I asked how many bytes were available for reading, I created a byte array that could hold that many bytes, and I read the bytes from the InputStream:
int totalBytes = myStream.available();
byte[] classBytes = new byte[totalBytes];
myStream.read( classBytes );
Finally, I would define and resolve my class by:
Class loadedClass = super.defineClass( className, classBytes, 0, classBytes.length );
resolveClass( loadedClass );
Sometimes, on the call to defineClass(), I would get all the weird ClassFormatExeptions.
After the searching around these forums for a while, I found a lot of discussion about this problem, but I didn't find any concrete explanations or solutions. But I did see some cursory discussion about the InputStream class. This lead me to investigate how this class works exactly.
As it turns out, when you call:
myStream.read( classBytes );
it is NOT guaranteed to read all the available bytes and completely fill the byte array you made for it. It could very easily read LESS than the total available bytes. I don't know why it would do this...maybe something to do with internal buffering of the stream. This happens more often on bigger sized class files that you are trying to read.
The read() call will return an integer that represents the actual number of bytes read during that attempt to read. So, the solution is to check if you got all your bytes during the first call to read(), if not, then read some more.
There is another version of the read() method that takes an 'offset' value into your array and a max bytes to read value. I used this method to modify my code to look like:
int total = myStream.available();
int numNeeded = total;
int numRead = 0;
int offset = 0;
byte[] classBytes = new byte[total];
do
numNeeded -= numRead;
offset = numRead;
numRead += inStream.read( classBytes, offset, numNeeded );
} while( numRead < total );
This will continue looping until all the bytes are read. Then I never got those funky ClassFormatExceptions again. Before my fix, I was getting partial class definitions from calls to read() that didn't return all the bytes. Depending on which part of the class was omitted, I got the varied error prints that you got. Now, after this fix, it seems to work just fine.
Hope this helps!
-Mark -
Help Needed on a similar but not same class loader problem
Hi,
Please help...
There is a ClassLoader called MyLoader that overrides default findClass() method to decrypt already encrypted class files available in a separate jar file.
MyClass also contains a public static method launchMe() method that starts off with a call similar to loadClass("ApplicationMainClass");
The MyLoader class is also encrypted
I modified the default launcher (c) code to:
First find the encrypted MyLoader file then decrypt it and create a byte array.
The byte array, along with the system class loader and other required arguments, is passed to DefineClass native method (defined in jvm.dll)
Note: The system class loader class has been instantiated using static method ClassLoader.getSystemClassLoader() through Java's invocation API.
The DefineClass succeeds and I'm able to instantiate MyLoader and later call launchMe() to start application.
Now i come to the problem:
I'm not able to use any class other that those in rt.jar (i.e.standard classes) in MyLoader class. I end up with a runtime error ClassDefNotFoundError while trying to load any third party jar.
The classes i need are present in class path and also in the local jre's ext that i use to launch my app.
Although i can avoid using third party jar in MyLoader but if there is any way...
Piyushmake sure that third party jar resides in your library.....
or else put rt.jar and external jars under same folder
this is matter of path.... no else than this.......
cheers
Rajesh42 -
SJSAS 8.2 EJB class loader
Hello,
I did not found how to set the class loader to parent last for EJBs.
I have an EAR with a WAR and 2 EJBs, for the WAR I've added :
<class-loader delegate="false"/>in the sun-web.xml descriptor, but I don't know how to do it in my JARs.
I think I have a conflict between the Xerces version used by Sun AS and the one embbeded in my EAR.
Any advice ?The servlet specs recommends that the web class loader looks locally before delegating it to the parent. Thus there is a provision of a paramenter which can be configured.
Did u try putting it ib by editing the classpath-suffix attribute of the java-config element in the domain.xml file. But now this will be available to all the applicatuons across the domain. -
Image seems not loading in servlet running in tomcat 4 ... (win xp)
This servlet basically takes a images file do some scaling then send out as outputstream.
BUT the image dun since to load ... i keep getting a -1 for the width n height of the image .... seems that image cant load in tomcat....
Is it something wrong wif my code or is there a bug in tomcat....
Can someone help thanks
This is the servlet code:
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.net.*;
import java.awt.*;
import java.awt.image.*;
public class ImageOperater extends HttpServlet
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException
{ System.out.println("Start of post");
OutputStream out = null;
try{
out = res.getOutputStream();
catch(Exception e)
e.printStackTrace();
System.out.println("Start of imageprocessing");
//image processing
Image img = Toolkit.getDefaultToolkit().getImage("images/peppers.png");
ImageFilter imf = new CropImageFilter(0,0,200,200);
ImageProducer ip = new FilteredImageSource(img.getSource(),imf);
img = Toolkit.getDefaultToolkit().createImage(ip);
img =img.getScaledInstance(500,-1,Image.SCALE_AREA_AVERAGING);
//image processing finish
//check if the image is fully loaded
System.out.println("Start of image loading");
MediaTracker mediaTracker = new MediaTracker(new Container());
mediaTracker.addImage(img, 0);
try{
mediaTracker.waitForID(0);
System.out.println(mediaTracker.checkAll());
System.out.println("thread sleep");
Thread.sleep(1000);
catch(Exception e)
e.printStackTrace();
try{
mediaTracker.waitForID(0);
System.out.println(mediaTracker.checkAll());
System.out.println("thread sleep");
Thread.sleep(1000);
catch(Exception e)
e.printStackTrace();
//image fully loaded
System.out.println("Start of buffered image ");
System.out.println("width"+img.getWidth(null)+" Height "+img.getHeight(null));
//preparing the buffered image to be send
BufferedImage bimg = new BufferedImage(img.getWidth(null),img.getHeight(null),BufferedImage.TYPE_INT_RGB);
Graphics gr = bimg.getGraphics();
gr.drawImage(img, 0, 0, null);
gr.dispose();
//finished preparing
//ig = Toolkit.getDefaultToolkit().createImage(bimg.getSource());
System.out.println("Start of sending");
//send out to client
try{
ImageIO.write((RenderedImage)bimg,"png",new File("c:\\test.png"));
ImageIO.write((RenderedImage)bimg,"png",out);
catch(Exception e)
e.printStackTrace();
try{
out.flush();
out.close();
catch(Exception e)
e.printStackTrace();
System.out.println("post ended");
but if the same code is put into an applet it works ... thw getWidth() and getHeight() returns the correct value:
Image img = Toolkit.getDefaultToolkit().getImage("images/peppers.png");
ImageFilter imf = new CropImageFilter(0,0,200,200);
ImageProducer ip = new FilteredImageSource(img.getSource(),imf);
img = Toolkit.getDefaultToolkit().createImage(ip);
img =img.getScaledInstance(500,-1,Image.SCALE_AREA_AVERAGING);
//image processing finish
//check if the image is fully loaded
System.out.println("Start of image loading");
MediaTracker mediaTracker = new MediaTracker(new Container());
mediaTracker.addImage(img, 0);
try{
mediaTracker.waitForID(0);
System.out.println(mediaTracker.checkAll());
System.out.println("thread sleep");
Thread.sleep(1000);
catch(Exception e)
e.printStackTrace();
try{
mediaTracker.waitForID(0);
System.out.println(mediaTracker.checkAll());
System.out.println("thread sleep");
Thread.sleep(1000);
catch(Exception e)
e.printStackTrace();
//image fully loaded
System.out.println("Start of buffered image ");
System.out.println("width"+img.getWidth(null)+" Height "+img.getHeight(null));
//preparing the buffered image to be send
BufferedImage bimg = new BufferedImage(img.getWidth(null),img.getHeight(null),BufferedImage.TYPE_INT_RGB);
Graphics gr = bimg.getGraphics();
gr.drawImage(img, 0, 0, null);
gr.dispose();
//finished preparing
//ig = Toolkit.getDefaultToolkit().createImage(bimg.getSource());
System.out.println("Start of sending");
//send out to client
try{
ImageIO.write((RenderedImage)bimg,"png",new File("c:\\test.png"));hi ganttan
first you have to make sure your server is running xwindow. in most cases a linux/apache server does not run it by default. then there is a much simpler approach of scaling images with a servlet:
Iterator readers = ImageIO.getImageReadersByFormatName("gif");
ImageReader reader = (ImageReader)readers.next();
ImageInputStream iis = ImageIO.createImageInputStream(new File(path));
reader.setInput(iis, true);
ImageReadParam param = reader.getDefaultReadParam();
param.setSourceRenderSize(new Dimension(width, height));
BufferedImage thumbnail = reader.read(0, param);
ImageIO.write(thumbnail, "gif", response.getOutputStream());
however this does not work for jpeg images. use setSourceSampling() instead of setSourceRenderSize() in this case but unfortunately it's limited and you can not scale to any size. -
Could not find or load main class weblogic.WLST
Hi,
I am trying to run a python script to create JMS components for use with iHub and i got the following error message when i try to run the script:
C:\ihub\bin>java weblogic.WLST omipmihubwlscript.py weblogicjms Welcome1 http://<servername>:7111 OMIPMIHUBServer
Error: Could not find or load main class weblogic.WLST
I have run the setWLSEnv.cmd file and got the following output
C:\oracle\Middleware2\wlserver_10.3\server\bin>setWLSEnv.cmd
CLASSPATH="C:\oracle\MIDDLE~2\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\oracle\MIDDLE~2\patch_ocp371\profiles\default\sys_manifest_classpath\weblogic_p
atch.jar;C:\PROGRA~1\Java\JDK17~1.0_1\lib\tools.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\weblogic_sp.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\weblogic.jar;C:\oracle\MIDDLE~2\mod
ules\features\weblogic.server.modules_10.3.6.0.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\webservices.jar;C:\oracle\MIDDLE~2\modules\ORGAPA~1.1/lib/ant-all.jar;C:\oracle\MIDDLE~2\modu
les\NETSFA~1.0_1/lib/ant-contrib.jar;C:\oracle\MIDDLE~2\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\oracle\MIDDLE~2\patch_ocp371\profiles\default\sys_man
ifest_classpath\weblogic_patch.jar;C:\PROGRA~1\Java\JDK17~1.0_1\lib\tools.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\weblogic_sp.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\weblogic.
jar;C:\oracle\MIDDLE~2\modules\features\weblogic.server.modules_10.3.6.0.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\webservices.jar;C:\oracle\MIDDLE~2\modules\ORGAPA~1.1/lib/ant-all.j
ar;C:\oracle\MIDDLE~2\modules\NETSFA~1.0_1/lib/ant-contrib.jar;C:\oracle\MIDDLE~2\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\oracle\MIDDLE~2\patch_ocp37
1\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\PROGRA~1\Java\JDK17~1.0_1\lib\tools.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\weblogic_sp.jar;C:\oracle\MIDDLE~2\WLSER
V~1.3\server\lib\weblogic.jar;C:\oracle\MIDDLE~2\modules\features\weblogic.server.modules_10.3.6.0.jar;C:\oracle\MIDDLE~2\WLSERV~1.3\server\lib\webservices.jar;C:\oracle\MIDDLE~2\module
s\ORGAPA~1.1/lib/ant-all.jar;C:\oracle\MIDDLE~2\modules\NETSFA~1.0_1/lib/ant-contrib.jar;"
PATH="C:\oracle\MIDDLE~2\patch_wls1036\profiles\default\native;C:\oracle\MIDDLE~2\patch_ocp371\profiles\default\native;C:\oracle\MIDDLE~2\WLSERV~1.3\server\native\win\x64;C:\oracle\MIDD
LE~2\WLSERV~1.3\server\bin;C:\oracle\MIDDLE~2\modules\ORGAPA~1.1\bin;C:\PROGRA~1\Java\JDK17~1.0_1\jre\bin;C:\PROGRA~1\Java\JDK17~1.0_1\bin;C:\oracle\MIDDLE~2\patch_wls1036\profiles\defa
ult\native;C:\oracle\MIDDLE~2\patch_ocp371\profiles\default\native;C:\oracle\MIDDLE~2\WLSERV~1.3\server\native\win\x64;C:\oracle\MIDDLE~2\WLSERV~1.3\server\bin;C:\oracle\MIDDLE~2\module
s\ORGAPA~1.1\bin;C:\PROGRA~1\Java\JDK17~1.0_1\jre\bin;C:\PROGRA~1\Java\JDK17~1.0_1\bin;C:\oracle\MIDDLE~2\patch_wls1036\profiles\default\native;C:\oracle\MIDDLE~2\patch_ocp371\profiles\
default\native;C:\oracle\MIDDLE~2\WLSERV~1.3\server\native\win\x64;C:\oracle\MIDDLE~2\WLSERV~1.3\server\bin;C:\oracle\MIDDLE~2\modules\ORGAPA~1.1\bin;C:\PROGRA~1\Java\JDK17~1.0_1\jre\bi
n;C:\PROGRA~1\Java\JDK17~1.0_1\bin;C:\app\paul.currie\product\11.2.0\client_2\bin;C:\app\paul.currie\product\11.2.0\dbhome_3\bin;C:\Program Files (x86)\PC Connectivity Solution\;C:\Wind
ows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.7.0_13\jre\bin;;C:\oracle\MIDDLE~2\WLSERV~1.3\server\native\win\x
64\oci920_8;C:\oracle\MIDDLE~2\WLSERV~1.3\server\native\win\x64\oci920_8;C:\oracle\MIDDLE~2\WLSERV~1.3\server\native\win\x64\oci920_8"
Your environment has been set.
I am totally stuck at this point so any help would be much appreciated.
Cheers
PaulI have just tested both on a Windows and a Linux server and it works fine.
D:\oracle\product\Middleware\wlserver_10.3\server\bin>setWLSEnv.cmd
CLASSPATH=D:\oracle\product\MIDDLE~1\patch_wls1035\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\oracle\
product\MIDDLE~1\patch_jdev1111\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\oracle\product\JAVA_C~1\li
b\tools.jar;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\lib\weblogic_sp.jar;D:\oracle\product\MIDDLE~1\WLSERV~1.3\serve
r\lib\weblogic.jar;D:\oracle\product\MIDDLE~1\modules\features\weblogic.server.modules_10.3.5.0.jar;D:\oracle\product\MI
DDLE~1\WLSERV~1.3\server\lib\webservices.jar;D:\oracle\product\MIDDLE~1\modules\ORGAPA~1.1/lib/ant-all.jar;D:\oracle\pro
duct\MIDDLE~1\modules\NETSFA~2.0_1/lib/ant-contrib.jar;D:\oracle\product\MIDDLE~1\patch_wls1035\profiles\default\sys_man
ifest_classpath\weblogic_patch.jar;D:\oracle\product\MIDDLE~1\patch_jdev1111\profiles\default\sys_manifest_classpath\web
logic_patch.jar;D:\oracle\product\JAVA_C~1\lib\tools.jar;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\lib\weblogic_sp.ja
r;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.jar;D:\oracle\product\MIDDLE~1\modules\features\weblogic.ser
ver.modules_10.3.5.0.jar;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\lib\webservices.jar;D:\oracle\product\MIDDLE~1\mod
ules\ORGAPA~1.1/lib/ant-all.jar;D:\oracle\product\MIDDLE~1\modules\NETSFA~2.0_1/lib/ant-contrib.jar;
PATH=D:\oracle\product\MIDDLE~1\patch_wls1035\profiles\default\native;D:\oracle\product\MIDDLE~1\patch_jdev1111\profiles
\default\native;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\native\win\x64;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server
\bin;D:\oracle\product\MIDDLE~1\modules\ORGAPA~1.1\bin;D:\oracle\product\JAVA_C~1\jre\bin;D:\oracle\product\JAVA_C~1\bin
;D:\oracle\product\MIDDLE~1\patch_wls1035\profiles\default\native;D:\oracle\product\MIDDLE~1\patch_jdev1111\profiles\def
ault\native;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\native\win\x64;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\bin
;D:\oracle\product\MIDDLE~1\modules\ORGAPA~1.1\bin;D:\oracle\product\JAVA_C~1\jre\bin;D:\oracle\product\JAVA_C~1\bin;C:\
Program Files\Legato\nsr\bin;C:\PROGRA~2\CA\SHARED~1\ETPKI\lib;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C
:\Windows\System32\WindowsPowerShell\v1.0\;D:\oracle\Java\current\jre\bin;C:\PROGRA~2\CA\IDENTI~1\PROVIS~1\BIN;C:\Progra
m Files (x86)\CA\SharedComponents\CAM\bin;D:\oracle\product\MIDDLE~1\WLSERV~1.3\server\native\win\x64\oci920_8;D:\oracle
\product\MIDDLE~1\WLSERV~1.3\server\native\win\x64\oci920_8
Your environment has been set.
D:\oracle\product\Middleware\wlserver_10.3\server\bin>java weblogic.WLST
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
wls:/offline> -
Just got my 1st iMac, trying to load my iTunes library, but it only seems to want to load "purchased" music, not the music I've loaded by disc etc
Easiest way is to use Migration Assistant application in /Applications/Utilities/ on your computer.
This will migrate all yoru user data from old computer.
See this -> http://support.apple.com/kb/HT4796 -
Class loading works with jre1.3.1 but not with jre1.4.0
Hello,
My JWS application use the following line to create an XMLReader:
XMLReader rdr = XMLReaderFactory.createXMLReader( "org.apache.xerces.parsers.SAXParser" );
Everything works fine with jre1.3.1, but with jre1.4.0 or jre1.4.1 I experience a very strange behaviour:
1) When my application is downloaded and executed for the first time, everthing works fine.
2) When I quit the application and I launch it again, an Exception is thrown (the system in unable to load the Class org.apache.xerces.parsers.SAXParser).
3) If I tell JWS to show the console, everthing works fine again. If I tell JWS not to show the console, the Class can't be loaded anymore.
Any idea ?Hi.
I have also been experiencing problems in using Java Web Start for my application. When i tried certain functions of my application like saving and updating, I will faced this problem:
javax.xml.soap.SOAPException: Unable to create SOAP connection factory: Provider com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory not found
In the previous email in the forum, it was said that this problem was overcame, but I do not really know to how apply the solution given below:
/* The following code is not used for now because
* the code in createXMLReader() which dynamically
* allocates the class does not work the with
* Web Start class loader.
* This can be used again once Sun starts shipping
* Xerces 2.x with the JRE. They have already changed
* the XML development pack to use Xerces 2.x instead
* of Crimson, but as of 1.4.1, they are not updating
* the JRE distribution.
//String className = System.getProperty("org.xml.sax.parser");
//if (className == null) className = "org.apache.xerces.parsers.SAXParser";
//try {
// tParser = XMLReaderFactory.createXMLReader(className);
//} catch (SAXException e) {
// tParser = XMLReaderFactory.createXMLReader();
XMLReader tParser = new org.apache.xerces.parsers.SAXParser()
Can anyone enlighten me on how to overcome the SOAP Factory problem? Thank you. -
[SOLVED] Java could not find or load main class
I just tried to run a Java program using Swing components from the terminal, but I always get this error message:
$ java VisualTest
Error: Could not find or load main class VisualTest
The strange thing is that it runs flawlessly from within Eclipse.
I created VisualTest.java using the (old) Visual Editor, it's contents are:
package visual1;
import javax.swing.SwingUtilities;
//import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
public class VisualTest extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() {
public void run() {
VisualTest thisClass = new VisualTest();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
* This is the default constructor
public VisualTest() {
super();
initialize();
* This method initializes this
* @return void
private void initialize() {
this.setSize(300, 200);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
* This method initializes jContentPane
* @return javax.swing.JPanel
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
return jContentPane;
As you can see, there is a class named VisualTest and it contains a main function.
My CLASSPATH variable contains a dot, like
.:/home/mk/.java/deployment/ext/*
I just updated my Java from JDK 7u67 to JDK 8u20 (the Oracle one, in AUR), but I can't imagine this is related (however, I haven't run Java programs from the terminal for a long time).
Strangely enough, a simple HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
runs flawlessly from within the terminal.
Last edited by Marcel- (2014-09-26 12:44:35)As intended by my institution, I said to Eclipse that it should store sources and class files in the same directory. Let's do ls and test:
[~/workspace]$ ls
total 12K
drwxr-xr-x 4 mk mk 4.0K Sep 23 18:23 visualtest/
-rw-r--r-- 1 mk mk 426 Sep 24 15:45 HelloWorld.class
-rw-rw-r-- 1 mk mk 111 Sep 24 15:44 HelloWorld.java
[~/workspace]$ java HelloWorld
Hello World!
vs.
[~/workspace/visualtest/visual1]$ ls
total 12K
-rw-r--r-- 1 mk mk 528 Sep 24 15:38 VisualTest$1.class
-rw-r--r-- 1 mk mk 1.1K Sep 24 15:38 VisualTest.class
-rw-r--r-- 1 mk mk 1.2K Sep 24 00:32 VisualTest.java
[~/workspace/visualtest/visual1]$ java VisualTest
Error: Could not find or load main class VisualTest
I also tested this with another project that runs fine in Eclipse, but it gives the same error message when trying to issue `java StemOpPartijFrame`.
EDIT:
One difference between the two OSs though is that Linux progresses. The other decays..
Two? I count many! And I don't think something like OpenBSD decays. ;-)
Last edited by Marcel- (2014-09-24 16:54:12) -
Error: Could not find or load main class
Hello everyone!
I have decided to finally start learning Java and am currently, and slowly, making my way through the tutorials. I am only on chapter 2 in the class section. While reading I came uponJava Tutorials Sample Code and wanted to try and compile it in netbeans. This is the code that it contained:
class BicycleDemo {
public static void main(String[] args) {
// Create two different
// Bicycle objects
Bicycle bike1 = new Bicycle();
Bicycle bike2 = new Bicycle();
// Invoke methods on
// those objects
bike1.changeCadence(50);
bike1.speedUp(10);
bike1.changeGear(2);
bike1.printStates();
bike2.changeCadence(50);
bike2.speedUp(10);
bike2.changeGear(2);
bike2.changeCadence(40);
bike2.speedUp(10);
bike2.changeGear(3);
bike2.printStates();
I did the following in order:
1) New project
2) Select Java under Categories and Java Application under Projects
3) I type BicycleDemo in the Project Name Field and click finish
4) I delete all the template code and paste the above code into the field
5) I click run and get the following error:
run:
Error: Could not find or load main class bicycledemo.BicycleDemo
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Any help would be greatly appreciated! Thanks!I have decided to finally start learning Java and am currently, and slowly, making my way through the tutorials. I am only on chapter 2 in the class section. While reading I came uponJava Tutorials Sample Codeand wanted to try and compile it in netbeans. This is the code that it contained:
class BicycleDemo {
1) New project
2) Select Java under Categories and Java Application under Projects
3) I type BicycleDemo in the Project Name Field and click finish
4) I delete all the template code and paste the above code into the field
5) I click run and get the following error:
run:
Error: Could not find or load main class bicycledemo.BicycleDemo
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Thanks for posting ALL of the info - most posters don't do that and it makes it hard to help them.
Your exception shows it is looking for 'bicycledemo.BicycleDemo' so the 'BicycleDemo' class is expected to be in a package named 'bicycledemo'. The code you posted and the code at the link does NOT use a package statement.
When you create a new project in NetBeans it will AUTOMATICALLY add a package name to the start of a new class file. So, unknown to you, it created a package named 'bicycledemo' and put the class file in it.
In step #4 you deleted the template code (which had a 'package bicycledemo' statement in it) and replaced it with the tutorial code.
Likely you didn't notice the package statement in the template before you deleted the template code.
package bicycledemo
.Add that package statement as the first line of the class source code.
You should generally ALWAYS put your code in a package. For some reasons many of the tutorials do NOT do that. -
Hi,
Am getting below error while performing ESRI shapefile into oracle database table.,
C:\>java -cp G:\app\product\11.2.0\dbhome_1\jdbc\lib\ojdbc14.jar;G:\app\product\
11.2.0\dbhome_1\md\jlib\sdoutl-1.0.jar;\G:\app\product\11.2.0\dbhome_1\md\jlib\s
doapi-1.0.jar oracle.spatial.util.SampleShapefileToJGeomFeature -h localhost -p
1521 -sn orcl -u MDSYS -d selva -t shapes -f F:\saptial\Africa.shp -r 8307 -g ge
ometry
Error: Could not find or load main class oracle.spatial.util.SampleShapefileToJGeomFeature
Am using java version as ,
C:\>java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
And also tried in MapBuilder its working fine.,but i need to import using java utility can any help me too this.,i had tried below this way and problem got solved .,
Before i have downloaded
sdoutl-11.2.0.jar and sdoapi-11.2.0.jar used it for import shp file ..
C:\>set ORACLE_HOME=G:\app\product\11.2.0\dbhome_1
C:\Users\SELVA>cd downloads
C:\Users\SELVA\Downloads>cd statplanet_zambia
C:\Users\SELVA\Downloads\StatPlanet_Zambia>cd map
located into particular path and set my oracle home
C:\Users\SELVA\Downloads\StatPlanet_Zambia\map>set ORACLE_HOME=G:\app\product\11.2.0\dbhome_1
C:\Users\SELVA\Downloads\StatPlanet_Zambia\map>java -classpath %ORACLE_HOME%\jdb
c\lib\ojdbc5.jar;%ORACLE_HOME%\md\jlib\sdoutl-11.2.0.jar;%ORACLE_HOME%\md\jlib\sdoapi-11.2.0.jar oracle.spatial.util.SampleShapefileToJGeomFeature -h localhost -p 1521 -s orcl -u MDSYS -d selva -t zambia -f map -r 8307 -g geometry
host: localhost
port: 1521
sid: orcl
db_username: MDSYS
db_password: selva
db_tablename: zambia
shapefile_name: map
SRID: 8307
db_geometry_column: geometry
Connecting to Oracle10g using...
localhost, 1521, orcl, MDSYS, selva, zambia, map, null, 8307
Dropping old table...
java.sql.SQLException: ORA-00942: table or view does not exist
Creating new table...
9 record(s) converted.
Done.
Thanks
Selva -
Class loading analyzing tool not working
I want to enable class loading in weblogic so I deployed wls-cat.war to the server. When I test the war I get Error 503 Unavailable service.Please let me know what is to be done.
Hi,
If your domain is running in development mode the application being an internal application is deployed automatically on on-demand first time access. If you have manually deployed it then undeploy it. When domain is running in production mode then you have to deploy it manually just like any other war application. -
I am trying to update Firefox, but am unable to. I have gone through all of the steps and it seems to not update. I have saved your files several time due to my many tires but the update seems not to go through. What am I doing wrong?
If there are problems with updating then best is to download the full version and uninstall the currently installed version and delete the Firefox program folder to remove any leftover files.
Download a fresh Firefox copy and save the file to the desktop.
*Firefox 9.0.x: http://www.mozilla.org/en-US/firefox/all.html
Uninstall your current Firefox version, if possible.
*Do NOT remove personal data when you uninstall the current version or you lose your bookmarks and other data because all profile folders will be removed.
Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
*It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
*http://kb.mozillazine.org/Uninstalling_Firefox
Your bookmarks and other profile data are stored elsewhere in the Firefox Profile Folder and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox.
*http://kb.mozillazine.org/Profile_folder_-_Firefox
*http://kb.mozillazine.org/Profile_backup
*http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall
Maybe you are looking for
-
Photoshop Elements 13 Installation Failed - Adobe Genuine Software Verification Failure
I bought and downloaded Adobe Photoshop Elements 13 from Amazon, which would seem to be a legitimate source. Everything runs smoothly, and seems correct up until the point of installation, when this happens after the installation process reaches 99%.
-
Acrobat 9.0 opens (downloads) server file in temporary folder
Using Acrobat 9.0 (Windows Sharepoint server environment) to open files stored on the server downloads them into a temporary folder on my local computer. Unfortunately, this means that internal links/bookmarks using relative addressing to other files
-
I lost my iphone 4s. is there anyway I can track it down?
Somebody told me i could track it using the GPS. Can I?
-
[SOLVED] XFCE4.10 main panel and freeze problem
Hello everyone. I just have upgraded to XFCE4.10 and after rebooting (as the update included also a new kernel) the main panel is double its size just like the icons. I would have included a screenshot but here is where my second problem appears. Whe
-
Oracle Virtual Private Database and Weblogic.
Hi All, I am using Oracle 11gR2 and weblogic 10.3.5. I would like to use Virtual Private Database feature in my project. I read the documentation and I understood the concept. I made a few tests on my dev environment and it seems to work fine. Now, I