• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

import xxx (class) cannot be resolved

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import xxx (class) cannot be resolved



Hi guys
I make webcenter project using jdeveloper tools. I have some problem on my project. when I deploy my project on a server, there are some error on my project.


Here may code project


"<%@ page contentType = "text/html; charset=UTF-8"
pageEncoding = "UTF-8"
import = "javax.portlet.*, java.util.*, dashbreliab.boundary.Dashboard.DashboardLeadingLogging,
dashbreliab.boundary.Dashboard.resource.DashboardLeadingLoggingBundle, java.sql.PreparedStatement,
java.sql.ResultSet, java.sql.Connection, dashbreliab.Connection.ConnectionDashb, dashbreliab.LeadLag.LeadLagSharedResource,
dashbreliab.LeadLag.LeadLagEngine, dashbreliab.entity.DataERP.EntityScore"%>
<%@ taglib uri = "http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects/>
<portlet:actionURL var="reset" />

<%
// is write mode ?
boolean writeMode = (Boolean) portletSession.getAttribute("writeMode");
//def value for vars
String[] colName = ((String) portletSession.getAttribute("colName")).split(",");
String[] colNameHuman = ((String) portletSession.getAttribute("colNameHuman")).split(",");
String[] addDesc = ((String) portletSession.getAttribute("addDesc")).split(";");
String[] valuesActual = new String[colName.length];
String[] labelSatuan = LeadLagSharedResource.labelSatuan;
//String[] valuesTarget = new String[colName.length];

Connection con = ConnectionDashb.createReadOnlyCon();

String sql;
PreparedStatement stmt;
ResultSet rs;

if(portletSession.getAttribute("ll_year",PortletSession.APPLICATION_SCOPE) == null){

valuesActual[1] = ""+LeadLagEngine.getYearNow(con, "LEADING_LOGGING_ACTUAL");
valuesActual[0] = ""+LeadLagEngine.getMonthNow(con, "LEADING_LOGGING_ACTUAL", Integer.parseInt(valuesActual[1]));

}else{

valuesActual[1] = (String)portletSession.getAttribute("ll_year",PortletSession.APPLICATION_SCOPE);
valuesActual[0] = (String)portletSession.getAttribute("ll_month",PortletSession.APPLICATION_SCOPE);

}
if(portletSession.getAttribute("error") == null){

sql = "SELECT * FROM LEADING_LOGGING_ACTUAL WHERE YEAR = ? AND MONTH = ?";
stmt = con.prepareStatement(sql);
stmt.setInt(1, Integer.parseInt(valuesActual[1]));
stmt.setInt(2, Integer.parseInt(valuesActual[0]));
rs = stmt.executeQuery();
if(rs.next()){
for(int i=1;i<colName.length;i++){
valuesActual[i] = rs.getString(colName[i].trim());
}
}
rs.close();
stmt.close();

}else{
for(int i=2;i<colName.length;i++){
valuesActual[i] = (String)portletSession.getAttribute("actual_"+colName[i].trim().toLowerCase());
//valuesTarget[i] = (String)portletSession.getAttribute("target_"+colName[i].trim().toLowerCase());
}
}
rs = null;
stmt = null;


ArrayList<Double> scores = LeadLagEngine.getScoreData(con, Integer.parseInt(valuesActual[0]), Integer.parseInt(valuesActual[1]));

EntityScore sc = LeadLagEngine.getCalculatedScore(scores);

String noDataLabel = LeadLagSharedResource.nullValuesLabel;
con.close();
con = null;
%>
<style type="">
.lead{
background-color: Green;
color: White;
}
.lag{
background-color: Red;
color: White;
}
.error{
color: Red;
}
</style>
<% if(portletSession.getAttribute("error") != null){ %>
<div class="error">
SOME ERROR : <br />
<%=portletSession.getAttribute("errorMessage")%>
Please Fix This.. <br />
<a href="<%=reset%>">Reset Form</a>
</div>
<% } %>

