Win a copy of Event Streams in Action this week in the Java in General forum!

Mohammed Sardar.

Ranch Hand
+ Follow
since Jun 22, 2014
Mohammed likes ...
Java jQuery Spring
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mohammed Sardar.

Hi All,

I'm trying to deploy a maven based spring web application in Jboss server but endlessly getting Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [].  I read through to resolve this issue, what I learned is the compatability between server version and Spring context version is something to be fixed. But stalling how to find the root cause which version shoots for the server version. Currently using Red Hat JBoss EAP 7.1. Let me know if any information required here. Please help to fix this deployment issue. Thanks.

Project related servlet file have below entries related to spring context.

3 weeks ago

Junilu Lacar wrote:Does line include a comma in the amount? It doesn't look to me like your regex will match the comma.

Comma may or mayn't be there. Both of below may happen.

1 SEP-RNW-500-1K              7,612.80
1 SEP-RNW-1-25              228.18

But for the second format also it reg ex doesn't match !!!
4 months ago
I'm trying to find one regex pattern to a whole line. Basically the complete line appears appears as    "1 SEP-RNW-500-1K              7,612.80". So I've written the pattern matcher regular expression as

What could be reason the reg ex pattern never matches to the code below and goes into the else if to perform something ? Can some one help me ?

Code I'm trying to match the reg as

4 months ago
Almost, I've given all code replicated the original code. Including configuration too. I think I've no code put more here. getBean gives the bean but not Auto wiring!! Here is what I'm stumbling.
4 months ago

Dave Tolls wrote:I'm getting a little confused here.

Can you show the call to importDoc that causes the NullPointerException?
Can you also show where in that class (the one calling importDoc) that the instance of Good it uses comes from?

For example:

Yes, Sure we are missing track. But importDoc is a public method available inside Good class so we don't need create an instance. But inside importDoc, we are trying use a bean or instance that is created by AnnotationConfigApplicationContext and here is where we're getting NPE only if I use Autowired but able to use the bean if I get through Context i.e getBean(RxxxDyyyyHelper.class). Hope this adds more information.
As illustrated below with sample please read comments.

Hope this clarifies. Let me know if I miss something here.

5 months ago

Dave Tolls wrote:

Mohammed Sardar. wrote:
We call this Good from other class by reflection but the Good is also initiated at the time of component scanning as a base package.  Thanks

How do you get it by reflection?
I'm not sure that Spring would be involved in that, and so you would not be getting the Spring Bean, but something else entirely, something which would not have had anything injected into it.

Sorry I think  we're not on track because Spring getBean provides all the beans that are mentioned in the componentScan but not when autowiring. So I wish to thanks Spring comes into picture here. And also, For the question asked where "Good" class is initialized  I answered by reflection but I tried passing that class name itself I could not achieve Autowiring.
5 months ago

Dave Tolls wrote:

Where is instance of Good used that appears in the NullPointerException stacktrace?
Where is that instance instantiated/injected?

Can you show that code?

We call this Good from other class by reflection but the Good is also initiated at the time of component scanning as a base package.  Thanks
5 months ago

Al Hobbs wrote:You need to make sure you are scanning the right packages.  Also make sure your rxxxblahhelper class is annotated with @component.   Since its not a webapp you need to make sure the spring container is started from main

Yes, I double and triple checked @Component annotation is implemented and here is the blocking point actually looking for help.  Container is started, confirmed this by logging some message as "Context Invoked" and there is no issue with that.  The thing is when we try to get the bean with

getApplicationContext().getBean(rxxxblahhelper .class);

container gives back the bean. If try two to autowire no luck with null. I'm trying to get the bean autowired and get the bean required all over the application, instead implementing context everywhere and using getBean() method.
5 months ago
Thanks for your time to help me and to your questions.

Al Hobbs wrote:So youre getting a null when its trying to inject rxxxblahhelper?  Does that class even exist?  Also great class names .  Class good and it extends class good11.  ;p

Nice to hear you enjoy the class names  I named, because you are good as they .  Yes, There're classes exist. And they are available from ApplicationContext but unable to do Auto wiring since it throws NPE.

1. The actual code is not pasted here and the  above code is only for references as a sample code.  You are right   Looks like you are calling a method in the middle of a class actually we're not calling code in the mid of class but only in the mid of a method as below.

2. Code is compiled fine. So,

arent supposed to have injection code in the class. that defeats the purpose of doing dependency injection in the first place

I agree. In this situation, how can we utilize spring feature
to get this injected from the container with Auto Wiring ? Through this what I'm trying to achieve is, certain annotated classes/beans that're available in the spring container can be used directly from container into another classes without using new keyword.

3. Using AnnotationConfigApplicationContext and get this initialized when the main() starts so that all the beans which are annotated with @Component can available for the injection. Again, I would like to state this is not web app it's A stand alone app which provides data to some web API end point.

Hope I'm providing adequate information. But I'm stuck at analyzing the technical feasibility and seeking for help.

5 months ago
Can someone help me to edit the subject my post is not getting noticed by any one. Thanks.
5 months ago
When trying to use @AutoWire feature with one of StandAlone Application unable to do so instead getting Null Pointer Exception. Please highlight my mistakes if any. Your help is appreciated.

Spring Ver 5.1.5.RELEASE and we're not using any xml config file to tell spring there are annotated classes to look into instead using @ComponentScan or @EnableAutoConfiguration at the top of AppConfig and boost strap the Context from main() class as a first line. But Autowiring works perfectly with internal bean/java classes of jdk(Environment) but not with custom POJO classes. If we're trying to get through getBean method then it works. But I'm trying to avoid creating context everywhere and using getBean() Please Refer below and help me only with your valuable guidelines.  



5 months ago
Can some one help me remove the nationality specific in above ? I don't want to use any specific national that way.

Thanks Rob. So,  are you trying to say why don't I prefer JSON rather XML. But just started exploring web services concept. Not really sure what is going on. So that raised this for help. But the learning video rendered the same XML well and fine. So, Let me try to change to JSON.
9 months ago
Have created a simple Jersey Version of web services Project and trying to render a XML Format of List Produced by a Resource. And Below are my created code. when trying to reach a myresource path getting only the least added XML element and it's getting overridden. Debugged and tried changing code with no clues.  Can some one give me a idea of help on this to debug further ? Thanks



9 months ago
I'm learning RESTFUL Web Services through some videos and I work in Spring MVC for last 2 years and there is no WS.  There was a question on WS, after I explained RESTController and GET Request, Produces and All. After all these are done how to expose your web services to users ? I'm Keep looking over net and getting answers only as on how to consume WS ? Does that what questions mean ? Please correct if my understanding is not right. So, In order to get ready for that Question, Do I need to practice on @CONSUMES(..) ?  In order to test this scenario  do we have to use only POSTMAN as a tool ? In interview aspect how this can be self trained ? Suggestions are highly appreciated.

9 months ago
Nice to have you here. Warm welcomes Ben Forta with Cherry Flowers.
9 months ago