Eclipse: no shown variables in debugging Java EE - java

Platform I am using:
Fedora 20;
mariadb-5.5.34-2.fc20.x86_64;
Eclipse Kepler Service Release from www.eclipse.org
I am implementing example
See here
and I am trying to manage to work the login interface.
Actually I am configuring TomEE to use JAAS auth technology.
Since I am having some troubles, I would like to solve them with the help of Eclipse debugging mode. To do that, I:
setted breakpoint at line number 79 of LoginController.java;
started TomEE in debug mode;
executed login.xhtml in debug mode too;
My problem is that I see nothing in debug mode: no variables, etc.
How is it possible? I have been using debugging mode for a long time, but it is my first time in web development.
Project archive
Click here for a larger Screenshot

The webpage bean has not been istantiated for an unknown reason. I opened a new question to fix it.
Bean not instantiated

Related

How to disable live reloading in Quarkus?

I have a Qurkus application which I run in Dev mode:
./mvnw compile quarkus:dev
I have an issue that Quarkus reloads classes also when I don't want it to (dependent project updated, etc) which takes quite a lot of time.
Question: Is there a way to disable live reloading in dev mode?
I went through the Quarkus documentation, but couldn't find if there is such an option.
You can disable it with Quarkus since 2.0.0.Alpha3 by enabling the corresponding option in the console (Quarkus tells you which key you need to press to do that - it's l).
See https://github.com/quarkusio/quarkus/pull/17035 for the pull request that brought this feature

Java Filter not working on production environment Websphere 8.5

I have a filter used for authorization. It's the first step entering application. Without it is not possible to do anything in the application.
I set a systemout on the very first line of doFilter method to monitor the behaviour, so comparing websphere server log files I'm sure that filter (same Ear deployed) on Test environment works and on Production environment not.
Maybe it's server configuration issue...?
I have access to read and modify WAS Console of test environment.
I have access only to read WAS Console of production environment.
So I can compare them, and maybe test some change on test environment to replicate the behavior and say to production administrator what exactly setup....
Any suggestion on which setting I can check (Was console, maybe in relation with Web.xml, etc...)?
Thx a lot for any suggestion.
EDIT
I was able to retrieve via FTP the EAR in InstalledApps of Production environment. I noted a file named "web_merged.xml" in which is missing the entry of the filter.
Maybe the problem is here? When is created and why? Why could be missing the entry there? How let WAS to create the right file (if the problem is there)?
The problem was the one on the EDIT in the question, webmerged.xml was wrong. We weren't able to understand why WAS generated this file in wrong way.
What I understand is generated during deploy and is a mix of web.xml of the applicatin with application server configuration.
That's a WebSphere issue, we guessed it has to do with application server cache. We asked to System Administrator to:
Uninstall the application
Stop the server in which the application was installed
Clear the cache
Restart the server
Reinstall application
From this point the file was generated in the right manner, as the application bahaviour.
Websphere version is 8.5

Include deployment timestamp into JSP page

I'm writing web applications with Java EE 7 using JSP and servlets, deploying to a local Wildfly 10 server.
To help me developing and testing my code, it would be useful to include a little timestamp into the displayed webpage, so that I can directly see when the version I'm looking at in my browser was deployed.
That would prevent me from both forgetting to deploy changes as well as from looking at old cached versions instead of the latest one.
How can I display the date and time when a Java EE web app got deployed to my Wildfly server directly on the webpage?
My IDE is Eclipse Neon for Java EE, if that matters.
This is not deploytime, but starttime of the application. Maybe it is useful for your purpose. You can inject the class and use it to display data on your page.
#Startup
#Singleton
public class Deploytime
{
private LocalDateTime starttime;
#PostConstruct
public void init() {
starttime = LocalDateTime.now();
}
}
Apart from that I can only think of Maven Git Plugin which can generate things like buildtime, commit id, ... into a propery file, which you can also use to display it on the page (if you use git/maven).
There is likely an API to do this too but you can get the server start time from the command line. Assuming that you have your admin user name and password set up (i.e. you've run something like add-user.sh) you could run:
curl --digest "http://user:password#localhost:9990/management/core-service/platform-mbean/type/runtime?operation=attribute&name=start-time"
Of course, this is not Java - you'd either have to do a System.exec on this or use something like HttpClient. Additionally, the big issue here is that you've got to have your admin username and password available to the code.
The Wildfly HTTP Management Docs go into some more detail with a small sample Java snippet.
EDIT:
Sorry - should not have assumed that the server restarts on deployment. You can get deployment time for a web app with:
curl --digest "http://user:password#localhost:9990/management/deployment/test-1.0-SNAPSHOT.war/?operation=attribute&name=enabled-time"
However, that seems more difficult than the other answer of running something at startup. I don't see a deployment time for a webapp as that time would have to be stored somewhere in case of server restarts.

Spring MVC 4 configuration and the 404 page

I'm new to spring MVC 4 and I have a problem- Each time I start a new project there is something wrong with the configuration which results in a 404 when I try to work with my controllers.
I there a way to see some logs which will make things more clear as to what I did wrong? I work with tomcat and I looked into his "logs" folder and there was nothing there...
I suggest you to use remote debugging from your Eclipse IDE, or debug the application from within the IDE. then you can debug the code line by line and see what is going wrong.
For Spring application development Spring Tool Suit has more support for developing Spring Applications.
EDIT:
You can also configure your Log level in Tomcat Environment. See this article for more information to change your configuration of logging accordingly (Run on DEBUG mode)

gxt + Java EE hosted mode

I'm trying to develop a Java EE + gxt application. I have an rpc call which calls a session bean's method.
If I compile the project and run it in the browser, it works fine, but when I use
hosted mode I get an exception like this: (edited for readability)
Exception while dispatching incoming RPC call
...
Caused by: java.lang.NullPointerException: null at org.Pecc.server.services.AppServiceImpl.
getUserEmailByName(AppServiceImpl.java:53)
Line 53 is:
return appSessionBeanBean.getUserEmailByName(name);
It's like the session bean can't be reached. Note that I have GWT4NB plugin and use it's "GWT hosted mode (w/o a Java EE server)" command, but I have glassfish running and the ejb module deployed in it. Shouldn't it be enough to work? If I remember right, I was able to use my ejb module in hosted mode at some point.
Any thoughts?
I hate to ask this, but are you able to debug and confirm the appSessionBeanBean is indeed not null? And if not, with log statements...
I found a workaround by redirecting the hosted mode browser to the module deployed in glassfish. I simply write localhost:8080/EasyTicket-web into the address bar instead of localhost:8888 (jetty's port.). Of course, glassfish has to be started for that to work.

Categories