I have a very basic web service that I think is running correctly from Eclipse. Now I want to add in connections to a DB -- so I want to step thru the code to try out JDBC connections (I'm a .NET developer working this out in java).
Here is the (very) basic code:
public class PositionSkillManagementService {
private String t;
public void addSkill(String s){
t="s"; //I want to add a breakpoint here.
}
}
I think the webservice is working because when I go to this URL"http://localhost:8080/TrainingSystem/services/PositionSkillManagementService" I get a screen that says "Hi there, this is an AXIS service! Perhaps there will be a form for invoking the service here..."
I want to add a breakpoint in the addskill method so I can then debug connections to the db. I have added the breakpoint in eclipse and I see the little dot showing the breakpoint is set. But I don't know how to 'get' to the breakpoint? I don't know how to tell eclipse to execute the method so I can get to the breakpoint. I'm sure this is a basic question but I'm new to the environment.
What do I do?
Complete these few steps
Start your Web Application Server (Tomcat, JBoss, GlassFish, etc) in debug mode.
Deploy the component that contains your web service (usually a Web Application).
Invoke your Web Service somehow, for example, using the Web Service Explorer, the application would stop in your breakpoint.
This might be a bit late, but just in case.
I followed the steps from Luiggi Mendoza and worked great. The only thing, I had got the error "Source not found" and added the project to the look up path. Here are the steps I followed:
Debug Web Services & Deployed EJBs
Complete these few steps:
Start your Web Application Server (JBoss) in debug mode.
Deploy the component that contains your web service (MyTest.ear).
Insert a breakpoint at the line you wish in your code.
Invoke your Web Service somehow, for example, SoapUI, calling the REST endpoint through a browser, or using a service tester.
When the breakpoint hits, you will most likely get an error message in Eclipse saying Source not found.
Click the button Edit Source Lookup Path
Click the Add button in the next dialog
Select Project type and click OK on the next dialog.
Select the project(s) that have the code under investigation. Make sure you select checkbox to Add required projects if required
Click OK, and OK again. You debug breakpoint will hit. Stepping through the code will load the code files from the projects you selected for code lookup.
Follow regular Eclipse/Java debugging procedures.
You need to go to /PositionSkillManagementService/addSkill if you're using Axis. I'd recommend using SOAPUI to parse the endpoint if you do go down the SOAP route.
As soon as that line of code gets fired and providing your server is running from debug (click this icon ) it will fire the breakpoint when it hits it and go into debug mode so you can step over / step into the method.
Related
I have a enterprise GWT product that runs on Tomcat8 on a retail store's local server. I have an independent daemon running that check for and installs updates The update process consists of downloading the file, stopping Tomcat, putting the updated file in place, and restarting Tomcat.
Now, if the user has this scheduled for 2 in the morning when no one is using the app, that's fine.
But, they also have the option to go into the admin settings and manually click a button to apply the update. When they do this, I'd like to be able to put up some sort of page when someone tries to access the app saying it's upgrading, and then have the browser refresh when it's back online (if they are sitting on the temp page.)
Does Tomcat facilitate this somehow? I don't feel like GWT can, because Tomcat isn't serving it up for it to be able to do anything. My app can be installed on Windows or CentOS, if that matters.
To address your issue we can do any one of the following
Once user click on upgrade button start showing him some masked view. Behind this view you can write down a timer which will keep hitting some dummy serivce/rpc call from server after specific time interval. Based on the response code you can understand whether tomcat is up or not.
We can write down some kind of web socket. Which do above job for us and try to connect automatically once server is up and running. Using events from such socket we can hide our upgrading view and take back user to required screen.
Got my Glass last week. Working on running the Java version of the Quick Starter Glassware demo. I am having trouble with the OAuth callback. Do I need set this up myself? Or is there source included in the sample somewhere? Please help!
Clarification: I have set up my own project with the Java Quick Starter app's code, deployed it in EC2 and have set up the Client-ID and Client-secret in the Google APIs Console. I set the Redirect URI as http://<my server>/<my-app>/oauth2callback. When I visit the app in the browser, I get a 404 error that /oauth2callback is not found. I also tried setting the Redirect URI to just my app's root, i.e. http://<my server>/<my app>. Strangely, I still get the same error that /oauth2callback is not found.
Additional questions: Can you please clarify what the callback URL needs to be set to? Is the handler code already included in the quick-start-demo app or do I need to provide that code?
I think the problem is that you're not using a URL that actually maps to your server and servlet container. Try hitting the URLs directly from a browser and make sure they show up in your server and servlet container logs.
The callback url needs to be set to the oauth2callback servlet, relative to the path that leads to the server and servlet container. I don't know how you've set these up, so I can only guess, but it sounds like the <my app> portion isn't correct.
The handler code is included as part of the webapp. See the web.xml file to see the path mapping and the servlet object that it maps to. In this case, around line 53, oauth2callback is mapped to the com.google.glassware.AuthServlet class.
Update: See also the answer posted at Java Google glass starter project mapping in AWS EC2
I have created a sample web application in Java. It has no errors, and I was able to create a WAR archive successfully. I also tested this successfully in local Tomcat 7 server.
Now, this sample web app has 2 servlets- "home" and "runsinglecrawljob". The name of the war archive is "sparkcrawler0.12.war".
So, in local Tomcat, I access the web app at
http://localhost:8080/SparkCrawler0.12/runsinglecrawljob
And the other servlet is
http://localhost:8080/SparkCrawler0.12/home
Now, when I created an Elastic Beanstalk environment, I specified health check url="/home"
But I am getting error that health check url is not responsive, and because of this the application is not running in Elastic Beanstalk- it is showing a 503 error- as per Google Chrome this is the exact message --
"HTTP Error 503 (Service Unavailable): The server is currently unable to handle the request. This code indicates this is a temporary condition, and the server will be up again after a delay."
Now, what is the correct value of health check URL?
Also, if my URL is
http://spark.elasticbeanstalk.com
as defined in Elastic Beanstalk, then do I access the web app at
http://spark.elasticbeanstalk.com/SparkCrawler0.12/runsinglecrawljob
Or do I access the web app at
http://spark.elasticbeanstalk.com/runsinglecrawljob ?
I don't know if this is related or not, but I have a very similar issue but with a PHP codeigniter application.
I uploaded the application, and 'index.php' is the normal starting point of the application.
I also have a simple "phpinfo.php" that sits parallel to the index.php.
So, the URL is myApp.elasticbeanstalk.com which hits index.php and it is fine.
However, for my health check, I set it to /phpinfo.php because I want myApp.elasticbeanstalk.com/phpinfo.php to be used as the health check.
If I do this, the health check always fails, and so my application does not run and I see the glaring red box of doom.
This has been driving me crazy.
(Why do I want to do this? -- it's because I wanted to add an .htaccess file to the application root that requires a password for everything except the phpinfo.php file, and I tested this locally and it works. I did not add the .htaccess file yet -- I just wanted to see if I could point the health check to something besides "/" and have it work.
UPDATE --
I sorted out my issue. It turns out that when I launch one of these elastic beanstalk environments, I have to set up the healthcheck url right then and there to be /phpinfo.php and then upload my application. When I was fussing with this earlier, I would try to edit the configuration later to change the health check url and that never worked and the instance would never come alive again.
I'm using WebSphere 7 (running my web app from within IBM RAD 7).
I'm trying to enable application security for my web app.
In the console, when I select Security > Global Security > Administrative Security, check "Enable administrative security" and click "Apply" ... there appears a box at the top of the console that says (among other things) "Save directly to the master configuration". I click "Save" and the changes are saved.
However, when I select Applications > Application Types > WebSphere enterprise applications > "MyAppEAR" > Security role to user/group mapping, and map my user group to my user, the "Save directly..." link never appears.
I can't figure out how to save my user-to-group mappings. While they appear in the on screen table of mappings, as soon as I click away and come back, they are gone.
Any help on this is greatly appreciated, thanks!
Rob
Within RAD, edit your server definition (double click on WebSphere Application Server in the Servers view). Under the section "Publishing settings for WebSphere Application Server", check "Run server with Resources on Server" (versus within the workspace).
Restart everything and retry your role mapping.
Also note that user/group mapping via the WebSphere console is a multi-step process. You must click OK on the "Security role to user/group mapping" after returning from the panel on which you actually map roles. (That is, you must click OK twice to get the role mappings to stick.)
I can't think of any answer. Can i suggest that you try another browser (you might think i am crazy but when i see things not working as expected i would try something like this).
If you make changes and the Server has recognized that there are changes it should give you the option to save.
In this case, it doesn't provide this information implies the server is not receiving the changes hence the suggestion to try and use another browser.
I have seen crazy stuff when i use Chrome (which is my preferred browser) and i switch to FF when the web application behaviour is bizzare.
HTH
Turns out my problem is exactly this same at this guy's problem:
Security role to user/group mapping in WebSphere 7 with file-based user registry
I used his solution to work around the missing "OK"/"Save" buttons.
I'm working on an assignment. An online order system using EJB 3.0. im using jDeveloper 10 and oracle 10g for the database. i have coded around 20%, now i need to check the system that i have developed so far. so when i run the web client it does not show me any error and it runs successfully. but when the browser tries to open the page it says. HTTP 500 internal error on the browser. My jsp page is under web directory anyway. output pic is attached.
how could solve this issue?
Are there any log files on your web server ?
Put in your code some statement to log to file what is doing.
Use a browser with developer support, like Firefox with Firebug, and watch the HTTP transactions.
Which other conditions change between web client and browser mode ?
how could solve this issue?
Look at the log files in your EJB server. There will probably be an entry or entries corresponding to your browser's attempting to fetch the page that resulted in the 500 error. They should give some information about what is happening, and may even give you a stack trace. Also check the SEVERE / ERROR / WARNING entries prior to the event.
If that doesn't give you an answer, you need to investigate what is different about the requests when they come from your web client versus from your browser. If your EJB implementation has a way to capture the incoming request headers, use that. Otherwise, you could use wireshark or tcpdump to capture them.
Thanks for your contributions.
I guess it was something wrong with my jdeveloper 10. i installed the jdeveloper 11 n i started running on it. the project started to run successfully.