Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

John Herrington

Greenhorn
+ Follow
since Dec 24, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 John Herrington

Hi

the example.com/secure/admin.html loads fine. But after entering credentials nothing happens. I have a admin role and user and password is setup in the tomcat-users-xml. Server.xml points to conf/tomcat-users.xml.

Apache doesn't show any error either. It shows a POST 200 after I press enter but nothing happens. Any idea how to troubleshoot this? I tried restarting the services.

I don't see any errors in catalina.out just this when I click the button.




Update: Found some info from the browser developer tools.



tomcat-users.xml has the following:
Note: there is no need for the manager role. I'm sure this was working fine with just `admin` role before. Only change I remember is that we upgraded from tomcat 6 to 7 few months ago and I never tested `secure/admin.html`



And server.xml has the following:





1 month ago
Figured it out.

I had to paste the path to servlet-api.jar into Build Step -> Project SDKs -> JDK Jar files patters.
3 months ago

I'm trying to build this https://github.com/marekbruchaty/SimpleJavaWebApp project with teamcity. But I get the error package javax.servlet does not exist

Where exactly should I place the servlet-api.jar for teamcity - Intellij IDEA type runner to look for it and compile it?

Teamcity and gitlab are hosted on a centos server. Tomcat is also installed on the centos server.

I tried copying servlet-api.jar to buildAgent/lib and /opt/teamcity/TeamCity/.BuildServer/lib/ but still I get the error.  Or does it have to be in the gitlab along with source code?


This is the first time I'm using teamcity or building a project.


3 months ago
I was watching a tutorial about generics and I noticed something. Maybe this is just a demonstration and nothing more, just wanted to confirm here. I understood Generics btw.

So in the below code, we can call "show()" method directly using juice.show();. But what is the use creating liquid variable in Glass class and then assigning it to "Juice" object reference and then creating another Juice type to make it work?

Is this something I can ignore and it was just the tutor trying to demonstrate Generics?








4 months ago


I'm trying to understand the line public Juice liquid; in Glass.java class. The Juice in the line is a type and liquid is variable right?

And In Guest.java we reference g.liquid to a Juice object. In here I think g is the only variable and the liquid is another variable returned by Glass class right?

As far as I've understood, liquid is a Juice type variable which means it can't hold Int, float, String or anything else. Does that mean the only use of that variable can be to reference to a different object? Or can is it possible to make liquid hold a int value?

Glass.java


Juice.java


Guest.java







4 months ago
I can think of writing a if statement for status and print something if its returns true which it does, but what's the point of passing "testing_2". Can't think of anything at the moment to  try out different ways to test.




Under PSVM



5 months ago
Hi, yea interface can implement boolean.

What I meant is that I don't know a case (like a real world scenario but very simple)  to use boolean class and method. This is just so I can practice a lot with different methods and scenarios. I only just learnt about boolean so I can't think of a case myself and Java is my first programming language.
Btw I've already completed the complete core java but going through tutorials second time and want to try various use case of each stuff.  I've been getting some ideas from youtube when I search for "java boolean example or tutorial" but haven't found a case where they pass object to boolean method.

5 months ago
I can't think of a logic to test the following code in a correct way.

I read that in java8 interface can implement boolean but it will error if we pass object class into it. That is if we try to overwrite object class through interface we'll get an error. Before trying it out I thought I'd first try to write something that makes uses of boolean method and accept objects into but I'm not sure what to write it without any idea.  Can someone think of something like bike, car or vehicle logic to write the below code to make more sense and so I can test various different methods of it. Maybe no need to write the code but give me a logic that I can implement?




Here is something I tried out for Interface.. I want a logic like this for the above code.



5 months ago

I have created "class A" and I can create "class A" objects under PSVM. But If I create a "class B" and then I can't create a object of "class A" under "class B". Any reason?






This is the error I'm getting.

Error: Syntax error on token "counter", Identifier expected after this token

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at StaticVariable.main(StaticVariable.java:4)



5 months ago