<form action="<portlet:actionURL/>" method="POST">
<input type="hidden" name="act" value="change_year_month"/>
CURRENT YEAR =
<input type="text" name="year" value="<%=(valuesActual[1])%>"/>
CURRENT MONTH =
<select name="month">
<option value="1" <%if(valuesActual[0].equals("1")){%>selected="selected"<%}%>>Januari</option>
<option value="2" <%if(valuesActual[0].equals("2")){%>selected="selected"<%}%>>Pebruari</option>
<option value="3" <%if(valuesActual[0].equals("3")){%>selected="selected"<%}%>>Maret</option>
<option value="4" <%if(valuesActual[0].equals("4")){%>selected="selected"<%}%>>April</option>
<option value="5" <%if(valuesActual[0].equals("5")){%>selected="selected"<%}%>>Mei</option>
<option value="6" <%if(valuesActual[0].equals("6")){%>selected="selected"<%}%>>Juni</option>
<option value="7" <%if(valuesActual[0].equals("7")){%>selected="selected"<%}%>>Juli</option>
<option value="8" <%if(valuesActual[0].equals("8")){%>selected="selected"<%}%>>Agustus</option>
<option value="9" <%if(valuesActual[0].equals("9")){%>selected="selected"<%}%>>September</option>
<option value="10" <%if(valuesActual[0].equals("10")){%>selected="selected"<%}%>>Oktober</option>
<option value="11" <%if(valuesActual[0].equals("11")){%>selected="selected"<%}%>>Nopember</option>
<option value="12" <%if(valuesActual[0].equals("12")){%>selected="selected"<%}%>>Desember</option>
</select>
<input type="submit" value="Change Year and Month"></input>
<br/>
<% if(valuesActual[valuesActual.length-1] != null && !valuesActual[valuesActual.length-1].equals("")){ %>
LAST UPDATE =
<%=(valuesActual[valuesActual.length-1])%>
<% } %>
</form>
<hr/>
<form action="<portlet:actionURL/>" method="POST">
<% if(writeMode){ %>
<input type="submit" value="Change Value"/>
<% } %>
<input type="hidden" name="act" value="change_value"/>
<input type="hidden" name="year" value="<%=(valuesActual[1])%>"/>
<input type="hidden" name="month" value="<%=(valuesActual[0])%>"/>
<table border="1" width="100%">
<thead>
<tr>
<td>No.</td>
<td>Key.</td>
<td>Actual.</td>
<td>Score.</td>
</tr>
</thead>

<tbody>
<%
String cssClass = "lead";
for(int i=2;i<colName.length-1;i++){
if(i-2 >= LeadLagSharedResource.lag_start && i-2 <= LeadLagSharedResource.lag_end){
cssClass = "lag";
}else{
cssClass = "lead";
}

if(valuesActual[i] != null && Float.parseFloat(valuesActual[i]) == LeadLagSharedResource.nullValues){
valuesActual[i] = LeadLagSharedResource.nullValuesLabel;
}
%>
<tr class="<%=cssClass%>">
<td><%=i%></td>
<td><%=colNameHuman[i]%><br /><i><%=addDesc[i-2]%></i></td>
<td><% if(!writeMode){ %>
<input readonly="readonly" type="text" name="actual_<%=colName[i].trim().toLowerCase()%>"
value="<%if(valuesActual[i] == null){%>0<%}else{%><%=valuesActual[i]%><%}%>" size="10" />
<%=labelSatuan[i-2]%>
<% }else{ %>
<input type="text" name="actual_<%=colName[i].trim().toLowerCase()%>" id="actual_<%=i%>"
value="<%if(valuesActual[i] == null){%>0<%}else{%><%=valuesActual[i]%><%}%>" size="10" />
<%=labelSatuan[i-2]%>
<input type="button" onclick="document.getElementById('actual_<%=i%>').value = '<%=noDataLabel%>';" value="Set as No Data">
<% } %>
</td>
<td>
<input type="text" disabled="disabled" value="<%if(valuesActual[i] == null){%>0<%}else{%><%=scores.get(i-2)%><%}%>" size="5" /> %
</td>
</tr>
<% if(i-2 == LeadLagSharedResource.lag_end){ %>
<tr class="<%=cssClass%>">
<td></td>
<td>SCORE LEGGING</td>
<td>
</td>
<td>
<input type="text" disabled="disabled" value="<%if(valuesActual[i] == null){%>0<%}else{%><%=sc.getScoreLag()%><%}%>" size="5" />
</td>
</tr>
<% } if(i-2 == LeadLagSharedResource.lead_end){ %>
<tr class="<%=cssClass%>">
<td></td>
<td>SCORE LEADING</td>
<td>
</td>
<td>
<input type="text" disabled="disabled" value="<%if(valuesActual[i] == null){%>0<%}else{%><%=sc.getScoreLead()%><%}%>" size="5" />
</td>
</tr>
<% } %>
<% } %>
</tbody>
</table>
</form>"

I make all of my class inside package. And absolutely call every class include package name. For example on that code above.
I have package name dashbreliab.boundary.Dashboard and DashboardLeadingLogging is my class inside that package. I think that it has fullfill the rules.
But , i didn't work at all. There some error appear.

And Here the error

