To be fair, i first asked this question in the official GitHub-Repository of the example-project. However since i didn't get an answer for one week now, i felt that stackoverflow might be a better place to ask. I'll do my best to keep findings and updates in synch beetween these threads, so that the efforts made at one place or another are shared.
I am charged with the task to migrate a Oauth2 single sign on system to an inherited Spring-project. Therefore i decided to go with Spring Cloud Security. Sadly i cannot even get the most basic example to work, that is shipped together with Spring Cloud itself. I cloned the project from GitHub to my desktop and then run it from eclipse. I tried to run it with different arguments, to choose between different profiles: the official github-profile, which is included already, and a custom profile for our own oauth2-authentication-server. But all i can get are 403-errorpages on all routes. Here are some example urls, i tried out:
http://localhost:8080/
http://localhost:8080/dashboard/
http://localhost:8080/dashboard/login
http://localhost:8080/resources/static/index.html
http://localhost:8080/foo/bar (non-existent fantasy url)
Obviously i must have missed some instructions, but i don't know where to look. The console-output does not show any meaningfull messages, in particular there are no warnings and errors, this suggests that the application is running just fine.
Shame on me, i tried to reproduce the error on a different machine with a different eclipse-version installed. It turned out that my run configuration has been set up in a wrong way. Deleting it and setting up a new run configuration solved the problem.
Related
I'm not sure how to phrase this so I apologize if the title of the question does not make sense to you.
Due to various historical reasons, I have multiple teams contribute to the same code repo, that serves multiple service endpoints. Currently all teams deployments and releases are done together which creates a lot of churn.
I'm trying to get to this state: team A and B can still share the same code base, but they can deploy separately using different Kubernetes namespace? Like:
Team A's code is all under com/mycompany/team_a, team B's under com/mycompany/team_b
Somewhere in the repo there is a config that does the mapping:
com/mycompany/team_a/* => config_team_a.yaml, that has a Kubernetes config, maybe with namespace TeamA/ServiceA
com/mycompany/team_b/* => config_team_b.yaml with namespace TeamB/ServiceB
So that they can build their image separately and, of course, deploy separately.
Correct me if I'm wrong, but from the description of your problem it looks like you actually have two problems:
The fact that you have separate services code in the same repo (team A and team B);
The fact that you have several environments (development/production, for example)
The second issue can be easily solved if you use Helm, for example. It allows you to template your builds and pass different configs to it.
The first one, can also be partly solved by helm, since you can also separate your teams builds using templating.
However, a few years ago, I was working on a .net monorepo and faced yet another problem: every time there was a PR merged to our git repo, a build was triggered in Jenkins for every service we had, even those that did not have changes. From the description of your problem, it is not clear to me if you have a Jenkins pipeline configured and/or if you are also facing something similar, but if you are, you can have a look at what I did to workaround the issue: repo. Feel free to have a look and I hope that helps.
I'm currently working on a java project with Spring and Postgres on Heroku, with most functions finished, but I've run into a major problem:
Whenever several users log in at the same time, their login information and data interferes with one another, due to my naive implementation: a "user" variable in the controller, which is a singleton and is shared across all users.
Why this doesn't work makes sense to me, but I'm not sure how to approach this problem. I should mention that I have very little experience with web development.
I've searched for possible fixes and it looks like there are multiple solutions, such as using Session Beans, servlets, java's httprequest and other functions, Spring Security, or instance variables? I've attempted tutorials for these, but probably due to my inexperience, I have yet to get one solution working for my existing code + Spring + Heroku.
My question is this - Which avenue is the best for me to pursue in order to solve my problem? It feels like there is are very simple fixes to this problem but right now I'm not sure what to try next. Simplicity is preferred and security is not a current concern for this project. If someone could point me in the right direction I would really appreciate it.
All my server-side code, with the exception of class files, is currently in the main controller java file, which used to be the "Getting Started With Java" file from Heroku. Many online examples have controllers in multiple files, which I don't know how to integrate into my existing project.
This is my first question on this site; if there's something I should add to my question, or if this isn't the right place to ask, please let me know. I'm also unsure if any of my code would be helpful for this question.
There can be a simple solution, try to reduce the scope of the user variable. Currently, you have a "user" variable in the controller, which is a singleton and is shared across all users, making it local and reducing its scope can solve your problem.
I see no activity within the last couple of months in the project spring-cloud-aws. No issues get answered, no PRs get reviewed or merged. This is a problem for my team, because we're trying to use this module, as we're heavily relying on spring boot apps and on sqs queues, but there are new features which does not get included into the module anymore, for example list typed message attributes for SNS messages.
One of my colleagues even opened a PR fixing the above issue, but there is no reaction. I do not really know how to raise awareness of this problem within the spring team.
Is the Spring developer team even aware of this issue and just don't care or is it unknown for them? If someone could take ownership of the project, at least for approving PRs, that would be great. I personally, would not really want to write custom implementations for integrating with AWS, or use the raw API without spring.
Unfortunately this sort of thing happens often to OSS. You may want to re-upload this as a derivative so changes can be made by you and the community once more.
This project is under the Apache license so derivatives are perfectly OK.
In the project allocated to me I have to understand a big Java project which uses Spring framework and angularjs for the frontend and I don't know where to start with. There is a lot of code running on the server (Jetty) and lots of logs generated. The back-end code is more of an interest for me than the UI side.
My question is where do I start? The Java code that we use for practice in college/academics very simple and had a 'main' method to start with.
In the big project I don't see a main method. How do I find out the 'starting point' of the project and then explore it further?
This question is somewhat similar but not exactly to Understanding a big company project in Java
One possible way to start exploring is find an important entry point to the application and then analysis layer to layer from code to code.
My following explanation is based on the information you have give in the comments of your questions. (application is based on angularjs and spring). It would be a good idea to adjust your question, so that these important informations are a part of the question (comments are temporary and could be removed without notice)
Start the application and find one of it's main functionality (or the functionality you want to extend on the next task).
Open the developer tools of your favourite browser and record all requests and responses. Trigger the action you want to discover. Analysis the records and find the corresponding REST call. Look at the request and response param and think about what this API should do.
Then you search for the corresponding REST-Controller inside the backend code. In most situation you can find it, if you search for some of the latter values of the REST-Call-URL path (which is bind to the controller or a controller method).
Now you have your entry point for that action and you can discover further on more or less similar as you would do it on a main method.
You can repeat this steps to get a understanding of the implementation of some features (one by one). Nevertheless there could be some important part of the application you will not find with this approach. But it would give you a starting point to explore the functions which are exposed by the web-interface to the user.
Depending on the architecture it might be that you find a place with some central core functionality. Then it would be a good idea to explore these core functions independently of the api to the frontend. If the application f.e. would take advance of a domain driven design approach you would find a layer where a functional (not technical) domain is designed. Then you will find the bigger picture here.
If you have anyone who know how the application is designed you should of course start you discovery by interviewing this person. If every one who has knowledge is not reachable, you have to look at some documentation or you have to discover the application on your own like I try to describe.
I have the following scenario:
I have a view in an Oracle server and all Iwant is to show that view in a web browser, along with an input field or two for basic filtering. No users, no authentication, just this view maybe with a column or two linking to a second page for master detail viewing. The children are just string descriptions of the columns of the master that contain IDs. No inserts or updates.
The question is which is the JAVA based web framework of choice that can accomplish the above in the minimum amount of
code lines
code time(subjective but also kind of objective if someone has expirience with more than one or two frameworks)
configuration effort
deployment effort and requirements.
dependencies and mem footprint
Also:
6. Oracle APEX is not an option.
3,4 and 5 are maybe the same in the sense that they are everything except the functionality coding.
I want something that I can compile, deploy by just FTPing to the database host, run and forget. (e.g. For the deployment aspect, Hudson way comes in mind (java -jar hudson.war and that's all)).
Also: 3,4 have priority over 1 and 2. (Explanation with a rant: I dont mind coding a lot as long as it is application code and not "why do we still use javascript over http for everything" code)
Thanks.
EDIT 1: ROO attempt.
First I tried Spring Roo but here is what happened and it is exactly the kind of stuff i want to avoid:
Downloaded Roo (setup env vars, path, etc)
Saw that it requires Maven (1st smell)
Installed maven
Setup my project in roo shell
Tried to run it and it could not build because maven could not locate artifacts.
Searched the web and eventually found that I need to tweak the generated pom because of a problem between springsource repositories and maven central caused when Oracle is used because of a minor bug in ROO that includes the maven repo and not the spring one... etc...etc..
Abandonded Roo because:
I wanted a simple one page presentation of a table view in a locally installed database, and after 30 minutes I had no progress except for searching maven forums for why maven cant find sth called an "artifact" in a list of sth called "repository".
Take a look at Spring MVC and Spring Roo. the latter will generate you Spring application in a matter of minutes with the database access and then you can add your filtering.
The hudson-like deployment should be easy if you're happy with the features an embedded servlet container like jetty or winstone can provide. Just add a main class that fires up the server and sets a few config variables. That should be possible with any java web framework.
Here's how hudson did it:
http://weblogs.java.net/blog/2007/02/11/hudson-became-self-executable
try (ยต)Micro and see if it works for you. It is Open Source, of course, and I also provided a couple of useful examples to start with. HTH - florin