Customization YCommerceWebService - Webroot "/rest" not working anymore - rest

I created a YcommerceWebServices with "ant extgen", added it in localextension file, I added the oAuth2 authentification extension.
When I was doing request from postam like :
https://localhost:9002/rest/v2/{baseSiteID}/users/{userID}/...
It was working, I was receiving all the information. Since I started to customize I get all the time HTTP Error 302 Moved temporarily .
Even when I am on the hac and I click on my customExtension in the column web on "/rest" I get a 404 (before it was working too)
I tried to "Ant clean all" and update from Hac, no result.

The problem came from the fact, that during my customization by modifying the file /web/webroot/WEB-INF/config/v2/dto-level-mappings-v2-spring.xml
I had made an error on the declaration of a bean.
Indeed looking carefully at the compilation and launch of the server (ant clean all - ./hybrisserver.sh). I saw that there was an error. the launcher was launched but my webservice was not active.

Related

getting error message "Failed to load resource: the server responded with a status of 404 (Not Found)"

I have a simple MVC web application, which was running locally without problems 3 weeks ago.
When I now open the application in Netbeans and run it, everything seems to work fine as well. However, when I go to the browser (in my case google chrome) to look at the app's frontend (at http://localhost:8080/optimizer), I get the following error message:
HTTP Status 404 - Not Found
In Chrome's javascript console the following error message is given:
optimizer:1 Failed to load resource: the server responded with a status of 404 (Not Found)
"optimizer" is the name of the app. (What's the point of the "1" in "optimizer:1"? ... I don't get this either.)
The server (payara) is running:
I can also reach the server's admin page:
However, somehow the server cannot seem to find the application, although 3 weeks ago everything worked fine ... I just don't get it.
What's wrong? How can I fix this?
UPDATE:
Clicking on "List Deployed Applications" in Payara's Admin Console reveals that my app is not(!) deployed.
I tried to deploy it by clicking on "Deploy an Application" -> "Choose file".
I selected the jar-file "optimizer-1.0-SNAPSHOT.jar", selected Type "EJB Jar", then clicked on OK.
I got this error message:
Archive type of /private/var/folders/hh/hgq7wrjn5d51gy2tkbxkkbwh0000gn/T/optimizer-15075570634779987058.0-SNAPSHOT.jar was not recognized
How can I deploy my app? And why did it work automatically before and now it doesn't work any more?
UPDATE 2:
A difference I realise compared to before (3 weeks ago) is that the browser doesn't open automatically any more when I run the app.
Furthermore, Google Chrome used to be the IDE'S default browser ... now there is just a grey globe and I can no longer choose Chrome as my browser:
UPDATE 3:
I just noticed there is an error message that appears when the server is started (it's in the middle of hundred of rows of log output so I didn't notice it at first):
UPDATE 4:
-> NetBeans IDE 11.2
-> Payara Server 5.193
Error clearly shows, server is not able to recognize archive type of jar,
Archive type of
/private/var/folders/hh/hgq7wrjn5d51gy2tkbxkkbwh0000gn/T/optimizer-15075570634779987058.0-SNAPSHOT.jar
was not recognized
From payara blog,
If you set “Location” by “Packaged File to Be Uploaded to the Server”,
the suitable type would be selected.
So, the suitable type would be selected automatically.
Also, optimizer-15075570634779987058.0-SNAPSHOT.jar is not an original jar optimizer-1.0-SNAPSHOT.jar
It seems that issue is with the path of an archive, from thread
Code in uploadFrame.jsf:
<sun:form id="form">
I probe to change it to:
<sun:form id="form" enctype="multipart/form-data">
in uploadFrame.jsf into console-common.jar file. And it works.
You can try with changing uploadFrame.jsf into console-common.jar file.
(Not sure if chrome takes care of this, as it was working for you with chrome).
You may also want to try manual deployment,
install-directory/bin/asadmin deploy PATH_TO_ARCHIEVE/optimizer-1.0-SNAPSHOT.jar
Ok, I now found out how to run the app locally without problems: by creating a .war file instead of a .jar file - now I can run the app again without problems.

Need help setting up a (Tomcat) web app in Eclipse for debugging

