java


java.lang.NoSuchMethodException: java.io.File.<init>()


I have used the code in Read all files in a folder. But when I try to implement the code, it gives me an error - java.lang.NoSuchMethodException: java.io.File.()
Stack Trace:
java.lang.NoSuchMethodException: java.io.File.<init>()
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getDeclaredConstructor(Class.java:2178)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:105)
at
org.springframework.web.method.annotation.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:81)
at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:104)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:79)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:157)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:124)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1720)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
I have searched for long.. Most of answers were about setting up a default constructor. But in my case, the file doesnt have a default constructor. I may be looking at this completely wrong.. So here's hoping some one can help me out..
Thanks in advance :)
Code:
#RequestMapping(value="/retrieve", method=RequestMethod.POST)
public ArrayList<String> listFiles() {
ArrayList<String> listOfFiles =new ArrayList<String>() ;
File folder = new File("E:/uploadedFiles/");
File[] files = folder.listFiles();
for (File file : files) {
if (file.isFile()) {
System.out.println(file.getName());
listOfFiles.add(file.getName());
}
}
return listOfFiles;
}

Related Links

Java Replace Unicode Characters in a String
Creating object from class located inside JAR? [duplicate]
Can't figure out what is wrong with my merge sort code
How does one Convert a List to Map with Java-8 Streams where Key is the ListValue and the Value is the amount of values of that specific list
Installing Ant for Java on Linux
regex for google search result not work in android
UnknownHostException after the attempt of reading a XML file
Casting a class to a selfmade class
Spring custom error page instead of tomcat error page
Android Keyboard Input Method to show numbers 0-9 above standard alpha
Pack header and data layout in one byte array using ByteBuffer in an efficient way?
Android Bluetooth deserialization ObjectNotFoundException
org.springframework.web.servlet.mvc.support.DefaultHandlerEx‌​ceptionResolver [duplicate]
Servlet - Passing session information to the html/javascript
I am unable to Fetch data from mongoDB while whn i using BigDecimal inside query
Edit / Delete classes in external third party library jar files in android?

Categories

HOME
maven
java
deployment
activiti
isabelle
fluentd
push-notification
include
syntax
read-eval-print-loop
icloud
flyway4
convolution
awesome-wm
google-translate
metatrader4
node-pdfkit
leiningen
messages
iolanguage
dosgi
after-effects
propel
database-replication
lldb
introduction
dbext
immutable.js
errorlevel
accessor
autosys
crosstab
android-widget
nhapi
c++-amp
flink-streaming
nat
preg-match-all
copying
hybridauth
phpfreechat
cloud-code
html5-fullscreen
android-ble
host
devextreme
disassembling
dartium
web-mining
abstract-class
sharefile
twitch
az-application-insights
gulp-sourcemaps
elmah
segment
qwt
angular-resource
hendrix
nsarray
pillow
chord-diagram
synchronous
quartz-composer
gnome-shell-extensions
objective-c-swift-bridge
medium.com
grails-tomcat-plugin
skobbler-maps
nsfilemanager
fuzzy-search
fputcsv
disque
react-native-listview
ubuntu-10.04
packagist
rhino-servicebus
hsv
vhd
srand
xna-4.0
teamcity-8.0
deis
responsive-images
ios9.1
ami
unity5.2.3
pretty-print
proj4js
device-orientation
umbraco6
comexception
android-2.2-froyo
balanced-payments
intentservice
industrial
c18
oam
ivyde
inbox
coverflow
ruby-datamapper
ora-00911
cos
shellexecute
pushbackinputstream
kyotocabinet
coderush
first-responder
automount
getmessage
appconkit
custom-backend
php-parser
spyware
blackberry-playbook
f#-powerpack
xtype
appender
telerik-scheduler
lpeg
html-input
subviews
h.323
database-management
ctp4
yagni
noscript
msdev
dbisam

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App