Posts

Showing posts with the label tomcat

Create a folder from Servlet and save file

Create a folder from Servlet and save file In my form, user uploads a photo(s) and then I want to store that photo in a network disk (in our local network). The following works fine, when I execute it from Netbeans in my PC: public void saveFiles(List<Part> fileParts,String targetId) { String pathRoot = "A:\ShareDisk1\Photos\"; String date = new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance().getTime()); try { int counter = 1; for (Part filePart : fileParts) { String destPath = pathRoot + "\" + targetId; Boolean flag = new File(destPath).mkdirs(); System.out.println("flag = " + flag); File file = new File(destPath, targetId + " " + date + "-" + counter + ".jpg"); try (InputStream input = filePart.getInputStream()) { Files.copy(i...

405 method not allowed using Tomcat

405 method not allowed using Tomcat I am new to web development and having this issue for some time. I tried a lot of things that were suggested on SO and elsewhere, but no luck. Anyways, i'll explain what I am doing. I am trying a simple exercise where I have a simple HTML page that accepts a city name and on clicking the submit button, will show me the weather of that city. The HTML code is as below: <body> <form> <div> <label for="city">City</label> <input id="city" type="text" name="city"> </div> <div> <input id="submitButton" type="button" name="submitButton" value="Get weather!" onclick="send()"> </div> </form> <script type="text/javascript" src="CityWeather.js"></script> </body> This HTML file makes a call...

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost 01-Jul-2018 20:00:33.968 SEVERE [RMI TCP Connection(5)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:742) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:718) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:703) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1737) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invok...

Spring Boot Embedded Tomcat Performance

Spring Boot Embedded Tomcat Performance I am developing Microservices API for my application. I started with Spring Boot application. I created two artifacts - "business code with embedded tomcat" and "business code without embedded tomcat" . When I compare the performance results, I can see that the "non-embedded tomcat" (i.e. executing on standalone tomcat) gives good output because of native execution. So basically what is the difference between the embedded tomcat and the standalone tomcat regarding implementation? How the performance varies between two executions? How you did the tests? Could you explain? Thanks. – Rudge Oct 30 '16 at 18:46 @Rudge: Using Jmeter i simulated load on both scenarios. I am using camel in my business-code. At the end of transaction, i am printin...