Cannot resolve symbol-- data access problem
hi, everyone, i am new to java... thx for helping me.
i have two files
1) dls.java
2) SliderDemo.java
in the dls.java i have the following coding:
JPanel slider = new SliderDemo(this);
slider.framesPerSecond(0);
and in the SliderDemo.java i have following coding:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class SliderDemo extends JPanel implements ActionListener {
//This label uses ImageIcon to show the doggy pictures.
JLabel picture;
dls mydls;
JSlider framesPerSecond;
int i;
public SliderDemo(dls mydls) {
this.mydls = mydls;
framesPerSecond = new JSlider(JSlider.HORIZONTAL, -10, 10, 0);
framesPerSecond.addChangeListener(new SliderListener());
//Turn on labels at major tick marks.
framesPerSecond.setMajorTickSpacing(10);
framesPerSecond.setMinorTickSpacing(1);
framesPerSecond.setPaintTicks(true);
framesPerSecond.setPaintLabels(true);
framesPerSecond.setBorder( BorderFactory.createEmptyBorder(0,0,10,0));
.....etc
when i compile the dls.java
it told me cannot resolve symbol , framePerSecond...
help!!!why i can't resolve the symbol?
thx all experts.
yours,
Terry
cannot resolve symbol , framePerSecondPerhaps because you declared a variable whose name is "framesPerSecond" and then you tried to use "framePerSecond" instead of that?
Similar Messages
-
Compilation problem (cannot resolve symbol)
I have searched the Forums for "cannot resolve symbol" and as usual, many posts with no answers or just advise that noone ever comes back to say works. I am trying to compile this code:
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.naming.*;
import org.acme.*;
public class HelloOpenEJB extends HttpServlet {
String factory = "org.openejb.client.LocalInitialContextFactory";
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
PrintWriter out = response.getWriter();
try{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, factory );
InitialContext ctx = new InitialContext( p );
//Lookup the bean using it's deployment id
Object obj = ctx.lookup("/Hello");
HelloHome ejbHome = (HelloHome) obj;
//Use the HelloHome to create a HelloObject
HelloHome ejbHome = (HelloHome)
PortableRemoteObject.narrow(obj, HelloHome.class);
//The part we've all been wainting for...
out.println("<html>");
out.println("<body>");
out.println("<head>");
out.println("<title>Hello World!</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>"+ ejbObject.sayHello() +"</h1>");
out.println("</body>");
out.println("</html>");
} catch (Exception e){
response.setContentType("text/plain");
e.printStackTrace(out);
I'm running this on a Linux box. When I compile, I get this:
HelloOpenEJB.java:28: ejbHome is already defined in doGet(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
HelloHome ejbHome = (HelloHome)
^
HelloOpenEJB.java:29: cannot resolve symbol
symbol : variable PortableRemoteObject
location: class HelloOpenEJB
PortableRemoteObject.narrow(obj, HelloHome.class);
^
HelloOpenEJB.java:38: cannot resolve symbol
symbol : variable ejbObject
location: class HelloOpenEJB
out.println(""+ ejbObject.sayHello() +"");
^
3 errors
I don't know why any of these errors are occuring, besides the obvious responses given back from javac, so can someone help? Thanks, JeremyThe error message "x already defined in y" means that you're trying to use a name that already exists in the current scope. In your case you have:
HelloHome ejbHome = (HelloHome) obj;
//Use the HelloHome to create a HelloObject
HelloHome ejbHome = (HelloHome)
PortableRemoteObject.narrow(obj, HelloHome.class);Here you are trying to declare two instances of HelloHome with the same name.
The reason that you would get "cannot resolve symbol" is that you are trying to access a variable or class that you haven't declared or imported. -
JSP Compilation Problem - Cannot Resolve Symbol
I cannot see the problem. Maybe I am not sober at 2:30 am.
<%
Collection postBeans = ( Collection )request.getAttribute( "PostBeans" );
Iterator iterator = postBeans.iterator();
int i = 0;
while( iterator.hasNext() )
PostBean postBean = (PostBean)iterator.next();
i++;
String background;
if ( postBean.getParentPostID() == 0 )
background = "#FFCE9C";
else
if ( ( i%2 ) != 0 )
background = "#EEEEEE";
else
background = "#FFFFFF";
%>
<table width="95%" border="0" cellspacing="1" cellpadding="5" align="center" bgcolor="#999999">
<tr bgColor=<%=background%>>
</tr>
</table>I got compilation error: cannot resolve symbol
symbol: backgroundI put the variable 'background' outside the while loop. The 'cannot resolve symbol' problem is gone. But, I got another compilation error:
>
unexpected type
required: variable
found : value
out.write("\r\n }\r\n i++;\r\n if ( postBean.getParentPostID() == 0 ) \r\n {\r\n background = \"#FFCE9C\";\r\n }\r\n else \r\n {\r\n if ((i%2) != 0) \r\n {\r\n background = \"#EEEEEE\";\r\n } \r\n else \r\n {\r\n background = \"#FFFFFF\";\r\n }\r\n }\r\n%>\r\n");
The code looks like:
<%
String background;
Collection postBeans = ( Collection )request.getAttribute( "PostBeans" );
Iterator iterator = postBeans.iterator();
int i = 0;
while( iterator.hasNext() )
PostBean postBean = (PostBean)iterator.next();
i++;
if ( postBean.getParentPostID() == 0 )
background = "#FFCE9C";
else
if ( ( i%2 ) != 0 )
background = "#EEEEEE";
else
background = "#FFFFFF";
%>
<table width="95%" border="0" cellspacing="1" cellpadding="5" align="center" bgcolor="#999999">
<tr bgColor=<%=background%>>
</tr>
</table> -
Newbie problem: "cannot resolve symbol"
I'm working through some tutorials but I get errors even if i get the code CORRECT or I should say identical to the source code displayed on the web. For instance i get this:
E:\Java\New>javac SwingUI.java
SwingUI.java:41: not a statement
WindowListener 1 = new WindowAdapter() {
^
SwingUI.java:41: ';' expected
WindowListener 1 = new WindowAdapter() {
^
SwingUI.java:4: cannot resolve symbol
symbol : class ActionListener
location: class SwingUI
class SwingUI extends JFrame implements ActionListener {
^
SwingUI.java:25: cannot resolve symbol
symbol : class ActionEvent
location: class SwingUI
public void actionPerformed(ActionEvent event){
^
SwingUI.java:15: addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton cannot be applied to (SwingUI)
button.addActionListener(this);
^
SwingUI.java:18: cannot resolve symbol
symbol : class Borderlayout
location: class SwingUI
panel.setLayout(new Borderlayout());
^
SwingUI.java:46: addWindowListener(java.awt.event.WindowListener) in java.awt.Window cannot be applied to (int)
frame.addWindowListener(1);
^
SwingUI.java:48: cannot resolve symbol
symbol : variable set
location: class SwingUI
frame.set.Visible(true);
^
8 errors
The beginning of the code is:
import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.event.*;
import javax.swing.*;
class SwingUI extends JFrame implements ActionListener {
JLabel text, clicked;
JButton button, clickButton;
JPanel panel;
private boolean _clickMeMode = true;
SwingUI(){
text=new JLabel("I'm a simple program");
button= new JButton("Click here!");
button.addActionListener(this);
panel =new JPanel();
panel.setLayout(new Borderlayout());
panel.setBackground(Color.white);
getContentPane().add(panel);
panel.add(BorderLayout.CENTER, text);
panel.add(BorderLayout.SOUTH, button);
To me it seems as if there is a problem with my environmental settings and/or with the "import" files, but wouldn't that yield different error messages?
I'm running j2sdk1.4.0_01 on windows2000 professional
I should say that simple programs compile without errors.
thx
/HansThe letter 'l' is very similar to the number 1 in certain fonts unfortunately.
/Hans -
Problem using PixelGrabber ( cannot resolve symbol ) - newbie
Hi All,
I have a problem with my short program because the compiler write this (jdk1.4) :
img.java:17: cannot resolve symbol
symbol : constructor PixelGrabber (java.awt.Image,int,int,int,int,int[],int)
location: class java.awt.image.PixelGrabber
PixelGrabber pg = new PixelGrabber(image,0,0,image.getWidth(this
),image.getHeight(this),pixels,0);
^
1 error
... And I wrote that in my code :
( all is OK, the bug is only when I uncomment the line where the PixelGrabber object
is needed in my program ).
Thanks if you have any idea of solution to solve this problem or a doc,
( I don't find the answer to my problem in http://java.sun.com/j2se/1.4/docs/api/java/awt/image/PixelGrabber.html ),
import java.awt.*;
import java.awt.image.*;
import java.applet.*;
import java.awt.image.PixelGrabber;
public class img extends Applet {
Image image;
int pixels[];
public void init() {
image = getImage(getDocumentBase(), "rouge.jpg");
pixels = new int[image.getWidth(this) * image.getHeight(this)];
PixelGrabber pg = new PixelGrabber(image,0,0,image.getWidth(this),image.getHeight(this),pixels,0);
pg.grabPixels();
public void paint(Graphics g) {
String s = Integer.toString(pixels[5], 16);
g.drawString(s, 50, 50);Hi,
PixelGrabber needs one more parameter scansize (width).
change this line;
PixelGrabber pg = new PixelGrabber(image,0,0,image.getWidth(this),image.getHeight(this),pixels,0);
to:
PixelGrabber pg = new PixelGrabber(image,0,0,image.getWidth(this),image.getHeight(this),pixels,0, image.getWidth(this)
); -
Hello, say i have a class
A
that contains an object of class B.
Now there's class X...
It's all fine and dandy trying to compile them both until i try to set the classpath for junit, by doing:
set classpath=%classpath%;C:\junit3.8.1\junit.jar
i'm pretty sure it's correct...
well once i type in this line into my command prompt (win 2k), the junit package now seems to be recognized by class X, which is my testing class that contains an object of class A.
but NOW class A can't find class B and i get a cannot resolve symbol error. Same goes for class X not being able to find class A.
Anyone have any suggestions? I'm a newb to this :( . Thanks.nevermind! noob mistake.
-
Class error - cannot resolve symbol "MyDocumentListener"
Hello,
this is a groaner I'm sure, but I don't see the problem.
Newbie-itis probably ...
I'm not concerned with what the class does, but it would be nice for the silly thing to compile!
What the heck am I missing for "MyDocumentListener" ?
C:\divelog>javac -classpath C:\ CenterPanel.java
CenterPanel.java:53: cannot resolve symbol
symbol : class MyDocumentListener
location: class divelog.CenterPanel
MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
^
CenterPanel.java:53: cannot resolve symbol
symbol : class MyDocumentListener
location: class divelog.CenterPanel
MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
^
2 errors
package divelog;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;
import javax.swing.text.*;
public class CenterPanel extends JPanel implements ActionListener
{ // Opens class
static private final String newline = "\n";
private JTextArea comments;
private JScrollPane scrollpane;
private JButton saveButton, openButton;
private JLabel whiteshark;
private Box box;
private BufferedReader br ;
private String str;
private JTextArea instruct;
private File defaultDirectory = new File("C://divelog");
private File fileDirectory = null;
private File currentFile= null;
public CenterPanel()
{ // open constructor CenterPanel
setBackground(Color.white);
comments = new JTextArea("Enter comments, such as " +
"location, water conditions, sea life you observed," +
" and problems you may have encountered.", 15, 10);
comments.setLineWrap(true);
comments.setWrapStyleWord(true);
comments.setEditable(true);
comments.setFont(new Font("Times-Roman", Font.PLAIN, 14));
// add a document listener for changes to the text,
// query before opening a new file to decide if we need to save changes.
MyDocumentListener myDocumentListener = new MyDocumentListener(); // define the listener class
comments.getDocument().addDocumentListener(myDocumentListener); // create the reference for the class
// ------ Document listener class -----------
class MyDocumentListener implements DocumentListener {
public void insertUpdate(DocumentEvent e) {
Calculate(e);
public void removeUpdate(DocumentEvent e) {
Calculate(e);
public void changedUpdate(DocumentEvent e) {
private void Calculate(DocumentEvent e) {
// do something here
scrollpane = new JScrollPane(comments);
scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
saveButton = new JButton("Save Comments", new ImageIcon("images/Save16.gif"));
saveButton.addActionListener( this );
saveButton.setToolTipText("Click this button to save the current file.");
openButton = new JButton("Open File...", new ImageIcon("images/Open16.gif"));
openButton.addActionListener( this );
openButton.setToolTipText("Click this button to open a file.");
whiteshark = new JLabel("", new ImageIcon("images/gwhite.gif"), JLabel.CENTER);
Box boxH;
boxH = Box.createHorizontalBox();
boxH.add(openButton);
boxH.add(Box.createHorizontalStrut(15));
boxH.add(saveButton);
box = Box.createVerticalBox();
box.add(scrollpane);
box.add(Box.createVerticalStrut(10));
box.add(boxH);
box.add(Box.createVerticalStrut(15));
box.add(whiteshark);
add(box);
} // closes constructor CenterPanel
public void actionPerformed( ActionEvent evt )
{ // open method actionPerformed
JFileChooser jfc = new JFileChooser();
// these do not work !!
// -- set the file types to view --
// ExtensionFileFilter filter = new ExtensionFileFilter();
// FileFilter filter = new FileFilter();
//filter.addExtension("java");
//filter.addExtension("txt");
//filter.setDescription("Text & Java Files");
//jfc.setFileFilter(filter);
//Add a custom file filter and disable the default "Accept All" file filter.
jfc.addChoosableFileFilter(new JTFilter());
jfc.setAcceptAllFileFilterUsed(false);
// -- open the default directory --
// public void setCurrentDirectory(File dir)
// jfc.setCurrentDirectory(new File("C://divelog"));
jfc.setCurrentDirectory(defaultDirectory);
jfc.setSize(400, 300);
jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
Container parent = saveButton.getParent();
//========================= Test Button Actions ================================
//========================= Open Button ================================
if (evt.getSource() == openButton)
int choice = jfc.showOpenDialog(CenterPanel.this);
File file = jfc.getSelectedFile();
/* a: */
if (file != null && choice == JFileChooser.APPROVE_OPTION)
String filename = jfc.getSelectedFile().getAbsolutePath();
// -- compare the currentFile to the file chosen, alert of loosing any changes to currentFile --
// If (currentFile != filename)
// -- get the current directory name -------
// public File getCurrentDirectory( );
File f=new File(System.getProperty("user.dir"));
fileDirectory = jfc.getCurrentDirectory();
// -- remember the last directory used --
if (defaultDirectory != fileDirectory)
{defaultDirectory = fileDirectory;}
try
{ //opens try
comments.getLineCount( );
// -- clear the old data before importing the new file --
comments.selectAll();
comments.replaceSelection("");
// -- get the new data ---
br = new BufferedReader (new FileReader(file));
while ((str = br.readLine()) != null)
{//opens while
comments.append(str);
} //closes while
} // close try
catch (IOException ioe)
{ // open catch
comments.append(newline +"Open command not successful:" + ioe + newline);
} // close catch
// ---- display the values of the directory variables -----------------------
comments.append(
newline + "The f directory variable contains: " + f +
newline + "The fileDirectory variable contains: " + fileDirectory +
newline + "The defaultDirectory variable contains: " + defaultDirectory );
else
comments.append("Open command cancelled by user." + newline);
} //close if statement /* a: */
//========================= Save Button ================================
} else if (evt.getSource() == saveButton)
int choice = jfc.showSaveDialog(CenterPanel.this);
if (choice == JFileChooser.APPROVE_OPTION)
File fileName = jfc.getSelectedFile();
// -- get the current directory name -------
// public File getCurrentDirectory( );
File f=new File(System.getProperty("user.dir"));
fileDirectory = jfc.getCurrentDirectory();
// -- remember the last directory used --
if (defaultDirectory != fileDirectory)
{defaultDirectory = fileDirectory;}
//check for existing files. Warn users & ask if they want to overwrite
for(int i = 0; i < fileName.length(); i ++) {
File tmp = null;
tmp = (fileName);
if (tmp.exists()) // display pop-up alert
//public static int showConfirmDialog( Component parentComponent,
// Object message,
// String title,
// int optionType,
// int messageType,
// Icon icon);
int confirm = JOptionPane.showConfirmDialog(null,
fileName + " already exists on " + fileDirectory
+ "\n \nContinue?", // msg
"Warning! Overwrite File!", // title
JOptionPane.OK_CANCEL_OPTION, // buttons displayed
// JOptionPane.ERROR_MESSAGE
// JOptionPane.INFORMATION_MESSAGE
// JOptionPane.PLAIN_MESSAGE
// JOptionPane.QUESTION_MESSAGE
JOptionPane.WARNING_MESSAGE,
null);
if (confirm != JOptionPane.YES_OPTION)
{ //user cancels the file overwrite.
try {
jfc.cancelSelection();
break;
catch(Exception e) {}
// ----- Save the file if everything is OK ----------------------------
try
{ // opens try
BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
bw.write(comments.getText());
bw.flush();
bw.close();
comments.append( newline + newline + "Saving: " + fileName.getName() + "." + newline);
break;
} // closes try
catch (IOException ioe)
{ // open catch
comments.append(newline +"Save command unsuccessful:" + ioe + newline);
} // close catch
} // if exists
} //close for loop
else
comments.append("Save command cancelled by user." + newline);
} // end-if save button
} // close method actionPerformed
} //close constructor CenterPanel
} // Closes class CenterPanelThere is no way to be able to see MyDocumentListener class in the way you wrote. The reason is because MyDocumentListener class inside the constructor itself. MyDocumentListener class is an inner class, not suppose to be inside a constructor or a method. What you need to do is simple thing, just move it from inside the constructor and place it between two methods.
that's all folks
Qusay -
When i try to use max() & pow() in jdbc i get error "cannot resolve symbol"
hi,
when i tried to use pow() & max() in my jdbc programme i got compilation error "cannot resolve symbol".
even i have imorted java.math
this is the sample.
pr1= (fy/(L*B*pow(10.0,-6.0))+((6*mx)/(L*B*B*pow(10.0,-6.0)))+((6*mz)/(B*L*L*pow(10.0,-6.0))));
all of above are double.
and with max();
pr=max(pr1,pr2);
all of above are double.
please help.
thanks in advance.
satishhi
Hartmut
thanks hartmut;
i am new in java so i have some problems, but thanks for helping me.
please help me again.
as i have already posted another probleme which i have with selecting 1000 rows 1 by 1 from a table & manipulate 1 by 1 on that and then store all manipulated row to another table.
when i tried to do so i am able to select only 600 rows and manipulate them & store them.
i did not get any exception or any error.
can this possible that microsoft access driver has not that much capacity to provide 1000 rows or it is problem with jdbc.
please help.
satish
thanks again. -
Missing method body and cannot resolve symbol
I keep getting these two errors when trying to compile. I know that I need to call my fibonacci and factorial functions from the main function. Is this why I am getting the missing method body error? How do I correct this?
Am I getting the cannot resolve symbol because I have to set the num and fact to equal something?
Thanks
public class Firstassignment
public static void main(String[]args)
System.out.println();
public static void fibonacci(String[]args);
int even=1;
int odd=1;
while (odd<=100);
System.out.println(even);
int temp = even;
even = odd;
odd = odd + temp;
public static void factorial (String[]args);
for (int count=1;
count<=num;
count++);
fact = fact * count;
outputbox.printLine("Factorial of" + num + "is" + fact);Hey... :o)
the problem is that you've put semicolons at the end of the function signature, like this:
public static void fibonacci(String[]args);
}that should happen only when the function is abstract... so ur function should actually look like this:
public static void fibonacci(String[]args)
}also, i think you've missed out on the declarations (like what are fact and num??).... -
Cannot resolve symbol: class EJBObject
Using javac I get this compile error on this file Calculator.java
Calculator.java:1: cannot resolve symbol
symbol : class EJBObject
location: package ejb
import javax.ejb.EJBObject;
^
Calculator.java:5: cannot resolve symbol
symbol : class EJBObject
location: interface Calculator
public interface Calculator extends EJBObject {
Source code for Calculator.java
import javax.ejb.EJBObject;
import java.rmi.*;
public interface Calculator extends EJBObject {
public long add (int x, int y) throws RemoteException;
public long subtract (int x, int y) throws RemoteException;This code is from a book, so I will assume its a classpath problem. My
classpath looks like:
"C\QTJava.zip".;%J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib\locale
Also the following enviorment varibales have been set to:
J2EE_HOME
C:\Development\Java\j2sdkee1.3.1
JAVA_HOME
C:\Development\Java\jdk1.3.1
Path
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;%JAVA_HOME%\bin;%J2EE_HOME%\bin
I can run j2EE, like "j2EE -verbose" (no problems)
also run cloudscape, like "cloudscape -start" (no problems)
also can run deploytool, like "deploytool" (no problems, & deploy sample ear files from cd book)
Your help is appreicated. -
Cannot resolve symbol error even with class imported
Hi
I'm trying to print out a java.version system property but keep getting a
cannot resolve symbol error
symbol: class getProperty
location: class java.lang.System
I've looked at the API and getProperty() is a method of lang.System
Can anyone throw any light?
thanks
import java.lang.System;
class PropertiesTest {
public static void main(String[] args) {
String v = new System.getProperty("java.version");
System.out.println(v);
}Thanks Jos
It compiles but I now get a runtime error
Exception in thread "main"
java.lang.NoClassDefFoundError:PropertiesTest
What do you reckon is the problem?
thanks
java -cp .;<any other directories or jars>
YourClassNameYou get a NoClassDefFoundError message because the
JVM (Java Virtual Machine) can't find your class. The
way to remedy this is to ensure that your class is
included in the classpath. The example assumes that
you are in the same directory as the class you're
trying to run.I know it's a bad habit but I've put this file (PropertiesTest.java) and the compiled class (PropertiesTest.class) both in my bin folder which contains the javac compiler -
Error:cannot resolve Symbol class"name"
when I have compiled Bean class named SlBean which has primary class named pk, I recevied following error message(I compiled pk class without error) :
cannot resolve symbol
symbol : class pk
location: class SlBean
public pk ejbCreate(Sorry , its not classpath problem. You have to simply import the pk class if its in any package. I am assuming you have packaged your pk class with ejb jar file.
for eg. if your class is
package abc.xyz
public class pk
then in your bean class import
import abc.xyz.pk;
--Ashwani -
JSP page "cannot resolve symbol"
Hi,
I'm using j2sdk1.4.2_01 and tomcat-5.0.13. I'm developing within Eclipse 3.0.0 with the Tomcat plugin.
In my project ("Agenda2") i only created one class ("Persona"), that is correctely compiled (%TOMCAT_HOME%\webapps\Agenda2\WEB-INF\src\Persona.java results in %TOMCAT_HOME%\webapps\Agenda2\WEB-INF\classes\Persona.class, and 0 problems are shown in the Problems list.
In %TOMCAT_HOME%\webapps\Agenda2 i have my Edit.jsp, that begins with these lines:
<%@ page language="java" contentType="text/html" %>
<HTML>
<HEAD>
<TITLE>Edit</TITLE>
</HEAD>
<BODY>
<jsp:useBean id="personaAtt" class="Persona">
<jsp:setProperty name="personaAtt" property="*" />
</jsp:useBean>
....When i call the JSP from the browser, i get this error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 8 in the jsp file: /Edit.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Programmi\Java\tomcat-5.0.13\webapps\Agenda2\work\org\apache\jsp\Edit_jsp.java:48: cannot resolve symbol
symbol : class Persona
location: class org.apache.jsp.Edit_jsp
Persona personaAtt = null;
^The error message mentions line 8, which is the one following <BODY>, that is
<jsp:useBean id="personaAtt" class="Persona">My impression is that there is some path problem, but despite my tries i can't get it.
The folders tree under %TOMCAT_HOME%\webapps\Agenda2\ is:
-WEB-INF
--classes
--lib
--src
-work
--org
---apache
----jspDoes anybody can see the problem ?Thanks! I'm going to try to put the class into a package as both you have suggested, and i'll post here the result.
In the meantime i have a related newbie question:
putting the class into a package, is this kind of a workaround, or it's the "normal thing" ?
I mean, is it mandatory to put classes into a package in order to import them from JSP pages ?
It was my understanding that it isn't mandatory, but - from your replies and many other posts in this forum - i'm starting to think that i'm wrong. -
Solaris Deployment Failure for cannot resolve symbol on PersistentContainer
Hello, I'm having trouble diagnosing the following deployment failure.
What are some common causes of this? My server was created using an
Express Integration domain with some custom JMS destinations added
afterwards via the console. I am deploying an application built with
Workshop (straight from workshop). I copied over an application from
Windows to Solaris, deleted the .workshop directory and .beabuild.txt
and rebuilt the application to deploy.
I get this error a few times.
####<Aug 21, 2003 10:48:19 AM EDT> <Info> <EJB> <rhino> <cgServer>
<ExecuteThread: '1' for queue: 'weblogic.kernel.System'> <<WLS Kernel>>
<> <BEA-012033> <Compiling generated EJB classes produced the following
Java compiler output:
/export/data/ident/bea/user_projects/domains/ident1Server.conf/./cgServer/.wlnotdelete/EJBCompilerCache/-7dxi2hv35mro/com/bea/wlwgen/PersistentContainer_3fq3ar_Impl.java:143:
cannot resolve symbol
symbol : class BMPContainerBean$DuplicateKeyRemoteException
location: package bean
perchance you meant 'BMPContainerBean.DuplicateKeyRemoteException'
throws
com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
^
1 error
This then causes other errors repeating that the deployment failed (let
me know if you need more to diagnose this):
Exception:weblogic.management.ApplicationException: prepare failed for
.workshop/myApp/EJB/myProc_1trtqtoxcz4uv
Module: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv Error:
Exception preparing module:
EJBModule(.workshop/myApp/EJB/myProc_1trtqtoxcz4uv,status=NEW)
Unable to deploy EJB: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv from
.workshop/myApp/EJB/myProc_1trtqtoxcz4uv:
Compiler failed executable.execBut by default WLS8.1 comes with jdk141_02 ...correct ?
AND what i understand is that...the bug you posted is related to a bug in jdk1.4.2
....correct ??
correct me if i wrong.
-sangita
Steven Ostrowski <[email protected]> wrote:
It looks like this is a bug in the BEA-generated code that is then
compiled by WLS. The generated code was using the Class1$Class2 notation
to reference the class, but since $ is a valid character in the class
name, this does not behave as intended. This used to be a bug in
pre-1.4.2 but is now fixed in 1.4.2 (look at bug 4635044, and this is
also mentioned in the 1.4.2 release notes and the Java Developer forums).
The generated code should be:
com.bea.wlw.runtime.core.bean.BMPContainerBean.DuplicateKeyRemoteException
not
com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
Thanks again for the good response. I'll send this in to BEA support.
Steven Ostrowski wrote:
One other thing to add, this was fixed by changing the JAVA_HOME
variable inside of the startWeblogic.sh script. Setting it in workshop
did not change anything.
Steven Ostrowski wrote:
Wow, you hit it right on target! I was using 1.4.2 then tried it on
1.4.1_03 and it deployed fine.
Is this a bug in BEA or in the JDK? In either case, where should I
report this bug?
Thanks again
Rob Woollen wrote:
What version of the JDK are you using? I believe they changed the
inner class naming conventions in 1.4.2, and it's breaking lots of
people.
-- Rob
Steven Ostrowski wrote:
Hello, I'm having trouble diagnosing the following deployment
failure. What are some common causes of this? My server was created
using an Express Integration domain with some custom JMS
destinations added afterwards via the console. I am deploying an
application built with Workshop (straight from workshop). I copied
over an application from Windows to Solaris, deleted the .workshop
directory and .beabuild.txt and rebuilt the application to deploy.
I get this error a few times.
####<Aug 21, 2003 10:48:19 AM EDT> <Info> <EJB> <rhino> <cgServer>
<ExecuteThread: '1' for queue: 'weblogic.kernel.System'> <<WLS
Kernel>> <> <BEA-012033> <Compiling generated EJB classes produced
the following Java compiler output:
/export/data/ident/bea/user_projects/domains/ident1Server.conf/./cgServer/.wlnotdelete/EJBCompilerCache/-7dxi2hv35mro/com/bea/wlwgen/PersistentContainer_3fq3ar_Impl.java:143:
cannot resolve symbol
symbol : class BMPContainerBean$DuplicateKeyRemoteException
location: package bean
perchance you meant 'BMPContainerBean.DuplicateKeyRemoteException'
throws
com.bea.wlw.runtime.core.bean.BMPContainerBean$DuplicateKeyRemoteException
^
1 error
This then causes other errors repeating that the deployment failed
(let me know if you need more to diagnose this):
Exception:weblogic.management.ApplicationException: prepare failed
for .workshop/myApp/EJB/myProc_1trtqtoxcz4uv
Module: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv Error:
Exception preparing module:
EJBModule(.workshop/myApp/EJB/myProc_1trtqtoxcz4uv,status=NEW)
Unable to deploy EJB: .workshop/myApp/EJB/myProc_1trtqtoxcz4uv from
.workshop/myApp/EJB/myProc_1trtqtoxcz4uv:
Compiler failed executable.exec -
BufferedReader cannot resolve symbol
Hi,
I need some help with a java program which reads xml files to a specified location, running it on a UNIX machine using Java 1.4.1. I modified the code to include the BufferedReader class, but it keeps complaining about not being able to resolve symbol at line 50 & 53. Any help here would be appreciated, since I'm a newbie.
bash-2.05$ javac outputScript.java
outputScript.java:50: cannot resolve symbol
symbol : constructor InputStreamReader (java.lang.String)
location: class java.io.InputStreamReader
BufferedReader in = new BufferedReader(new InputStreamReader("in"));
^
outputScript.java:53: cannot resolve symbol
symbol : method available ()
location: class java.io.BufferedReader
while (in.available() !=0)
Here's the code:
//package cognos8_3;
import java.io.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.File;
* outputScript.java
* Copyright Cognos Incorporated. All Rights Reserved.
* Cognos and the Cognos logo are trademarks of Cognos Incorporated.
* Description: (KB 1013700) - Sample script that will rename output files generated by CM.OUTPUTLOCATION - Cognos 8.3
class outputScript
public static void main(String args[])
String reportName = "";
String reportViewName = "";
String outputLocation = "/data/cognos/rn_filecp/";
String defName = "";
String ofTime = "";
String burstKey = "";
int countRenamed = 0;
// get the list of desc files in the outputlocation
File descFiles = new File(outputLocation);
String[] children = descFiles.list();
if (children == null || children.length == 0)
System.out.println("Invalid file location or no reports found to rename.");
else
System.out.println("Found " + children.length + " files in this location, search for file names containing '_desc.'.");
for (int i=0; i<children.length; i++)
try
// Get filename of file or directory
String filename = children;
if (filename.indexOf("_desc.")>=0)
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream(outputLocation+filename);
FileInputStream bis = new FileInputStream(fstream);
BufferedReader in = new BufferedReader(new InputStreamReader("bis.in"));
// Continue to read lines while there are still some left to read
while (in.available() !=0)
String temp = in.readLine();
System.out.println(temp);
// check for report name
if (temp.indexOf("report[@name=")>0)
// get beginning of name
int startIndex = temp.indexOf("report[@name='");
String startString;
int endIndex = 0;
if (startIndex > 0)
startString = temp.substring(startIndex);
startIndex = startString.indexOf("'") + 5; //' 6 characters
endIndex = startString.lastIndexOf("'");
else
startIndex = temp.indexOf("report[@name=");
startString = temp.substring(startIndex);
startIndex = startString.indexOf("@name=") + 6; //' 6 characters
endIndex = startString.lastIndexOf("]");
// get report name
reportName = startString.substring(startIndex+1, endIndex);
//System.out.println("Found report name - " + reportName);
else if (temp.indexOf("reportView[@name=")>0)
// get beginning of name
int startIndex = temp.indexOf("reportView[@name='");
String startString;
int endIndex = 0;
if (startIndex > 0)
startString = temp.substring(startIndex);
startIndex = startString.indexOf("'") + 5; //' 6 characters
endIndex = startString.lastIndexOf("'");
else
startIndex = temp.indexOf("reportView[@name=");
startString = temp.substring(startIndex);
startIndex = startString.indexOf("@name=") + 6; //' 6 characters
endIndex = startString.lastIndexOf("]");
// get report name
reportViewName = startString.substring(startIndex+1, endIndex);
//System.out.println("Found reportView name - " + reportViewName);
else if (temp.indexOf("</fileName>")>0) //check for default name
defName = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
else if (temp.indexOf("asOfTime")>=0) // get the time to assure uniqueness when saving
ofTime = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
// clean colons from time
ofTime = ofTime.replaceAll(":","_");
else if (temp.indexOf("</burstKey>")>=0)
burstKey = temp.substring(temp.indexOf(">")+1, temp.lastIndexOf("<"));
in.close();
if (reportName.length() == 0)
reportName = reportViewName;
//System.out.println("Renaming using view name - no report name found");
String format = defName.substring(defName.length()-3, defName.length());
// new description xml file
File file = new File(outputLocation+filename);
File newDescFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"DESC_" + format+ ".xml");
// new renamed specific format file.
File file3 = new File(outputLocation+defName);
File newDefFile = new File(outputLocation + reportName+"_"+burstKey+"_"+ofTime+"."+format);
boolean success = file3.renameTo(newDefFile);
if (!success)
// File was not successfully renamed
System.out.println("ERROR attempting to rename - " + file3.getAbsolutePath() + " to \n\t\t" +
newDefFile.getAbsolutePath());
else
countRenamed++;
// File was successfully renamed
System.out.println(countRenamed +") Renamed - " + file3.getAbsolutePath() + " to \n\t\t" +
newDefFile.getAbsolutePath());
// Rename file (or directory)
success = file.renameTo(newDescFile);
if (!success)
// File was not successfully renamed
System.out.println("ERROR attempting to rename - " + file.getAbsolutePath() + " to \n\t\t" +
newDescFile.getAbsolutePath());
else
// File was successfully renamed
System.out.println(" - " + file.getAbsolutePath() + " to \n\t\t" +
newDescFile.getAbsolutePath());
catch (Exception e)
System.err.println("File input error " + e.getMessage()) ;
System.out.println("Complete.");
Thanks,
Nick
Edited by: nickmills on Aug 31, 2008 5:05 PMFirst, you only need to create the FileInputStream once. Then that's what you pass to the InputStreamReader constructor. Your code for reading from the BufferedReader is also wrong.FileInputStream fstream = new FileInputStream(outputLocation+filename);
// FileInputStream bis = new FileInputStream(fstream); <-- remove this line
BufferedReader in = new BufferedReader(new InputStreamReader(fstream));
// available() doesn't do what you think it does; forget about it.
// Here's the standard way to use a BufferedReader
String line = null;
while ((line = in.readLine()) != null)
// process 'line'
} There are probably other errors in the code, but reading all that unformatted code is too much of a hassle. In future, please use {code} tags when posting source code.
Maybe you are looking for
-
I love Apple and I use all product. iPhone 3,3s,4,4s,5, iPad and Mac Air(now no more 3,3s and 4)... Only one thing I want to know is... What can I do if some one spy on my phone? How do I protect all my stuff that I put in my phone?
-
This PostScript file was created from an encrypted PDF file.
I have a postscript file which has been created from secure or encrypted (opening restriction) pdf. Now when i use distiller to convert this postscript file to pdf then distiller cannot produce a pdf file. The log file contains following text: This P
-
I cancelled my subscription. How do I get to someone for a refund?
I have wandered through the support maze and ended up here. Just looking for the right place to secure a refund.
-
I have purchased loads of music and audiobooks, the last on was in April...Now when I sign in, it flips me to the billing info screen, my info has not changes, I add in the security code, click done. When I go to buy again, the same thing happens. An
-
ADF11g: business logic in ADF BC or PLSQL?
Hi All, For a new development in ADF 11g , where we should put our business logic: In ADF BC or in PLSQL? What if we write all the bussiness logic in plsql? Because if tomorrow ADF goes(which I know is not ging to happen soon), we can expose pl/sql a