This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error 500 Unable to compile  RSS feed

 
Marv Dexter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help!
I am just starting with JSP, I am getting this message:
HTTP ERROR: 500 Unable to compile class for JSP An error occurred at line: -1 in the jsp file: null Generated servlet error: [javac] Compiling 1 source file
this is the simple text,
<HTML>
<BODY>
Hello! The time is now <%= new java.util.Date() %>
</BODY>
</HTML>

I don't know what's wrong!!!
HElP!!!
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try simplifying the problem until you are at a known state, either an error state or success state. In this case, try using just the HTML markup without the scriplet.
Does it compile then? If so, the error has something to do with the scriptlet. If it still doesn't compile, it might be some kind of configuration problem. Try it without the scriplet and report back what happens.
 
Marv Dexter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Ross:
Try simplifying the problem until you are at a known state, either an error state or success state. In this case, try using just the HTML markup without the scriplet.
Does it compile then? If so, the error has something to do with the scriptlet. If it still doesn't compile, it might be some kind of configuration problem. Try it without the scriplet and report back what happens.
 
Marv Dexter
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tired everything it's just not working.
Thanks anyway.
/md
 
Dorothy Finkel-Laverty
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using Apache Tomcat? If so, then you can look at a folder under that directory called "work", and it will show you the actual compile messages. May help in your troubleshooting. You can also see your source code (servlet), which is a good tool for learning.

Dorothy
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you get the example webapps to work? If they don't either, then there's something funky with the way you've installed Tomcat. If they are working ok, it's a configuration setting for your specific example web app.
 
Mahesh swami
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is that the expression element ie
<%= XXX%> needs some expression which will return a result that can be converted to a String . But constructors will not return any explicit value.
Compiler will need something like this
<%java.util.Date dt = new java.util.Date();%>
<%=dt%>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
143
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But constructors will not return any explicit value.

While this is true, the fact that the new operator is being used means that the constructed object will be returned and its toString() value displayed. This is clearly not part of the problem.
We await the answer to Rob's query regarding the sample web apps.
bear
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!