Suhaas Parekh

Ranch Hand
+ Follow
since Jun 11, 2020
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Suhaas Parekh

Hi All,

I am trying to include or exclude jobs based on custom variable, which is updated in previous jobs. But it is not working as expected and dev_deploy job is skipped, although I am expecting it to be included.

.gitlab-ci.yml
2 years ago

Tim Moores wrote:General Computing, perhaps



Can you provide the link?
2 years ago
Hello friends,

Where do I post a question on gitlab?
2 years ago
Hello friends,

I am using a root logger to write logs to a file. But file itself is not created.

I have created a maven project. The log4j2.properties file is placed in src/main/resources.

pom.xml


Log4jDemo.java


log4j2.properties

2 years ago
What is meant when it is said that a dependency with certain scope will be available only during that scope? Is it not true that when a dependency is included it is needed at all times i.e compile time/run time etc?

Instead of using maven, if I manually download a dependency jar and put in the build path of a project in eclipse, with what scope is it included in the project?
2 years ago
What is runtime classpath and test classpath? Is there also a compile classpath? If yes, what is it?
2 years ago
Hello All,

I have the following general questions on Maven:

1. What is the purpose of scope tag in the dependency section of pom.xml?
2. What is meant by classpaths with respect to maven?
3. Is a classpath in maven scopes similiar or related to the general term classpath which is the place the JDK has to look for user defined classes?
4. When exactly would I use a compile scope, which is also the default scope? Please explain with example.
2 years ago
Which is the forum to ask questions on maven?
2 years ago
Hello Friends,

I have the following questions:

1. What is the need of the Dispatcher servlet in Spring MVC when there is a request mapping annotation to map the URL to the method in the controller?

2. In continuation to the above question, why there is no need for the Dispatcher servlet in a spring boot project since it also uses request mapping?
2 years ago
Actually the issue was resolved when I created the WebContent folder and web.xml while creating dynamic web project through eclipse instead of copying the WebContent from the sample project into my eclipse project. Surprising that we have to face such issues.
2 years ago
I changed it in web.xml and still I am getting 404.

Although if I use the annotation @WebServlet("/hello") on HelloWorld class, it works.

My question is why is it not working  if I used xml mapping in web.xml.

Below is my modified web.xml



I got the below logs  from tomcat . These are the logs when tomcat is starting. There is no logs updated when I access the url in the browser and getting 404. Not sure if the issue mentioned in the tomcat logs can cause 404.
Below are the tomcat logs:
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name:   Apache Tomcat/9.0.56
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Dec 2 2021 14:30:07 UTC
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.56.0
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Mac OS X
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.16
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          x86_64
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             /Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           12.0.1+12
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         /Users/suhaasmohandos/Eclipse workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         /Users/suhaasmohandos/Downloads/apache-tomcat-9.0.56
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/suhaasmohandos/Eclipse workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/Users/suhaasmohandos/Downloads/apache-tomcat-9.0.56
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/suhaasmohandos/Eclipse workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Jan 02, 2022 11:01:29 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Xbootclasspath/a:/Users/suhaasmohandos/Downloads/apache-tomcat-10.0.14/bin/bootstrap.jar:/Users/suhaasmohandos/Downloads/apache-tomcat-10.0.14/bin/commons-daemon.jar:/Users/suhaasmohandos/Downloads/apache-tomcat-10.0.14/bin/tomcat-juli.jar
Jan 02, 2022 11:01:29 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/Users/suhaasmohandos/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
Jan 02, 2022 11:01:30 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Jan 02, 2022 11:01:30 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [1316] milliseconds
Jan 02, 2022 11:01:30 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Jan 02, 2022 11:01:30 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.56]
Jan 02, 2022 11:01:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Jan 02, 2022 11:01:31 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [561] milliseconds
2 years ago
Hello Friends,

I cannot get a simple hello world servlet program to work. Not sure where the issue is.

I am getting 404 when I am trying to access the url : http://localhost:8080/Hello_World/hello

The context root of the project is Hello_World.

There are no compilation issues.

Attached is the structure of the project and below is the code.




2 years ago
Hi Friends,

I had the following questions.

1. What is the difference between Spring configuration files(eg. HelloWeb-servlet.xml), web.xml, applicationContext.xml and Beans.xml?
2. Is there anything called servlet configuration file? If yes, what is the difference between servlet configuration file and Spring configuration file?

Thanks
2 years ago
Hello Friends,

I am learning Spring MVC and I am unable to understand the difference between two examples.

1st example uses html form(helloWorld-form.jsp, helloWorld.jsp) while the 2nd example uses spring form(student-form.jsp, student-confirmation.jsp).

The corresponding HelloWorldController has  two methods namely showForm and processFormVersion3 while the StudentController has methods  showForm and processForm.

My questions are:

1. What is the advantage of using spring form over html form?
2. Why in the HelloWorldController the model's setAttribute is called in the  processFormVersion3 method while in the StudentController it is called in the showForm method? When exactly should the model's setAttribute method be called?
3. In the StudentController' showForm method,  what is the point of adding an empty Student object in the model?

1. helloWorld-form.jsp



2. student-form.jsp



3. helloWorld.jsp



4. student-confirmation.jsp



5. HelloWorldController




6. StudentController

2 years ago
Hi All,

It is said that java is always pass be value.

1. Pass by value means the changes made in the called method does not reflect in the caller method? Right?

2. In the below example, when I modify an int primitive or String object in the called method it does not reflect in the calling method. But when I modify a list in the called method it reflects in the calling method. Why?

Output:
5
abc
[1, 2]



2 years ago