Jan Kaczmarek

Greenhorn
+ Follow
since May 02, 2020
Jan likes ...
IntelliJ IDE MySQL Database Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jan Kaczmarek

If someone else may have same problem-I just solved it. It was all about configuration in Config class.
I left getServletMappings() and getServletConfigClasses() with default, empty implementation. To make it works I just had to add "/" for servlet mapping and  point class with configuration. Thank you for all advice and help!  


1 week ago
Yes, these two new webapps are result of manual addition of WAR to Tomcat server+Intellij deployment.
Hmm to be honest-I don't have got web.xml file in my project. I thought when I use annotations I don't need a web.xml file-so it looks like im wrong.
I just created it and now I need to fill it with something ( I will find some reasonably correct tutorial )-I hope this one is going to work, Im not ready for 3rd day with this problem.
1 week ago
Ok, I edited my post and added code directly.
So this is my app manager at this localhost and it showing that "something" is deployed (I added this as a attachment to be sure its not going to vanish)
I manually created WAR file, it was automatically added to webapps folder. Im trying to access to http://localhost:8082/app-1.0-SNAPSHOT with index.jsp, without it, with /test etc and still throwing 404
1 week ago

Tim Holloway wrote:If you are using Tomcat's default deployment mechanism, you would copy your WAR to TOMCAT_HOME/webapps/. You do not actually have to explode WAR files. Tomcat will do that as part of the deployment.

If you have a WAR file mywebapp.war, exploded to TOMCAT_HOME/webapps/mywebapp, then the URL for its /index.jsp page would be: http://localhost:8082/mywebapp/index.jsp.

If you do this and still get a "404" check the Tomcat logs to make sure that there was no error in deploying the webapp.



So i checked in Tomcat Manager and app is deployed. In Tomcat adres /webapps there is nothing about this app.
Tomcat logs from deploying (Edit)  

Im not sure if I understand it right but I think Im missing something in Spring configuration
1 week ago
Hello,"
I have got question-why when Im trying to enter "http://localhost:8082/test" or (im not sure which should I use-I think the first one is correct cause I made only /test endpoint) "http://localhost:8082/app_war_exploded/test"  I have got 404?
Configuration class: https://hastebin.com/ocosebogod.kotlin
ApiHello class (my @RestController) : https://hastebin.com/etugoqutop.kotlin
pom.xml https://hastebin.com/avukoxijev.xml
Im using Tomcat Local, I set server at http port 8082, jmx port 1098, I added exploded app:war to deployment, it should work but its not.
1 week ago

Stephan van Hulst wrote:What this will do is register all beans in the "java" package and sub-packages and make them available for you to inject in your application.

I hypothesize that it will make your application a lot slower and it will also be completely pointless because there are no services in the packages I mentioned that use annotations to inject the discovered beans.

Why would you want to do this?



Im looking for good place to put this Config class with @ComponentScan annotation. So my solution is to move all packages (service, data, model, presentation) to new, big package like "student-management-system" and put @ComponentScan("student-management-system") ? Because I do not see any other solution for the scan to work.
2 weeks ago
Hello!
I just added spring to my app and Im not sure how to use @ComponentScan proper. I know that if I will leave it no-args it will just scan current package and sub-packages. I can add args-and pick specific package but how it will ends if I would use @ComponentScan("java") like this :


It will scan my whole app? Or it wont scan anything?
Thanks in advance for an answer!
2 weeks ago

Carey Brown wrote:What happens if returnStudent() returns a null?



Hmm.. I wasnt thinking about this problem. This ID (pesel)  number is long so I think  I may expect looking up with an id that doesnt exist to be something that regularly happens. I heard about Optional and this may be my solution.
1 month ago
I decided to make method for this problem:

 

But I still think this is not correct way.
1 month ago
Okay, so I decided to go with solution
class Lesson
Map<Student, ArrayList<Integer>> grades.

Im trying to make method that will add to the Map<Student,ArrayList<Integer>> Student that have got specific pesel(ID number). Im trying to use stream but its just checking if in my static ArrayList<Student> (that is pretending to be database) is any object with same String and if yes-it returns true or false.

Im reading oracle documentation and I cannot find any good solution. Am I missing something or there is no answer right there and I should make some own method? I find it kinda weird because it seems to be simple, daily problem so it should provide some tools to make it works.
1 month ago
Hello,
Im making ControllerMenu to manage the transition between menus.


All my Menus have got only non-static methods and they are using instances from Service layers to connect/edit everything from data layers.
Individual menus should not require a ControllerMenu (so it cannont appear in any Menu constructor, as a class field and I think I shouldnt make an instance of it in these classes) . The dependency should only be one way. This is my solution for this problem:
https://pastebin.com/pepjBQN8
But in my opinion this code is pretty messy-a lot of instances for every method etc. Is there any another way to make it works? Most beautiful solution it would be "using methods (and make them non-static) from ControllerMenu without creating instances in every Menu" but I think its impossible.

1 month ago

Campbell Ritchie wrote:Somebody's sent me pie Thank you, JK



This portion of patience from all of you for my ignorance deserve a pie The pleasure was all mine.
Anyway I think the solution for this problem may be Map with multiple key-cause String method cant provide me enough service possibilities. I will post my solution in this topic for posterity if I will figure out how to do it:P
1 month ago

Campbell Ritchie wrote:

Jan Kaczmarek wrote:. . . Map<Student, ArrayList<Integer>> . . .

Depends how the hashCode() and equals() methods work in Student. If a Student object can change its state and therefore its hash code, you will never find it in the Map again.


It can. So the answer anyway is Lesson as a String, not a Lesson object. I will try to implement it this way- and find way to make all this Student/Teacher funcionality on it-if its not going to work as I want it to do-I will just post it here for some hints. Thank you for all your support and patience!
1 month ago
So maybe I will just ask-in Your opinion is it possible to add all this functionality with leaving Lesson(Subject) as a String. not an object? If yes-I will try to figure it out somehow ;)
1 month ago

Carey Brown wrote:Does your Repository have, or need to have, persistence behind it, such as files or database?



For now every Repository is just static ArrayList that stores objects created while the program is running(its provide me some kind of simulation of real program)  After I close the app-the Repository is cleared. After I will achieve all goals from logic(service) layer I will start developing real database-(mysql, hibernate will be included), later I will add interface and I will make it standalone application. Its for my self-learning purpose.

So I think I need Map that will  have as a key Object and accessing to add some value to it would be by Object.getSomehowANameInString ?
Something like:
"Map<Student, ArrayList<Integer>> gradesFromSpecificLesson"
but for adding value to specific Student, I would access to it by
lesson.put(Student.getName.matches(InputString), grades.add(InputInt)); ?
1 month ago