When working with JBuilder2008 my project would build successfully. I changed to MyEclipse and found the following issue:
request.setCharacterEncoding("UTF-8"); has got a red line below setCharacterEncoding and it has below problem message:
The method setCharacterEncoding(String) is undefined for the type HttpServletRequest
Could you tell me what shall I do?
I think that the problem is that your Eclipse is configured to use an older version of the servlet APIs; see this forum post. (Right at the end.) The method is certainly present in the Java Servlet 2.4 APIs.
(FWIW, I pick up my Java Servlet APIs via an explicit Maven dependency, so I'm not hostage to the default version implied by my IDE settings.)
Inside MyEclipse IDE, please add 'javaee.jar' in your Project's build-path. This will solve your mentioned error about "request.setCharacterEncoding("UTF-8") "
Usually, during run-time (within web-server container) this jar will be already in classpath. But during development inside IDE, you may face this compile time error.
You will find this JAR at path depending upon your installation path:For example,
C:\MyEclipse6.0\myeclipse\eclipse\plugins\com.genuitec.eclipse.j2eedt.core_6.0.0.zmyeclipse60020070820\data\libraryset\EE_5
Related
I have a huge web application that I have to support. Recently when I downloaded the latest source from SVN and try to run it locally on Tomcat 6, I get the following error from one of the background batch jobs that the application runs...
2014-12-23 18:08:27 [taskScheduler-4] TaskUtils$LoggingErrorHandler [ERROR] Unexpected error occurred in scheduled task.
java.lang.NoSuchMethodError: javax.xml.stream.XMLEventFactory.newFactory()Ljavax/xml/stream/XMLEventFactory;
at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor$HeadersProcessor.<clinit>(ReadHeadersInterceptor.java:275)
So I believe the problem is the Apache class ReadHeadersInterceptor which my application's code calls is trying to call the newFactory() method from XMLEventFactory but is not finding that method, probably because it is reading an older version of XMLEventFactory.
I think this is happening because there are some JARs in my lib folder I need to remove or add. Problem is I don't know which one. I see there are several JARs which have XMLEventFactory including..
woodstox-core-asl-4.2.0
stax2-api-3.1.1
And it is also part of Java 6 in the rt.jar.
So out of all these Jars which one is it trying to read and not find that method it needs?
Thanks.
This is a problem with specific version of JDK/JRE 1.6 (I mean the update). It may looks weird but the JDK API change for specific major version.
Please take a loot at the following link. You can see there that with change from version 1.6.0.17 to 1.6.0.18 the new methods have been added on the XMLEventFactory class.
Probably you have the JRE version less thank 1.6.0.18. I've had the same problem with Apache CXF and dynamic proxies. The update of JRE 1.6.0.14 to 1.6.0.19 fixed the issue.
I hope it helps.
I'm aware several people have asked very similar questions to this one, but I really need help finding the solution to my particular case.
Please read and understand this question before posting an answer :)
I'm using
Eclipse (both Juno and Kepler)
JDK 1.7
Tomcat 7
the Sysdeo Tomcat plugin
and in one particular project (other projects are fine), the following happens:
I set a breakpoint
start Tomcat
execution arrives at that point
I get a message: "Unable to install breakpoint on com.foo.bar.Main.class due to missing line number attributes" Reason: Absent Line Number Information
The thing is, if it can't install a break point - why is it stopping at exactly that point in the code where I set the breakpoint? Also, it says line number information is missing but I've verified all Compiler options and even used javap to confirm that line number information is in the compiled Main class file.
Note:
I am not using Ant to build
I am using the 1.7 JDK in Eclipse (not JRE)
Any guidance or suggestions welcomed.
Edit:
Hmm.. further information that may be important. I'm using Spring, and the actual class that Eclipse tells me has no Line Number Information is actually of the form: 'Main$$EnhancerByCGLIB$$87eae52c'
Could it be that a pre-compilation layer is generating classes without line numbers?
Maybe your class files in Eclipse class path is not matched with the class files you have in Tomcat webapp folder. There are out of synchronization.
You can try to deploy newly built war file again.
I spend one day trying to fix this issue, and finally found a solution. As Google doesn't have any answer for this Eclipse error, I thought of putting this for everyone.
Issue:
When I try to publish project via eclipse, I'm getting this error message:
No runtime specified. WLS Web Service projects require a runtime to be present for most tooling.
How to solve this problem?
(Credits go to Akshay who originally posted this solution in his question.)
This error message appears if your target runtime is not set to the Weblogic version you are using.
The fix is pretty simple, just follow these steps:
Right click on your Project Folder, then Properties
Select Target Runtimes
Once you select you will see the WebLogic version you have added for your project
Just activate the checkbox and hit Apply
Done - your error should be gone
I've found a lot of articles/questions dealing with this problem, but there was no answer that worked for me yet.
I'm using GWT 2.5 with the eclipse plugin. eclipse version is Juno with Java7.
Everytime I start the app it first tells me that log4j was not configured properly (no appenders...) and also my HBaseAdmin can't connect to HBase (which is running).
All of the answers tell me that I have to put the resources into WEB-INF/classes directory. In order to do that automatically I added the files into the root src directory. But still nothing.
Maybe it's worth mentioning that I don't use maven (b/c all the other projects are no maven projects either, and there is no time to introduce maven at the moment)
Thank you for any hints what might be missing.
EDIT:
somehow I don't get any warning anymore, but I didn't do anything except restarting over and over. Thus this should be working now. But, Zookeeper now throws
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
I divided the gwt app up to the UI part, the executing implementation of the service is a seperate project, also the model is seperate. I first just added the required libraries to the projects that really need them. Know I also added them to the main GWT app, but that didn't help either. Any ideas?
LoggerFactory classes you are using is from slfj-api-1.6.1.jar . Try adding that jar into your WEB-INF/lib and classpath. Also we usually use it conjunction with slf4j-log4j12-1.6.1.jar .
Note: We are using version 1.6.1 as indicated by GWT sample examples available with gwt downloads.
I have been working on this web application using Eclipse and m2e (maven plugin for Eclipse).
After a while I decide to change the project name in eclipse doing: Right click on project >> refactor >> rename
Following this I see a few errors coming up, mostly to do with classpath configuration & java versions mismatch. I fix them, adding the maven dependencies to the build path, and updating the java versions to be used during compilation & run time.
I rebuild my web app & restart my server (Tomcat in this case). Open my browser to go to my app's root url. And I get a 404 page (everything looks fine in the console btw).
I've been going through my buildpath and classpath config to double check if anything was coming from there but everything seems fine. I'm confused and unsure where to look at.
Thanks in advance
This really depends on your Setup. If you are using the default path, it is (as Kal said) myserver/newappname.
If you are using a url that you have configured in webserver for easier readability like (myapp.myserver.com) you would have to change the redirection in your server from your old appname to the new one.
Actually,
404 HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.
1. Check your path with newapplication name.
2. See inside your server, Is there a resource with (newNameApp.war)?
3. As you are using maven, try to build the project and see the log, by which name war is generated, and where the war got placed.
I faced the same situation and simply restarted Eclipse and no more 404 afterward