Handler referencing class - runtiime NoClassDefFoundError
I have a web service handler that references another (utility type) class and get an exception at runtime (java client exception example):
java.rmi.RemoteException: SOAPFault:javax.xml.rpc.soap.SOAPFaultException: Exception during processing: java.lang.NoClassDefFoundError: com/xyz/type/Name
(see Fault Detail for stacktrace)
This exception happens because the 'com/xyz/type/Name' class is not in the war file that is contained in the ear file. The ear/war/jar is assembled by the weblogic servicegen anttask.
Is there a way to add .class files to the war file with the servicegen anttask ? Note that I had the same issue when I was experimenting with a handler class hierarchy - the handler could not be instantiated because the base class was not in the ear/war file.
Any help would be appreciated.
Solved the issue by using wlpackage ant task after servicegen .
Similar Messages
-
Authorization error for referenced class javax/mail/Session.
All,
I am trying to compile a java source which is using session object in javax/mail/session.
I am getting the error java/lang/System: Authorization error for referenced class javax/mail/Session.
I used "import javax.mail.*;" in my java source..
I loaded both mail.jar and activation.jar using the below command in different schema other than the schema which above java source exists.
loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym activation.jar
loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym mail.jar
After loading, All java classes in mail.jar and activation.jar were in compiled state in that schema
Its working well in different database having the same configuration.
My oracle version is Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit ProductionI have to accomplish tried in CONSOLE TestMail.class:
C>java TestMail
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Partmy make.bat:
javac -g -classpath
...\Java\jre1.5.0_06\lib\activation.jar;...\jre1.5.0_06\lib\imap.jar;...\jre1.5.0_06\lib\mail.jar;...\jre1.5.0_06\lib\mailapi.jar;...\jre1.5.0_0\lib\plugin.jar;...\jre1.5.0_06\lib\pop3.jar;...\jre1.5.0_06\lib\smtp.jar;...\jre1.5.0_06\lib\javamail-1_3_2-src-jrl.zip;...\jre1.5.0_06\lib\j2ee.jar TestMail.javaWhat isn't correct?
Tanks,
Mohammad -
Java stored procedures and referencing classes
We are referencing to some classes/libraries which are not present in the database. In normal java world, you specify the libraries/classes needed to run your piece of code in the CLASSPATH and that forms part of your complete code.
Can java stored procedures in the database refer to libraries or class files it requires on the file system rather than the database? Is it possible to make this happen?
Thankspshiva,
Posting the same question to multiple forums usually doesn't increase your chances of getting an answer, and it just frustrates those wishing to answer you with the result being that any future questions you post may have less chance of being answered -- because of your uncourteous, initial behaviour.
I have answered your other thread:
java stored procedures and referencing classes
In my opinion, that forum (the Database JVM forum) is the most appropriate for your question.
Good Luck,
Avi. -
Obtain referenced classes from 1.6' javax.tools.JavaCompiler
Hi,
I'd like to use JavaCompiler both to compile .java source files and to maintain dependency information in one go. How do I obtain a list of referenced classes (or even methods, fields, etc) after/during compilation?
Thanx in advance
OliverThanks for the answer... I don't know how to refer to the jre path from within web start. I have solved problem ii) by passing a -cp option to the compiler. Here it is a sample code:
ClassLocader cl = OnTheFlyCompiler.class.getClassLoader();
List<URL> classpath = new ArrayList<URL>();
if ( cl instanceof URLClassLoader ) {
URLClassLoader cl2 = (URLClassLoader)cl;
for (URL jar : cl2.getURLs()) {
classpath.add(jar);
String classPath = System.getProperty("java.class.path");
for (String path : classPath.split(File.pathSeparator)) {
try {
classpath.add(new URL("file:"+path));
} catch (MalformedURLException e) {
System.err.println("Wrong url: "+e.getMessage());
e.printStackTrace();
StringBuffer sb = new StringBuffer();
for (URL jar : classpath) {
sb.append(jar.getPath());
sb.append(File.pathSeparatorChar);
String ops[] = new String[] {"-cp" , sb.toString() };This along with disabling security does the trick for me. However I had to use NetX jnlp implementation, since when doing this trick the sun version returns the original urls (like http://internal/webstart/build.jar), whereas NetX returns the path of the downloaded files (e.g. /tmp/build.jar).
I will accept your suggestion and post to bugs.sun.com.
Ciao. -
RMI Classloading and referenced classes
Hi All,
I am trying to develop an application that uses a thin client methodology using RMI. What I mean by thin client is that there will only be several classes to start the client side application and invoke the rmi server. The rmi server will return the class files (mainly Swing/Charva JFrame and JPanel classess, which I refer to as the UI classes), which will be instantiateds and referenced by an interface that all the classes implement. Many of the UI classes also instantiate classes for control and presentation (i.e. extended JText Fields and other java classes). It seems that because RMI uses the URLClassLoader, the referenced class types do not have to reside on the client side on disk. I believe this is because RMI automatically loads both the classes that were requested by the client and any additional classes that are referenced by the requested classes. My first question is:
1. Are the referenced classes loaded at the same time the called class is loaded, or when the called class is instantiated?
2. We store the rmi requested .class files in a hash table the first time they are requested. We do this so we do not need to go accross the network the next time we need to reference and instanitiate the class; we just get if from the hash table. My question is, if we instantiate the class file from the hash table, does RMI reload the referenced class files (the classes that are instantiated within the object I am instantiating, i.e Extended JText and UI Controller classes) from the RMI server or are the loaded from memory on the client side?
Any responses are greatly appreciated.
Elliott Gonshor
QuestDiagnosticsHi,
I remembered that some of the AWT components have
their corresponding Serializable form. I am not too sure
if Swing components has such a form. But since you
have make it happened, I think that it should be yes.
I found some words in the book, Java Enterprise in a
Nutshell. I excerpt some of them in the book as follows :
========================
java Djava.server.rmi.codebase=-http://objhost.org/classes/ Regaccount
We've setting the codebase to http://objhost.org/classes/,
so we have to make sure that an htpp server is running on
the objhost.org machine and that the necessary class files
(eg, the AccountImpl stub class) are in the classes
directory of that http server's document root
Now we can run the AccountClient class on the remote
client as before, but the client's host machine doesn't
have the stub class for the Account remote object
available locally. WHEN THE AccountClient TRY TO
LOOK UP THE REMOTE Account OBJECT, we want
the stub class to be loaded remotely. ......................
===================================
You may notice that I uppercase one sentence !
So if I believe the description, then I think those
referenced class files should be loaded when the
called class is instantiated. Since it happens at the
time when the action of look it up.
Since it has been load into the client, I think that it should
loaded those reference class on the client side. Although
it just said that
but the client's host machine doesn't
have the stub class for the Account remote object
available locally. ...........
it seems to mean that it does not have it locally so it
start loading it from remote. So it might be the case if
it existed in local, it should be cached and without
reloaded from remote.
It is my assertion. I could not promise ii it is right
or not. In fact, Try it might be better.
For the first question, you may try to insert some
flag in the code which is downloaded firstly and
observe if it happen in which phase, loaded at
the same time, or when the called class is instantiated
For the second question, You may try to make it
work, that is, all classes have been downloade to
the client side and works smoothly. Consider that
remove those reference class file stored in the remote
side. and request again.
if it works, it means that local class is reference firstly.
if not, it means that it reloaded from the remote side
without considering the copy in local.
if all of them are wrong , Well ..... God bless you !
hahaha
good luck,
Alfred Wu -
How to include implicitely referenced class in swf?
I have a setup where livecycle returns an array filled with instances of class MyClass with, among others, property aName. MyClass implements MyInterface which has an accessor name, in the implementation MyClass name handles aName. A component listens to an ArrayCollection filled with this array and its labelField property is set to name.
What happens next is a guess but seems plausible to me. Due to the fact MyClass is not referenced in the application, I don't need it for the dataprovider, it isn't included in the swf file. The result is an array not filled with MyClass instances but with Object instances with the aName property because livecycle seems to use a failover strategy where dynamic objects will be created if the class can't been found. This results in an error for the component because the labelField doesn't exist here.
My question is: is there a way to force Flex to include files? I know I can handle this with changing the labelField but I want to stick to my design.I don't know it this will help you but in a flex lib nature project you can include the classes you need from the file .flexLibProperties. You can try to include into your .flexProperties file the next argument:
<includeClasses>
<classEntry path="com.validator.CustomValidator"/>
</includeClasses>, but I didn't had the time to test so i can tell you for sure that it will work. -
Error-- Referencing classes from project 1 in project 2 using libraries option
Using JDev 9.0.3
I'm struggling with an error that's occuring that I know should not be...
I have two projects (SessionUtils & TradingSumStruts).
SessionUtils has 4 java files all of which have a package name of: com.arca.sessionutils.
TradingSumStruts has 3 java files all of which have a package name of: com.arca.tradingsum.
One of the java files in TradingSumStruts imports a class from SessionUtils
import com.arca.sessionutils.SessionUtil;
In TradingSumStruts project I have created a new user library and called it: SessionUtilsLib. This lib points to the classes directory of SessionUtils, and the src directory of SessionUtils in the same workspace.
I've shut down the oc4j server, deleted any existing class files for the above two projects, and recompiled both projects. When I run the app, I get the following error:
java.lang.NoClassDefFoundError: com/arca/sessionutils/SessionUtil
void com.arca.tradingsum.TradingSumInfo.<init>(javax.servlet.http.HttpServletRequest)
TradingSumInfo.java:67
when I attempt to call SessionUtil.xxxMethod().
I have double and triple checked my spelling, my library entries, my class files, and even re-booted my machine.
ANY ideas would be greatly appreciated!
-Teri
[email protected]Don't use libraries for this. Define a project dependency for your project using the project properties dialog. This will automatically include your project classes without hardcoding the path into a library.
-
Event handling from class to another
i get toolbarDemo.java which make event handling to JTextArea in the same class
http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/index.html#ToolBarDemo
but i have another class and i make object of toolBar class and i move toolBar icons only how can i move the event handling as open ,save,copy,paste to my another class
i want to ignore actionPerformed of toolBar class and listen to my another's class actionPerformed
thanksRather than trying to use the ToolBarDemo class as-is you can use/modify the methods in it for your own class, like this:
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import javax.swing.*;
import javax.swing.text.TextAction;
public class ToolBarIconTest implements ActionListener
static final private String OPEN = "open";
static final private String SAVE = "save";
static final private String COPY = "copy";
static final private String PASTE = "paste";
public void actionPerformed(ActionEvent e)
String cmd = e.getActionCommand();
if (OPEN.equals(cmd))
System.out.println("show a JFileChooser open dialog");
if (SAVE.equals(cmd))
System.out.println("show a JFileChooser save dialog");
private JToolBar getToolBar()
JToolBar toolBar = new JToolBar();
addButtons(toolBar);
return toolBar;
protected void addButtons(JToolBar toolBar) {
JButton button = null;
//first button
button = makeGeneralButton("Open24", OPEN,
"To open a document",
"Open", this);
toolBar.add(button);
//second button
button = makeGeneralButton("Save24", SAVE,
"To save a document",
"Save", this);
toolBar.add(button);
//third button
button = makeGeneralButton("Copy24", COPY,
"Copy from focused text component",
"Copy", copy);
toolBar.add(button);
//fourth button
button = makeGeneralButton("Paste24", PASTE,
"Paste to the focused text component",
"Paste", paste);
toolBar.add(button);
protected JButton makeGeneralButton(String imageName,
String actionCommand,
String toolTipText,
String altText,
ActionListener l) {
//Look for the image.
String imgLocation = "toolbarButtonGraphics/general/"
+ imageName
+ ".gif";
URL imageURL = ToolBarIconTest.class.getResource(imgLocation);
//Create and initialize the button.
JButton button = new JButton();
button.setActionCommand(actionCommand);
button.setToolTipText(toolTipText);
button.addActionListener(l);
if (imageURL != null) { //image found
button.setIcon(new ImageIcon(imageURL, altText));
} else { //no image found
button.setText(altText);
System.err.println("Resource not found: "
+ imgLocation);
return button;
private Action copy = new TextAction(COPY)
public void actionPerformed(ActionEvent e)
JTextComponent tc = getFocusedComponent();
int start = tc.getSelectionStart();
int end = tc.getSelectionEnd();
if(start == end)
tc.selectAll();
tc.copy();
private Action paste = new TextAction(PASTE)
public void actionPerformed(ActionEvent e)
getFocusedComponent().paste();
private JPanel getTextFields()
JPanel panel = new JPanel(new BorderLayout());
panel.add(new JTextField(12), "North");
panel.add(new JTextField(12), "South");
return panel;
public static void main(String[] args)
ToolBarIconTest test = new ToolBarIconTest();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(test.getToolBar(), "North");
f.getContentPane().add(test.getTextFields());
f.setSize(360,240);
f.setLocation(200,200);
f.setVisible(true);
}Use the -cp option as shown in the ToolBarDemo class comments
C:\jexp>java -cp .;path_to_jar_file/jlfgr-1_0.jar ToolBarIconTest -
I have a (newbie?) question regarding event handling:
I have a database class which has an update method and invokes a databaseGUI class to display the data:
/// databaseClass instantiated as DatabaseClass dataConn = new DatabaseClass()
public class DatabaseClass {
Public void updateData {
// write values to database
Public void showData {
thisDBGUI = new databaseGUI();
// populate screen with data from database through database GUI class
// add a button to the interface via addUpdateButton method of databaseGUI class
thisDBGUI.addUpdateButton();
/// databaseGUI class
public class databaseGUI extends JFrame implements ActionListener {
public void addUpdateButton() {
buttonPanel = new JPanel();
updateButton = new JButton ("Udpate Record");
updateButton.addActionListener(this);
buttonPanel.add(okUpdate);
public void actionPerformed(ActionEvent e) {
// need to call dataConn.updateData method
}Please forgive the incomplete snippets; everything displays perfectly and the code executes fine EXCEPT I do not know to use the actionPerformed method to execute the updateDatabase method on the dataConn instance. Any help is greatly appreciated!
David EricksonPersonally, I would move the actionlistener into the DatabaseClass.I agree, but I would do it a different way (just due to personal preference):
public class databaseGUI extends JFrame {
public void addUpdateButton(DatabaseClass dbc) {
buttonPanel = new JPanel();
updateButton = new JButton ("Udpate Record");
updateButton.addActionListener(dbc);
buttonPanel.add(okUpdate);
}Then, just pass a reference to "this" when you call databaseGUI's constructor.
I just like this method better because the GUI object is still setting up the entire GUI on its own. Personal preference, no more. -
How does the JVM handle private class parameters in a utility class?
If I have a class that is public and not labeled as static, but it's constructor is private so that it cannot be instantiated, and all of its parameters and methods are both private and static. The methods modify the private parameters. In this case, the code explicitly is avoiding a singleton pattern, so there isn't even a class being instantiated, so this is a true utility class.
However, the static methods are accessible from multiple objects, and as far as I can tell, the JVM is persisting the parameters in memory beyond the specific thread that called the static method to begin with.
The question I have is how the JVM handles this? Are these private parameters assigned memory and are indeed persisted independent of thread, since there is no class reference. I am working with byte code injection, and the assumption is that a direct reference to a static parameter is much faster to call than having to go through an object reference. Of course, from a programmer point of view, I much prefer the singleton pattern since I am so used to hang my hat on a class reference.
Thanks.entguru wrote:
However, the static methods are accessible from multiple objects...Not if the methods are private, as you seemed to indicate ("all of its parameters and methods are both private and static").
Are these private parameters assigned memory and are indeed persisted independent of thread, since there is no class reference. There is a class reference. It refers to the class, and is obtainable via the class literal; e.g., MyClass.class.
~ -
Exception Handling at class level
This is a quick one. I've never used a try catch event handling statement at the class level where I declare all my variables before. Is is ok to do this? Can someone perhaps show me some psuedo code like this?
private final ImageIcon[] CAT_BULLETS = {new ImageIcon("yellow_his.gif"),
new ImageIcon("blue_pp.gif"), new ImageIcon("pink_sn.gif"),
new ImageIcon("brown_ent.gif"), new ImageIcon("green_al.gif"),
new ImageIcon("orange_sl.gif")};No, you can't wrap class-level variable declarations in try-catch blocks. Declare
the variables at the class level, do the assignment in you constructor,
and wrap the code there in a try-catch block. -
How to handle similar classes nicely
Suppose I have a function and it should be able to do the same operation to the references. The references can be int[], byte[] or float[]. How can the function to handle this problem nicely? To make it simple, let's say the function will increase each element in the array 1. The best way I can think of is
function(Object array, String key){
if (key.equals("int")){
for (int i = 0; i < ((int[])array).length; i++)
((int[])array)++;
if (key.equals("float")){
for (int i = 0; i < ((float[])array).length; i++)
((float[])array)[i]++;
But that looks silly since each time I am typing array I have to cast it's class. Can I cast it once and use it everywhere? Is there any better way to do that? thanks a lot.
zl2kWrite overloaded methods:function(int[] array) {
for (int i = 0; i < array.length; i++)
array[i]++;
function(float[] array) {
for (int i = 0; i < array.length; i++)
array[i]++;
}Have a look at java.util.Arrays if you want to see a full-blown example of this sort of thing in action. -
Missing class IDLEntity NoClassDefFoundError
Hi,
I wore a simple iView that have a class that implements the IDLEntity interface. when ever the class is created, i get an exception "java.lang.NoClassDefFoundError: org/omg/CORBA/portable/IDLEntity"
the IDLEntity is part of the java official rt.jar - how come the portal doesn't find it?
I've configured the classpath in the C:\usr\sap\EP62\j2ee\j2ee_00\cluster\server\cmdline.properties
and in C:\usr\sap\EP62\j2ee\j2ee_00\cluster\dispatcher\cmdline.properties
to include the rt.jar and myIDL.jar
I've also tried to bring the IDLEntity with my jar (par) but it didn't help.
Any idea ?Hi Shay, thanks for the response.
When I go to Help > Check for Updates, there are no WebCenter related updates available.
I did go to Tools > Preferences > Extensions and saw that WebCenter Portlet Producer Support, WebCenter Preconfigured Server & WebCenter Portlet Bridge Service extensions were all disabled by default. After enabling them, I restarted JDeveloper and I'm down to one missing class instead of two:
Missing class: oracle.adfinternal.model.portlet.rc.ptlprovider.PortletProducerContextFactory
A quick Google search for PortletProducerContextFactory turns up this post and a couple of find jar website results. -
Serialization in self-referencing classes
Okay, so I'm using Kodo 2.4.0, and I have a class Employee that has a List
property named 'managedEmployees':
private List managedEmployees = null;
The objects in this list are themselves of the class Employee. The JDO
configuration for it is:
<field name="fManagedEmployees" default-fetch-group="false">
<collection element-type="Employee" embedded-element="false"/>
<extension vendor-name="kodo" key="table" value="ps_employees"/>
<extension vendor-name="kodo" key="fEmployeeId-data-column"
value="emplid"/>
<extension vendor-name="kodo" key="fEmployeeId-ref-column"
value="manager_id"/>
</field>
When I serialize an object of this class it appears that Kodo is loading
the entire nested graph of Employees! Is there a configuration setting to
prevent this? Or need I create two different classes: Manager and
Employee, with managedEmployees as a property of Manager alone?Self-referencing or not, JDO always recursively pulls in all relations during
serialization. If you do not want this to happen, make your object transient
(pm.makeTransient (obj)) before serializing it. -
How to config POF to handle inner class
Hi, I have the following vo object:
public class Obj implements java.io.Serializable, PortableObject
public static class InnerObj implements java.io.Serializable, PortableObject
1) If i put both classes in the pof config xml, it throws class not found exception for the inner class InnerObj (as expected since there is no separate class files for it). My question is what is the correct way to handle the inner class? Should i just leave it out of the pof config xml and coherence will be smart enough to handle it?
<pof-config>
<user-type-list>
<user-type>
<type-id>111</type-id>
<class-name>some.package.Obj</class-name>
</user-type>
<user-type>
<type-id>222</type-id>
<class-name>some.package.InnerObj</class-name>
</user-type>
</user-type-list>
</pof-config>
2) Also want to confirm if implement both java.io.Serializable & PortableObject in the vo, coherence will ALWAYS take the portable object serialization if <pof-enabled>true</pof-enabled> is set in the config?
thanks!Hi i got the inner class config to work but now struggling to get it to run from the java client that connects to the cache. Went through the documents, it only made me more confused, so many config files...
The exception i am getting now is from the java application that connects to the cache, when it tried to do a cache.putAll() it's throwing the following exception:
An exception occurred while encoding a PutAllRequest for Service=ExtendTcpCacheService:TcpInitiator: java.io.IOException: unknown user type: some.package.Obj
So far I have done the below to enable POF:
1) On cache server I made the below changes, and both the cacheserver and extendproxy are running fine now.
- changed xml to: <pof-enabled>true</pof-enabled>
- dropped the jar containing the pof objects in the classpath
- added override pof config xml:
<pof-config>
<user-type-list>
<user-type>
<type-id>8888</type-id>
<class-name>some.package.Obj</class-name>
</user-type>
<user-type>
<type-id>8889</type-id>
<class-name>some.package.Obj$InnerObj</class-name>
</user-type>
</user-type-list>
</pof-config>
2) On the java project that connects to the cache:
- changed -Dtangosol.coherence.cacheconfig xml file and added:
<defaults>
<serializer>pof</serializer>
</defaults>
I am sure i am missing some config somewhere, thank you for your help.
Edited by: 920558 on Mar 28, 2012 2:15 PM
Maybe you are looking for
-
Hello someone can tell me please i updated my iphone 5 from ios7 to ios8 it recuires my icloud for activation i forgot my password now i reset it but my new password is not opening my iphone
-
I installed Adobe 7.0 standard on my laptop and I get this message: Warning 20225 Adobe Acrobat 7.0 setup was unalbe to creat a new item, adobe pdf port & printer. The adobe pdf printer may be unavailable. I really need to get this working and adobe
-
I need help please. I have 6 apps updates shown on on the upper right corner of the app store icon. When i tried to open the apps store and go to updates, the apps that need to be updated were not appearing therefore i have no idea what those apps ar
-
Im tryin to buy unilimited products for the retail app called Ipo sales, i need the 5,000 or more products option and it wont let me buy. Tried to buy music and my account works fine. Tried 3 diferent credit cards and it doesnt accept apyment it says
-
Where is the 32-bit Bridge stored in SL?
i am having huge problems since moving from10.5.8 9.1.5 to 10.6.8 9.1.7. A very well informed member of the SL forum is helping me try to sort out why my iMac screen locks in place when I open Logic pro to a project with EWQL Choirs,the EW stuff seem