"import DashboardLeadingLogging cannot be resolved
import DashboardLeadingLoggingBundle cannot be resolved"

and there are so many same error in another jsp file.

if anyone can help me, of course i'll so happy.
Please kind for help me solve this problem..

Thankyou

 
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Timotius,

Welcome to the ranch!

First of all, please enclose all code in code brackets to make it easy to read. It's quite easy to do just add '' for example:



You'll find that you'll get more reponses that way.

I make all of my class inside package. And absolutely call every class include package name. For example on that code above.
I have package name dashbreliab.boundary.Dashboard and DashboardLeadingLogging is my class inside that package. I think that it has fullfill the rules.
But , i didn't work at all. There some error appear.



Failure to resolve imports is usually related to the class library or jar files not being loaded in your project. What development environment or IDE are you using (Netbeans, Eclipse, plain command line, etc)? It is possible that DashboardLeadingLogging requires a parent class that is not present in your classpath. You might want to do some research of the required classes / jar files needed for this class and load the jar files in your project.

On the basis of the information you've given this is what I can suggest for now. If you can give more information about your development environment, JDP version and operating system I might be able to assist further. Hope this helps!
 
Metalia Wardhani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm so sorry for my ignorance. I'm newbie in this forum. Just create this last night to get information of my problem..
Thanks for telling me about how to make the right post

I am Using Jdeveloper 11 g 11.1.1.6.0 to develop that project and Linux Fedora for the operating system.
all the parent class already include on that import. is there correlation of it?
 
Jay Tai
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome Timotius,

Do you know how to access your project build library? I haven't used JDev in a while so I can't tell you the precise steps needed to view your build library.

I can tell you that the classes you are referring to need to be loaded in your build library (either as individual classes, jar files or libraries), in order to be used by import statements. In other IDEs (Netbeans and Eclipse) you can reach the build library by going through the project properties (right click ProjectName --> select properties --> view build library --> add required jar files or libraries --> save and exit).

If I remember correctly the process isn't much different for JDev. It would help if you could post the contents of your build library. If in fact the required classes are loaded then we can eliminate that as a cause.
 
Metalia Wardhani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
error was appear after deploy to the server.

I can't find "right click ProjectName --> select properties --> view build library --> add required jar files or libraries --> save and exit" on Jdev..
But , I find something, maybe same with it. when i deploy my project to the server. I'll do it twice. First, deploy to the .war and Second,deploy to the server (WC_Portlet).

I can find WEB-INF class and lib when i select edit .war . inside WEB-INF classes there are all of my class and inside lib, I can find my library .jar.
is that same with your suggestions? all of my class and .jar are inside folder classes and lib. So, what's the matter with my project?

Please help me solve this problem. I've search that error for two night but had not yet met the solutions.
Thankyou
 
Jay Tai
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So during the build process everything ran ok and you did not encounter any build errors? The error is purely a runtime error?

Failure to resolve indicates at least one of four causes that immediately comes to mind:

1) DashboardLeadingLogging and DashboardLeadingLoggingBundle has not been correctly loaded and deployed to the project library



I can find WEB-INF class and lib when i select edit .war . inside WEB-INF classes there are all of my class and inside lib, I can find my library .jar.
is that same with your suggestions? all of my class and .jar are inside folder classes and lib. So, what's the matter with my project?



Yes, BUT the fact that you see the classes and still get a 'failed to resolve' error tells me that your entire deployment configuration is incorrect and didn't result in deployment of the right file to the right context . So is the structure of the deployment the same in the war file AND the WC_Portlet?

If you're having trouble accessing the project build library and other configuration tools in Jdev I would really recommend you to read the Oracle documentation for J-Dev and Webcenter thoroughly.

2) Failure to load generic WebCenter classes. I'm not sure about the class structure and parent classes for DashboardLeadingLogging and DashboardLeadingLoggingBundle.



I make webcenter project using jdeveloper tools



From what I know about Oracle Webcenter it requires some hefty configuration, including quite an extensive class library. So you have to ask if you're sure that you have all the generic Webcenter configuration files. Have you tried to run a generic Webcenter application using any of Oracle's standard examples? If you can do that then you know you have the generic configuration correct. After that you should examine how your own modification in the form of classes such as DashboardLeadingLogging and DashboardLeadingLoggingBundle interact with the WebCenter library, as well as parent and system classes

3) Application server configuration. What web or application server are you using. I believe WebCenter often uses WebLogic server with some modifications. WebLogic (like other servers) requires some configuration to use it with WebCenter. Here you will definitely need to consult the Oracle documentation


