This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 123318 - jsp code completion not working
Summary: jsp code completion not working
Status: RESOLVED WORKSFORME
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP Parser (show other bugs)
Version: 6.x
Hardware: All Windows Vista
: P2 blocker with 1 vote (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 89133 123319 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-12-04 05:47 UTC by porkoboe
Modified: 2008-10-08 10:16 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
simple output when code completion fails (40.35 KB, text/plain)
2007-12-04 06:06 UTC, porkoboe
Details
sam as above, with xml debug (829.23 KB, text/plain)
2007-12-04 06:07 UTC, porkoboe
Details
output when code completion is working (with xml debug) (540.34 KB, text/plain)
2007-12-04 06:08 UTC, porkoboe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description porkoboe 2007-12-04 05:47:46 UTC
I have been struggling with the code completion in netbeans 6`s jsp editor.

the code completion functionality is very intermittent, working for some projects and not others.

ie, when writing the jsp scriptlet:
<%
 String foo = new String();
 foo.<--should get the string api on popup, instead i get "no suggestions"
%>

Code completion does not work at all for my larger projects, i also intermittently get this error in the ide when a jsp
editing in a larger project is open:

Exception in thread "Init TldLocationCache" java.lang.AbstractMethodError:
gnu.xml.dom.DomDocument.setDocumentURI(Ljava/lang/String;)V
	at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:226)
	at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:274)
	at org.apache.jasper.compiler.TldLocationsCache.processWebDotXml(TldLocationsCache.java:374)
	at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:312)
	at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:272)
	at org.netbeans.modules.web.jspparser_ext.WebAppParseSupport$InitTldLocationCacheThread.run(WebAppParseSupport.java:1005)

could the jsp module be using different xml libraries, perhaps even those from projects classpaths?, i know there are a
few old xml implementations in one of my projects classpaths.

I have attached two messages.log file with the -Djaxp.debug=1 switch enabled to capture what its doing with the xml
parsers. one when code completion is working and one where code completion does not work.

cheers,
Comment 1 porkoboe 2007-12-04 06:03:38 UTC
*** Issue 123319 has been marked as a duplicate of this issue. ***
Comment 2 porkoboe 2007-12-04 06:06:36 UTC
Created attachment 53812 [details]
simple output when code completion fails
Comment 3 porkoboe 2007-12-04 06:07:32 UTC
Created attachment 53813 [details]
sam as above, with xml debug
Comment 4 porkoboe 2007-12-04 06:08:31 UTC
Created attachment 53814 [details]
output when code completion is working (with xml debug)
Comment 5 Marek Fukala 2007-12-04 09:31:35 UTC
I guess the java.lang.AbstractMethodError is the cause of the problem. The completion cannot provide the proper items if
the parsing fails.
Comment 6 Petr Jiricka 2008-02-18 12:32:35 UTC
Reporter, can you please specify the libraries you are using in your project, or attach the whole project? This would
help us simulate this error. Thanks.
Comment 7 Tomas Mysik 2008-02-25 09:53:36 UTC
We need to reproduce this error to be able to help you - please see the last comment ('pjiricka Mon Feb 18 12:32:35 
+0000 2008'). Thanks.
Comment 8 Tomas Mysik 2008-02-25 17:15:19 UTC
*** Issue 89133 has been marked as a duplicate of this issue. ***
Comment 9 Tomas Mysik 2008-03-28 15:21:36 UTC
No response from reporter, so closing as WORKSFORME. If the problem still exists, reopen this issue and provide 
requested information. Thanks.
Comment 10 roti 2008-07-25 13:58:04 UTC
When you have a Java free-form project (not a Web free-form project), and add another source folder (for example a 
modul) which is at a different location, the code completion will not work in the java source and either in jsp. 

In nb 6.1 with the same project, import finds the modul in java sources only, in jsp the <%@page import="..."%> will 
find the package, but in the jsp, the code completion is still bad.

This is the main issue, holding me at nb5.5, because in nb5.5 it works fine.

Tested with version: Netbeans 6.5 200807040101 development version.
I added servlet-api.jar and jsp-api.jar to the project from tomcat 5.5.26
Comment 11 Tomas Mysik 2008-08-12 10:17:03 UTC
I will look at it, thanks.
Comment 12 Tomas Mysik 2008-08-12 14:46:20 UTC
To roti: do you get the same error as in the initial description? If not, please file a new issue. If yes, are you 
able to attach your project or create a sample one? Do you get this exception for all your Web applications? What 
libraries are you using in your project? What type of project?

To porkoboe: could you please provide more information - what type of project are you using, regular Web Application 
or Web Free-Form Application? Also, are you able to provide a sample project I can play with? You have provided 2 
files - for working and failing code completion - does it mean that it fails only for some project? Or is it random 
issue? It would be very helpful if you could provide exact steps to reproduce or even better attach some sample 
project I can use. I've tried to reproduce your issue (your first description), but it works for me.

Thanks a lot.
Comment 13 roti 2008-08-19 09:02:34 UTC
ok, I figured it out: I mustn't use Java Free-form project. I must create a Web Free-form project.
In this case, the jsp code completion works with modules in most cases, except this one:

When I have an include in jsp like:
<%@include file="../../html/portal/adminHeader.html"%>
nb will indicate the following error with red in the status bar:
"/company/myJsp.jsp(18,0) PWC6308: The path /company/../../hmtl/portal/adminHeader.html specifies a resource outside 
the web application"
and from that point, the code completion wont work. If I comment out the include, the completion will work immediatelly.

my directory structure:
src
 |---com
 |    |---mypackage
 |    |    `---classes
 |   ...
 |---jsp
 |    |---company
 |    ... 
 |---html
 |    |---portal
 |   ...

My path is ok, because my project get built well, and even the path completion works great for that path.

In the project my Web pages folder set to: \src\jsp
and the java sources set to /src

(in nb5.5 it was not a problem)

This occurs with nvb6.1 current, and nb6.5 beta too
Comment 14 Tomas Mysik 2008-08-20 09:44:24 UTC
Thanks, I will look at it.
Comment 15 Tomas Mysik 2008-08-20 12:11:27 UTC
To roti:
The error is right because your project has incorrect directory structure - you say that your document root 
is "src/jsp" but you are trying to include file which is *not* located underneath the document root. Moreover, you are 
mixing Java sources and Web sources which can cause problems, see issue #121684 for more information and explanation.
One more note - I already asked you whether you get the same error as in the initial description - apparently not, so 
please do not comment more to this issue, feel free to file a new one. Thanks a lot.

To porkoboe:
Marking back as INCOMPLETE, could you please answer my questions so I could help you? Thanks a lot.
Comment 16 roti 2008-08-21 08:28:15 UTC
Ok, I realized, that I have to change my "Web pages folder" property to /src instead of /src/jsp to get it work.
Thanks for your help.
Comment 17 Tomas Mysik 2008-10-08 10:16:23 UTC
No response from the original reporter for a long time, no duplicates as well, so closing as WORKSFORME. Please, feel 
free to reopen if the problem still exists and provide requested information. Thanks for reporting.