Himai Minh

Bartender
+ Follow
since Jul 29, 2012
Merit badge: grant badges
Cows and Likes
Cows
Total received
13
In last 30 days
0
Total given
0
Likes
Total received
138
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Himai Minh

I am not too familiar with JWT authentication in Spring Security. But I think you don't have the right privilege to access to order service.
Usually, people have a database table to store the users and their privilege. This table is looked up during authorization.
1 day ago
403 error may mean you are authenticated, but you don't have enough privilege to access to the resources.
1 day ago
I guess what Ajit means is
//PageModelBuilderTest class
@InjectMock
private PageModelBuilder pageModelBuilder;

It does not work.
Maybe, you need @RunWith(MockitoExtension.class)  instead of @RunWith (MockitoJUnitRunner.Silent.class)?
2 days ago
In your IDE, does it highlight any error in your web.xml? I took a quick look and don't see anything wrong with your web.xml.
6 days ago
One more note. If you do this in the run method of Sender:


The output will be like the following , but the program will not exit because there is a while loop (!client.message.isEmpty()). The messages is not empty and the smppSession reBind() makes the bind = true, so the producer waits forever.

Rebinding...
Session established!
SessionProducer1 managed to reestablish SMPP session.
Sending message: msg1
Sender3 sent msg and received msgId: 105382553
Sending message: msg2
Sender4 sent msg and received msgId: 1361595867
Sending message: msg3
Sender2 sent msg and received msgId: 626877645
Sending message: msg4
Sender1 sent msg and received msgId: 147902866

I changed the run method of Sender like this:


Output:


Sending message: msg1
Sender3 sent msg and received msgId: 548773298
Sending message: msg2
Sender3 sent msg and received msgId: 1882823304
Sending message: msg3
Sender3 sent msg and received msgId: 510749702
Sending message: msg4
Sender3 sent msg and received msgId: 1285812849
Sending message: msg5
Sender3 sent msg and received msgId: 1367977611
Sending message: msg6
Sender3 sent msg and received msgId: 1066370205

Process finished with exit code 0


Only one sender thread is sending  messages. It is because it first synchronizes the Client.messages. And while the message is not empty, it keeps  removing one message, send another message. It notifies other threads. However, other threads cannot acquire the lock for the Client.messages. Basically, other threads are not in waiting state. So, this active thread notifies nobody.
I don't understand why we have to synchronize the messages collection first before we perform the size check.
Synchronize on an empty collection costs time. In the other words, synchronization is expensive and better not to
use it on the empty list.
I believe Spring MVC supports different frontend technologies such as Thymeleaf.

1 week ago
You may need to check if the array is empty, then the thread needs to wait until the array has at least one element.
First of all, make sure your credentials are something authorized to log on to the service.
1 week ago
There seems like a circular dependency in your domain objects. Try to search for @JsonIgnore and see if that works for you:
https://www.appsdeveloperblog.com/jsonignore-annotation-in-java/
1 week ago
How about adding "" to @RequestMapping. If you prefer not to use any relative URL, then add this blank. The URL will be localhost:8080/ to access to index.
 @RequestMapping({"", "/home"})
public String home(){
 
 
   return "index";
}
1 week ago