I've been using both eclipse and tomcat for years but have always deployed my web apps externally and never had a problem. Now I'd like to use eclipse to debug my web app and I can't figure out how to make it work. I started by trying to get my existing web app to deploy through eclipse but after hours of trying different things I decided to start fresh. Unfortunately, I didn't get much further. I'm hoping if I can figure out how things work with a fresh webapp I can get things to work on my existing. Sorry, this will be long, but here are the steps I tried on the latest eclipse (Juno):
Installed new version of tomcat 7.0.34 at /usr/java.
In eclipse, used "servers" view to add server, pointing to the new install (I didn't add any resources because there weren't any available yet). Starting the server worked and got a 404 as expected at http://localhost:8080/ ... then I stopped it.
Created a new "dynamic web project", named it TomcatDebug, set the location to ~/tomcat-debug, chose the server just created above (the only one), chose default config, tomcat-debug is empty so chose defaults for build paths, defaults for module settings and had it generate web.xml.
In the "tomcat-debug" folder it creates WebContent, build, and src. I throw a sample "hello, world" index.html into WebContent.
Now the project TomcatDebug is created so I try to run it, tell it to "run on server", and it goes to http://localhost:8080/TomcatDebug/ but gives a 404. I even try to add index.html but it still gives a 404.
This is about as basic as it can possibly get so what did I do wrong?
Continuing to try and figure this out I stop the server, change the server setting to "use tomcat installation", but still get a 404 in the same way when I restart. I tried changing my module context path and still 404.
I'm completely stumped. I believe I followed all the wizards as basically as possible. Where did I go wrong?
Thanks for taking a look.
I haven't run tomcat through eclipse in a while, so can't answer that aspect of the question. But, to get at the heart of what you're trying to do (debug a webapp in eclipse through tomcat), you shouldn't necessarily need to. This may serve you instead:
EDIT: Eh, look here for instructions ("Debugging" section). The below is how I did it (JUNO and TC 7) and has an annoying quirk in point #1.
edit the startup.sh (assuming *NIX/OS X) - the last line will probably be
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
change this to
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$#"
to activate debugging. (there are other ways to do this that may be better - i think tomcat/the VM may pause for listeners before proceeding, so when you aren't debugging this is not ideal)
Create a Debug Configuration in eclipse, under the "Remote Java Application" set. Default port should be fine, and presumably host. Choose your project.
Add sources of relevance to your debugging in the Source tab.
Start server and run your new debug configuration. App should stop at breakpoints you've set.
Right Click your index.html Run As -> Run On Server you will see Tomcat will automatically run the page.

Click Once Deployment Error

I am new to Click Once Application deployment so I think I may have a simple problem. I have a window app that I created and deployed successfully as a ClickOnce App using Vis. Studio 2010 and deploying to a web service. I made some changes to the app and changed the deployment location so I started the click Once Process over. Now when I deploy I get an error. The app builds fine, runs fine in VS 2010, when I deploy files are created. Double clicking the App.application file will start the install of the app with a .Net framework error.
"Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
System.UriFormatException: Invalid URI: The URI is empty..."
I have double checked and triple checked the Publish Foldre Location and INstallation Folder URL to make sure they are pointing in the correct places and using the correct format. I double and triple checked the Updates dialog box when you click the Updates button. The combobox for the Application Updates matches the Installation Folder URL. "\MyServer\Users\Administrator\Desktop\Transfer\Deploy\" I double checked to make sure the required files are correct. Security settings did not change.
What could I be missing?
It seems you missed one backslash in your installation folder URL:
\\MyServer\Users\Administrator\Desktop\Transfer\Deploy\
Please make sure that if you are using some image/sound or log files then its Build Action must be "Content" type.

tomcat6 application deployment error

I am new to tomcat and servlets and am trying to deploy my first web application in tomcat and the index.jsp page is showing up blank.
It works fine in eclipse. I have the web.xml for the application setup to have the index.jsp as the default page. I am able to run the application and debug it in eclipse but when I export it as a WAR file and deploy it in tomcat and try to access it through a regular browser I get a blank page.
What am I missing here? Any help is greatly appreciated.
Thanks,
- Vas
If you ever get a blank page, the most important information you (and we) need are:
The request URL.
The already sent data -if any- (webbrowser > View Source).
The response headers (Firebug? Webdeveloper Toolbar?).
The server logs (stdout, stderr, webapp).
This usually indicate a wrong URL (to be proven by 1), or an exception halfway a JSP page (to be proven by 2 and 4), or an internal server error without an error page (to be proven by 3 and 4).
You need to configure your server.xml file and declare a context for your web application. You can find the documentation here: http://tomcat.apache.org/tomcat-6.0-doc/config/context.html
But a blank page is kind of weird, because I think if your web application wasn't deploy correctly, you will get a Http 404 error.

Debugging Zend Framework in Eclipse, mod_rewrite problems

I have a simple ZF that already works well.
I've set it up to work in a subfolder, so I access it with localhost/zftutorial URL.
Now the time came for debugging, but when I execute debugger in Eclipse, it appends debug URL params (like XDEBUG_SESSION_START=ECLIPSE_DBGP) which break everything and I start getting this message:
> Zend_Controller_Dispatcher_Exception: Invalid controller specified (index.php) in C:\Program Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php on line 241
I've tried to set both localhost/zftutorial and localhost/zftutorial/public/index.php as start URLs for debugger, but still getting the same message.
Looks like ZF likes clean URL names, but Eclipse wants scripts with php extensions, but controller names. Whichever debug options I use, Ecplise tries to start debugging from
not Zend-style URL - http://localhost/zftutorial/index.php
I guess this can be solved 2 ways:
configuring Eclipse somehow to use a proper URL with debug params, like localhost/zftutorial
setting rewrite rule for localhost/zftutorial/public/index.php to be rewritten as localhost/zftutorial (right?)
I've come to a conclusion that such problems are best avoidable by setting up ZF application
public folder as root folder in web server. Such root placement is a recommended practice and causes are no debug-related problems like above, unlike when ZF app resides in a subfolder and mod_rewrite rules break things now and then.