tomcat deploy from netbeans - web-services

I write my first service in Netbeans 7.1.1 and can`t deploy it on Tomcat 7 server.
Tomcat server started.
In-place deployment at /home/likewise-open/PROMWAD/alexandr.kurkin/NetBeansProjects/HelloWs1/build/web
Deployment is in progress...
deploy?config=file%3A%2Ftmp%2Fcontext1698562612061154650.xml&war=file:/home/likewise-open/PROMWAD/alexandr.kurkin/NetBeansProjects/HelloWs1/build/web/
http://localhost:8080/manager/deploy?config=file%3A%2Ftmp%2Fcontext1698562612061154650.xml&war=file:/home/likewise-open/PROMWAD/alexandr.kurkin/NetBeansProjects/HelloWs1/build/web/
/home/likewise-open/PROMWAD/alexandr.kurkin/NetBeansProjects/HelloWs1/nbproject/build-impl.xml:729: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 44 seconds)
Tomcat`s log is without errors.
Deploy stopped in this line in build-impl.xml
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>

Netbeans can work with external Tomcat. But sometimes when you change of netbeans version or tomcat version, the configuration file get corrupted (build-impl.xml). So don't reinstall Netbeans the easiest way is to create a new clean project and copy/paste the source. I've encountered this kind of error many times (at least one project after each updates...) so I think it will work.

you need to make sure that, in tomcat/conf/server.xml, the URIEncoding is correct.
NetBeans put the context.xml in C:\Users\your-name\AppData\Local\Temp, so if your name is Chinese or ..., tomcat may not find the context.xml and fail to deploy your web-app.
<Connector port="8080" protocol="HTTP/1.1"
URIEncoding="utf-8"
connectionTimeout="20000"
redirectPort="8443" />

You will have to reinstall NetBeans. While installation NetBeans will show you both Glassfish & Tomcat as server option. You will have to select Tomcat as server. Hopefully, this will resolve your issue.
Please note that adding server externally in NetBeans causes problems sometime.

Related

Geoserver and moving to HTTPS

I've installed a Platform Indepednant Binary version Geoserver (http://geoserver.org/release/2.16.2/) successfully. It's been a while using it an no real problems. I now want to use this version of Geoserver for an OpenLayers website (that uses GeoLocation) but that requires all the component parts that use HTTP to use HTTPS...Geoserver is the last server I have that needs to be migrated.
I've looked online and there seems to be a lot of info on moving Geoserver to HTTPS but it doesn't all tie up with my installation. Some examples talk about server.xml files (which my installation doesn't have) and updating an apache conf file (/etc/apache2/sites-avaiable/smallmelo-le-ssl.conf) which I don't have either so I'm struggling to get instructions on my particular version of Geoserver. The docs state that it's running on a Jetty servlet. Does anyone have any documentation or links on how to configure https?
Progress!! So my installation is using Jetty. I've setup the keystore correctly with a valid certificate. I've updated the start.ini file to reflect the location of the keystore and password but...when I try to run geoserver I get:
ERROR : No module found to provide ssl for https{enabled}
I do not have an SSL.MOD module in the modules folder of my jetty installation. I did dig out a module (ssl) from https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.2.13.v20150730/ but I now get:
java.lang.IllegalStateException: No constructor class org.eclipse.jetty.server.ServerConnector([],{}) in file:/C:/Program%20Files/Geoserver/geoserver-2.16.2/etc/jetty-https.xml
I've struggled to find out how to update this file and add what is needed. Problem is I'm not a java expert so I don't want to just randomly copy someone elses config settings.
This is a simple case of finding a Jetty tutorial and following it, GeoServer doesn't care about https.
However, I should warn you that the reason you can't find much help in the GeoServer documentation is because you shouldn't run the platform independent binary in a production environment. This is the reason that the documentation expects a server.xml (part of tomcat) and assumes that you are behind an Apache2 or Nginx web server that is designed to handle ssl.
Both of the warning messages you mention come from bit rot in the Jetty configuration files on the GeoServer repository. You figured out that the ssl.mod file is missing, and adding it manually solves that issue.
The second error java.lang.IllegalStateException: No constructor class comes from a mix of Jetty version config files. The jetty-https.xml file that is in the GeoServer 2.16 repo is from Jetty 9.4, and the jetty-ssl.xml is from Jetty 9.2. At some point between those version, the location of the constructor <Configure id="Server" class="org.eclipse.jetty.server.Server"> was moved from jetty-https to jetty-ssl. It was not updated correctly in the GeoServer repo so there is a set of mismatched xml files.
I solved this by copying the jetty-https.xml file from 9.2 to match the 9.2 version of jetty-ssl.xml included with Geoserver. You could use the more current jetty files that match what Geoserver is running on, but make sure you copy all of them, ssl.mod, jetty-https.xml, jetty-ssl.xml, and jetty-ssl-context.xml.
Ok, just wanted to share this in case it was helpful. It is a bit brief but hopefully will be of use. Please note: My setup used a legitimate GoDaddy DNS/SSL Certificate so that may be a limiter for some and force you to use a self-signed certificate.
Thank you to Ian Turton who created the 'aha' moment :)
I used the following youtube video to get Tomcat and Geoserver installed: https://www.youtube.com/watch?v=RyCFKGm4NSw
Firstly, once I had Tomcat running (I used port 8081 as 8080 was already in use). Please be aware when I installed to port 8081 it didn't update the server.xml file, so I had to manually open it up and change
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
to
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
and then restart Tomcat.
I used a legitimate PFX file I downloaded from GoDaddy. I already have an SSL certificate/DNS setup with them so it was just a question of requesting a PFX file.
Secondly, I imported my PFX using JAVA installed from AdoptOpenJDK. I went to the commandline, navigated to the AdoptOpenJDK bin folder (which has a keytool.exe application). I then ran this command:
keytool -importkeystore -srckeystore c:/temp/mygodaddycert.pfx -srcstoretype pkcs12 -destkeystore c:/temp/mycert.jks -deststoretype JKS
When prompted for the password for the enter source password I got that from GoDaddy and then I used my own, completely different, password for the JKS file. I then copied my JKS file to ./conf/certs folder (I created the certs folder)
Thirdly, I added this to my /conf/server.xml file:
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150"
SSLEnabled="true" scheme="https" secure="true" sslProtocol="TLS"
keystoreFile="conf/certs/mycert.jks"
keystorePass="<your_jks_password_when_registering_with_keytool>"
/>
I restart Tomcat...
Then I used my DNS from GoDaddy to connect to the instance: https://myXYZ.de:8443/ and voila Tomcat running on SSL with no certificate errors. Since Geoserver was installed. I can just add geoserver to the end: https://myXYZ.de:8443/geoserver and voila number 2.

Trying to Use the InfoRecoverySample in IS 5.0.0

I'm trying t use the InfoRecoverySample in IS 5.0.0. I was able to build it as according to the instructions here:
https://docs.wso2.com/display/IS500/Recovering+Account+Information+Using+a+Webapp
However after placing the war file in [IS_HOME]/repository/deployment/server/webapps/ and restarting, I get errors in the application logs. Unfortunately they are very vague:
org.apache.axis2.deployment.DeploymentException: Error occurred while deploying webapp : [IS_HOME]/repository/deployment/server/webapps/InfoRecoverySample.war
Error occurred while deploying webapp : [IS_HOME]/repository/deployment/server/webapps/InfoRecoverySample.war
Error while deploying webapp: StandardContext[InfoRecoverySample.war].File[repository/deployment/server/webapps/InfoRecoverySample.war]
My best guess is that the pom.xml file is out of date because I see lots of references to 4.2.0. This is the pom.xml file I'm using:
https://svn.wso2.org/repos/wso2/people/chamathg/samples/is/InfoRecoverySample/pom.xml
Does it sound like I'm on the right track? If so, is there an updated pom.xml file (or sample project) out there?
TIA,
Mike
Deploy the war file in your tomcat/webapps folder, not the identity server webapps. then access via localhost:8080
edit:
The way the pom is designed is for deployment on your localhost, not the wso2 server. Despite what the instructions say. However, you can deploy it to [IS_HOME]/repository/deployment/server/webapps/ as long as you remove most of the jar files that are created in the war's WEB-INF/lib directory. These will conflict when being run from the IS. The only one you need to leave is org.wso2.carbon.identity.sso.agent-1.2.0.jar. remove, re-zip, and then redeploy.

How to deploy the Web service in to tomcat 7 from out side of eclipse juno?

i am very new to web services and i have one problem please suggest me .. i.e i have a WSDL(SOAP) file and with that i created the Web Service-server and web service-Client using Top-Down approach with JAX-WS in eclipse Juno Java EE. i integrated the Tomcat 7 with that Eclipse and from eclipse its working fine.
But my problem is i need to run the Tomcat from out side of the eclipse and i need to deploy the web service in to the tomcat. i don't want to run the Tomcat using eclipse? i just need to run the client from eclipse but i dont want to run the tomcat from eclipse. Please Help me.
File -> Export -> Web -> War (configure where to create it)
Deploying a tomcat application consist of building a war file then deploying it. We call this servlet.
Building the WAR
As you already have your server code, you should now complet the WEB-INF/web.xml file. This file describe the path of your servlet(your server code), on the tomcat server. Depending of your framework you can have some configuration to add in your META-INF/context.xml file.
In an eclipse project, thoses file are generaly under a directory name 'webapp' in your project. (src/main/webapp for a maven project).
First you must use the javaee & javaweb tools of eclipse to build a war file that contains all yours libs, files, class and web.xml
Alternativly you can use a maven build process to get a war, if you use maven.
Deploying the war
After installing tomcat, the deployement is as simple as drop the .war file is deploy directory of the home-directory of tomcat. Then your application is usable on default port 8080.
If you have install also the manager webapp of tomcat, you can see all yours currently deployed application in the manager http://myurl:8080/manager/html.
When you install tomcat, let be sure that your eclipse pseudo server is shutdown, or your tomcat server will have problem to get it's port and startup.

Jetty won't work: Is there a way to purge it?

I'm a Jetty newb, but it's making life hell. First there was an Eclipse problem I described in another question. Rather than waste time on it, I decided to just run Jetty from the console. I started off importing a sample Tapestry project and was able to run it fine... the project is on the Tapestry page and is called tutorial1
I began work on my own project then and began introducing new functionality to it. At some point it stopped working. I tried backtracking my project to get it to a working state but every time I requested the home page it would just hang. At this point I still thought it was my fault, though I did think a more graceful error message would have been nice than the it attempting to load for a minute followed by a server timeout error.
I then shutdown jetty and attempted to load up the imported sample project using mvn jetty:run in my tutorial1 project directory. it doesn't work either! When I try going to localhost:8080/tutorial1 or the URL of my project the jetty console does show any output, almost as if it's not receiving the request.
I rebooted my entire machine but that doesn't help. I am not familiar with jetty architecture and am unsure if there is a way I can purge all my files from the jetty web application directory.
Any ideas?
Cliffs Notes:
Downloaded Tapestry Archetype project with maven.
Executed jetty from the command line using mvn jetty:run
Started new project
Executed jetty from the command line using mvn jetty:run
Modified new project
Error occurred, attempted fix and restarted Jetty (Ctrl + C, followed by mvn jetty:run)
Jetty restarted, but did not seem to handle requests for any pages
Tried starting jetty from Archetype project, experienced the same problem
If your project didn't deploy correctly, jetty won't serve any pages (they will either return 404 or some error in the 500s).
Look at the log folder and check if it is getting correctly deployed.

where to place clientaccesspolicy.xml file into the apache tomcat server deployed in eclipse IDE

I have a silverlight application and i want to call a apache cxf web service written in java in my eclipse and published on apache tomcat 7.0 through eclipse.
so now when i call this web service from my silverlight application from visual studio 2010 i get follwing error:
An error occurred while trying to make a request to URI 'http://localhost:8080/complesxtypeWebService/services/CompanyServicePort'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services
when i search for this on web i found that i need to place clientaccesspolicy.xml file in the root directory of domain service.
so my problem is where to place this xml file . can it be placed somewhere in eclipse project folder or somewhere in apache tomcat folder. please let me know where to actually place this file.
my all development are done locally and everything is being tested locally.
thanks
vicky
I placed the clientaccesspolicy.xml file in C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT and it works for me.
Please note that this is Windows 7 PC and if I remove the file, I get the dreaded cross domain error.