Tomcat 5.5 Axis2 application scope problem - Unable to create single instance - web-services

I have deployed an axis2 web service on Tomcat 5.5. The web service functions as expected. But I noticed I was getting duplicated log entries. After researching it became clear that multiple instances of the class were being created - ie the first time it ran, one log entry; second time, two entries and so on.
I added the scope="application" parameter, but that has not solved the problem. I added it both in the service tag and as a separate parameter tag to no avail.
This class has many key global variables, logging being one of them. Frustrated as I am, I still haven't gotten to the point of deconstructing the globals (major overhaul, breaks code conventions in my department). Are global variables the culprit? Or is there some other Tomcat/Axis2 config I am missing?
Will post services.xml or other code upon request.
Thanks in advance - Bill

I have solved the problem...don't necessarily understand why but I now have the correct behavior...
The services.xml file I created as part of the web service (WEB-INF/services/myService/META-INF) was being overridden by config in tomcat/conf/server.xml, where I had previously only referred to myService with a context block. In order for myService to have unique service-level parameters, it has to have it's own config in tomcat/conf/server.xml...not just a context reference.
It seems to me that this is not the best config...services and contexts in server.xml. It's not dynamic that way. Unfortunately I am following a standard set here many moons ago, so nothing I can do.

Related

Postman Collection Runner runs stale request. Solution?

A couple of days ago, I ran a collection of two requests in Postman.
I was using an environment variable created in the first request which was then
used in the second request.
I ran the two requests manually in the primary application interface of
Postman, one by one. The responses were as expected and there were no errors.
But when I tried running the whole collection in one go from the Postman
Collection Runner interface, the second request gave me an error.
I checked and double-checked that I was running the right collection. I closed
and reopened the Collection Runner window.
Also, in the Collection Runner window I tried switching to some other
collection, and then switch back to the collection of interest.
As I remember it, I even exported, deleted, and then imported the collection
again. None of these actions would make the error go away.
One thing I noticed was that - when running in the Postman Collection Runner -
the first request would create an environment variable with a stale name,
that is with a name I had used previously for the same environment variable.
However, when running the first request manually (not in the Collection Runner
window), the environment variable was created under its new correct name.
I cannot reproduce this behavior, and therefore I don't expect to see a genuine
solution to the issue. But a workaround would be much appreciated.
In vain I had tried just about anything I could think of.
Then I found a post at the Postman community on
How to remove some or all requests from the history.
See the second post of the link ( = first answer ). It says:
"There is also a Clear All selection at the top of the History section if
you want to remove everything."
In the Postman primary interface, just click
History > Ellipsis (...) > Clear all.
VoilĂ ! - No error when running the collection in the Collection Runner window.
For navigation help, see the images below.

Spring Cloud Function - Manual Bean Registration and Loading Configuration Classes

I am currently using Spring Cloud function 3.07.RELEASE with the AWS Adapter for lambda.
We are using a limited scope Functional Bean registration and understand that this does not include full Spring Boot autoconfiguration. We are okay with this as we value the speed and significant reduction cold start times.
However, we do have configuration classes that we want to utilize and assume that this needs to be done manually. What is the best practice on importing these classes?
We tried searching, but failed to find documentation on the differences in behavior of the limited scope context vs spring boot application context.
If I understand your question correctly all you need to do is register those configuration classes manually and the rest will be autowired. There was a little issue with it which may or may not affect you. In any event it was fixed and will be available in 3.0.9 release next week.

Malware/Adware on site deployed on AWS Elasticbeanstalk

I guess the title says it all.
I noticed some ads were popping up on a client's site we are currently developing. It only shows on this particular site. Not any other site. It is very annoying to put it mildly.
I thought removing it would be as easy as setting up a new environment on ElasticBeanstalk for it. I was wrong!
I have started a fresh instance for the application, scanned the project folder for malware before deploying, emptied the content of s3 bucket for static files. All these made no difference. The adware/malware is still there.
It has been driving me nuts for the past few days. Does anyone know how to resolve this kind of problem?
Mark B pointed me in the right direction.
I used inspect element to check the network processes of pages showing the Malware/Adware. It was after this i noticed a few asynchronous posts going to http://api.adsrun.net/post. Of course, i'm not making any post calls to this link. So i decided to inspect my JavaScript files as seen in View Page Source. Fortunately, it was in the last few lines of the second file i inspected. Immediately i deleted this file, normalcy returned to my web application.
It has been a very frustrating several hours. Thanks once again, Mark B for your suggestion.

Hibernate with Fuse - Failed to lazily initialize a collection of role: com.connecture.exemplar.entity -

My problem is peciluar, Please assist me in any way if you can !!
I have around more than 1300 of hibernate entity files, which are by default loaded with lazy intilization. I deployed them with tomcat and able to run web services using them with cxf, the application runs successfuly. With the same enity files, I made a budle in Fuse, the services are been deployed , while running the application , it gives an error saying "Failed to lazily initialize a collection of role" with entity names.
Now for this I came with one solution that at place of
#ManyToMany(fetch = FetchType.LAZY, mappedBy = "prProductLines") , I changed the FetechType with Lazy to EAGER. The problem get resolved.
But now, while changing at all places the fetch type to EAGER, this modification raised me another problem, where the query runs very slow taking too much long time, finally it reports error in SQl server 2008 with "There is insufficient system memory in resource pool 'internal' to run this query." and in console "org.hibernate.exception.SQLGrammarException: could not load an entity"
Now please suggest me the solution for it, if I am able to lazily initiaze it in fuse, I hope it could solve my problem. I am not able to figure out exact problem. How could i move ahead.
Thank you

Spring Data / REST - never any contents exposed when hosted on Cloud Foundry

I've got a very basic survey app :
one JPA entity (Survey.java)
one Spring MVC controller (SurveyController.java)
one Spring Data/JPA repository (SurveyRepository.java)
3 main steps, each matching a specific Validation Group
a REST API exposed through Spring Data/REST configuration (see ApiConfiguration.java)
You can see it live here: http://survey-preprod.cloudfoundry.com/.
The sources are available here: https://github.com/fbiville/spring-example-survey.
Just properly fill the form (3 steps - just answer anything) till you see the "Thanks!" page.
Then proceed: http://survey-preprod.cloudfoundry.com/api/survey and notice there is no contents at all!
This happened will all Spring Data / REST I pushed to Cloud Foundry.
When run locally, there isn't any problems at all.
Is there something I missed?
Thanks in advance,
Rolf
EDIT: even with
curl -v -H "Accept: application/json" -X GET http://survey-preprod.cloudfoundry.com/api/survey
(so the accept header is properly set), no contents are exposed...
Well guys, as (sadly) often, this is a clear PEBKAC instance.
ApiConfiguration was importing CoreConfiguration (which was already loaded once as defined by web.xml).
Therefore, the same "core" beans were loaded again, but CloudFoundry auto-reconfiguration occurred only the first time on the declared datasource and let the duplicated one as is (that is: an H2 database, of course without any contents).