4) Syntax errors. As obvious as this sounds it's the cause of SO MANY configuration and deployment errors. Are you being consistent with the way you're spelling and 'casing' the classes? Check and double check!


To help you further it would be useful to see a more detailed stack trace. I'm sure the error you got was more than two lines long. Finally I would just like to say that you're developing using quite a sophisticated technology (WebCenter) so you really need to have a strong understanding of Jdeveloper fundamentals and those of WebCenter.
 
Metalia Wardhani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's not what I mean...
When I create that project without deploy, everything is fine (There's no red underline inside that code), But after deploying to the server, some error appear.

I have some question about your suggestions:
1. There's a statement

So is the structure of the deployment the same in the war file AND the WC_Portlet?



i don't know what you mean about it. as far as I know, just deploy project as .war file and deploy again into the weblogic. Is there some configuration before it?
I thing i must tell you about this....
I remember one thing. previously, i was deploy project from my notebook. and pointer into the IP server. it turn successfully. But afterward, the server migrate into another room and must reset with another IP.
the problem: I couldn't deploy project from my notebook again. therefore, I copied project into Computer server. and deploy project from Computer server. Is it any correlation with my problem?

2. Second Statement

From what I know about Oracle Webcenter it requires some hefty configuration, including quite an extensive class library. So you have to ask if you're sure that you have all the generic Webcenter configuration files. Have you tried to run a generic Webcenter application using any of Oracle's standard examples? If you can do that then you know you have the generic configuration correct.



I never use Oracle Weblogic prevously. it's my first time experience develop project with it. So, i doesn't know about what you've suggested. can you help me getting that kind of configuration?

3. Third statement

Are you being consistent with the way you're spelling and 'casing' the classes? Check and double check!



i've checked many times. I also rewrite that import. so it can't wrong write. I have a question about it. I give package name. is that package name too long, so it can't read with weblogic?


Thankyou always answering my problem
 
Jay Tai
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i don't know what you mean about it. as far as I know, just deploy project as .war file and deploy again into the weblogic



If you don't know what I mean about the deployment structure then I really suggest you do some research to understand deployment in Weblogic, as well as deployment guidelines for WebCenter documentation. I don't get why you would want to have two deployments. Unless you HAVE to have two deployments just stick to deploying to WebLogic. War deployment is only necessary when you want to use the war file to deploy or for application portability.




I never use Oracle Weblogic prevously. it's my first time experience develop project with it. So, i doesn't know about what you've suggested. can you help me getting that kind of configuration?



I'm really sorry that I can't help you configure Weblogic. First of all that's not the subject oof our post (you should post a new topic for that subject). Secondly, it can be quite an involved process to correctly configure WebLogic. I would not want to try and give you shortcuts to the Oracle documentation. You need to read Oracle documentation I think. If you were asking about some of the more basic open source technologies (like Apache and JBoss) it's possible to give you some quick tips, but you're asking about Oracle. It's not the simplest of technologies, especially if you lack the fundamental knowledge.

I give package name. is that package name too long, so it can't read with weblogic?



I think what you're trying to say here is that you're adding package names to your import statements. You should not need to do that. If the correct class libraries and deployment configurations are there a normal import statement will work

My advice to you is either to learn the Oracle WebLogic and WebCenter technologies in more detail or to start with some more basic portal technologies (Liferay, Spring, Apache, etc) server technologies (Apache, Jetty, JBoss, etc).

To help you any further I would at least need to see a stack trace of your error

 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do not use java codes in jsp. It's a very old practice. You should have servets and other helper classes for this purpose. Jsp is used as view just to produce the output.
 
Metalia Wardhani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okee...
Thankyou for helping me try to solve my problem...
Overall I conclude your suggest is to read the entire oracle documentation especially webcenter and weblogic documentation..
I'll looking for it soon..

anyway, there's a statement

My advice to you is either to learn the Oracle WebLogic and WebCenter technologies in more detail or to start with some more basic portal technologies (Liferay, Spring, Apache, etc) server technologies (Apache, Jetty, JBoss, etc)



Doing this project, just for my final project. I am a student from Informatics Engineering Department of Institut Teknologi Sepuluh Nopember Surabaya, Indonesia. I pick up a topic and use Jdeveloper + webcenter weblogic for the technology. So, I can't switch with another, because it's almost duedate for collecting the result.
But, overall thankyou for your helping my problem. Will you help me again if I have some problem in the future?
 
Jay Tai
Ranch Hand
Posts: 222
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post a stack trace I'll try to see if there's any glaring issues and immediate solutions. Would be happy to help i future and there's plenty of folks more qualified than I am in the forum
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic