Axis2 - always getting 404 errors - java

I'm trying to move some Web Service stubs from Metro to Axis2, however after generating my stubs using wsdl2java I'm constently getting 404 errors whenever I try and make a service call.
16/12/2010 11:14:57 AM org.apache.axis2.deployment.ModuleDeployer deploy
INFO: Deploying module: addressing-1.5.3-jar - file:/C:/Users/xxx/.m2/repository/org/apache/axis2/axis2/1.5.3/axis2-1.5.3-jar.jar
16/12/2010 11:14:57 AM org.apache.axis2.transport.http.HTTPSender sendViaPost
INFO: Unable to sendViaPost to url[xxxx]
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:307)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at au.com.jpaterso.betcalc.axis2.tab.LoginStub.getKey(LoginStub.java:184)
at au.com.jpaterso.betcalc.axis2.tab.Test.main(Test.java:13)
Exception in thread "main" org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found
at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:307)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:438)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at au.com.jpaterso.betcalc.axis2.tab.LoginStub.getKey(LoginStub.java:184)
at au.com.jpaterso.betcalc.axis2.tab.Test.main(Test.java:13)
The URL that it's trying to connect to is definitely correct as I can access it via my browser/SoapUI.
Any help would be greatly appreciated!
Thanks, Joseph.

You didn't provide much information about the environment in which you try to deploy your WS. E.g. is this a webapp running under Tomcat/JBoss or maybe the standalone server deployed with Axis2?
From the trace that you have posted I suppose that there is a connection with your server but your WS is not successfully deployed. I assume that you may use the standalone server for your tests and I suggest:
Go to your WS repository. On my test machine this would be something like ~/axis2-x.x.x/repository/services and make sure that your service is there (either the .aar file or the unpacked version).
Start the server and check if your service is really deployed. On my installation, for example the server will generate the following output (not complete):
me#melinuxpc:~/axis2-1.5.1/bin> ./axis2server.sh
Using AXIS2_HOME: xxx
Using JAVA_HOME: xxx
Using JAVA_OPTS: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Listening for transport dt_socket at address: 8000
[INFO] [SimpleAxisServer] Starting
[INFO] [SimpleAxisServer] Using the Axis2 Repository xxx
[SimpleAxisServer] Using the Axis2 Repository xxx
[SimpleAxisServer] Using the Axis2 Configuration File xxx
[INFO] Clustering has been disabled
[INFO] Deploying module: xxx
[INFO] Deploying Web service: MyTestService - file: ~/axis2-1.5.1/repository/services/MyTestService/
Check if your web service is deployed and there are no errors. You may check if the WSDL of the service is available "in the browser". On my test machine the URL will be:
http://localhost:8080/axis2/services/MyTestService?wsdl
While a list with all deployed services may be seen at:
http://localhost:8080/axis2/services/
And do not be too quick in abandoning Axis2 ;)
Good luck!

I also see this error when use "axis2-wsdl2code-maven-plugin" to generate stub for a .NET webservice (.asmx).
I fixed by disable "chunked" of _serviceClient. Only add below code in method Constructor of file stub.
_serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, "false");

Related

Two war files deployed in same docker container is not accessible

I have deployed two war file in docker container, say app1.war and app2.war. app1.war is calling internally app2.war to access few services. I am able to access service in app1.war from browser and internally when app1.war tries to call service in app2.war I am getting following error
I am using Apache server and each request will be first hit to apache server and then directed to the services running in container. Apache server is running in my host as a service.
I have created Dockerfile by taking tomcat as base and copied app1.war and app2.war in webapps folder and expose port is 8080
and build image as
docker build -t myapp .
execute it as
docker run -it -p 9999:8080 myapp
http://localhost:9999/app1/service1 ----- this is accessible and this URL is internally calling a service which is deployed in app2 http://localhost:9999/app2/calculation
on hitting http://localhost:9999/app2/calculation URL I am getting below error
Connection error for URL[http://localhost/app2/calculation/]. Exception: [I/O error on POST request for "http://localhost/app2/calculation/": Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused); nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:80 [localhost/127.0.0.1] failed: Connection refused (Connection refused)].
I am looking for a solution for this issues and want to know where exactly the issue is. Any response is highly appreciated.
Your app2 deployed on Tomcat is exposed on port 8080 within the container, not 9999. Therefore, you're getting error when trying to access it on port 9999 from within the container. If you change internal endpoint to 8080 for app2, it should work.
Now, deploying 2 war files on the same Tomcat like this is actually an anti-pattern in containerized world. The usual architecture would be to have 2 separate images/containers, each having its own war file.

Glassfish: There is no cluster named localhost in this domain

I am new to glassfish and java ee programming. I am using Netbeans. When I try to deploy my web application to glassfish server, my project output shows
The module has not been deployed.
And in the glassfish server log:
WARNING: There is no cluster named localhost in this domain.
SEVERE: There is no instance named localhost in this domain.
Any comment would be helpful. thanks guys.
In glassfish/domains folder is there a domain called domain1 (default name). if not you need to create a new domain. if there is one then make sure under glassfish/domains/domain1 a file domain.xml points to all instances of localhost

"Uncaught Could not connect" error when using Openshift to deploy .war for PHP/Java bridge

Problem: Recieve 'Could not connect' error when using Openshift to deploy .war for PHP/Java bridge
Below I describe every step I've taken to get to this error, thanks in advance.
Full error: (IP concealed)
"Fatal error: Uncaught Could not connect to the JEE server W.X.Y.Z:8080. Please start it. Or define('JAVA_HOSTS',9267); define('JAVA_SERVLET',false); before including 'Java.inc' and try again. Error message: Connection refused (111) thrown in /home/stevenw1/public_html/softwareProject/real/inc/Java.inc on line 989"
Players: "Java_Bridge.war" = my java .war file that php will use to call methods from
"W.X.Y.Z" = Unchanging IP address of deployed .war file
"GUIProfile" = a Java class with #WebServlet("/GUIProfile") as public class GUIProfile extends HttpServlet
"tomcattest.php" = test file that calls GUIProfile's static method 'validate'
Deployed Java_Bridge.war and tomcattest.php work fine on my local tomcat, just not yet on Openshift.
Senario:
0. followed command line steps from Openshift 2012 java tomcat application
1. Using Openshift's rhc I have created my first app using "rhc app create -a tomcat6 -t jbossews-1.0"
2. cd ~/tomcat6/; git rm -rf ./src/ pom.xml
3. cp ~/Java_Bridge.war ./webapps/; git add ./webapps/Java_Bridge.war; git commit -m "first try"; git push
//notable output includes:
remote: Stopping jbossews cartridge
remote: Sending SIGTERM to jboss:386662 ...
remote: Skipping Maven build due to absence of pom.xml
remote: Preparing build for deployment
remote: Deployment id is bd83d6eb
remote: Activating deployment
remote: + '[' Java_Bridge.war ']'
remote: Starting jbossews cartridge
remote: Found W.X.Y.Z:8080 listening port //(not actual IP)
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
to ssh://thisisnottheactualuser#tomcat6-notthenamehereeither.rhcloud.com
4. Thinking the .war was deployed I ran a tomcattest.php that calls a java method 'validate', from java class GUIProfile that extends httpservlet, using the php/java bridge Java.inc
//of course using the same IP from above...
cat tomcattest.php;
<?php
define("JAVA_HOSTS", "W.X.Y.Z:8080");
define("JAVA_SERVLET", "/Java_Bridge/GUIProfile");
require_once("Java.inc");
$valiationOutput = java_context()->getServlet()->validate("hello");
echo $valiationOutput;
?>
EDIT: later tried this also in all instances: same results exactly
cat alternatetest.php
<?php
define("JAVA_HOSTS", "W.X.Y.Z:8080");
require_once("Java.inc");
echo java("java.lang.System")->getProperties();
?>
The output of calling tomcattest.php is the 'Fatal error' you see at the top.
Double Check:
5. ssh thisisnottheactualuser#tomcat6-notthenamehereeither.rhcloud.com
6. env | grep "IP"
OPENSHIFT_JBOSSEWS_IP=W.X.Y.Z
7. env | grep "PORT"
OPENSHIFT_JBOSSEWS_HTTP_PORT=8080
OPENSHIFT_JBOSSEWS_JPDA_PORT=8787
8. changed port in tomcattest.php to 8787, didn't change a thing of course.
9. restarted from the top, this time keeping ./src/ & pom.xml, same 'Deployment completed with status: success', same error using tomcattest.php with new listening IP...
10. tried solution from 'openshift youtube vid 2012' seemingly outdated. Followed step by step:
onced ssh'ed, no "tomcat" dir, I used cd $OPENSHIFT_DATA_DIR instead to access data dir
wget tomcat, changed ports to >15000, sh startup.sh && tail -f ../logs/*
notable errors in the result include:
SEVERE: Failed to initialize connector [Connector[AJP/1.3-15009]]
org.apache.catalina.LifecycleException: Failed to initialize component
[Connector[AJP/1.3-15009]] SEVERE: Failed to initialize connector
[Connector[AJP/1.3-15009]] org.apache.catalina.LifecycleException:
Failed to initialize component [Connector[AJP/1.3-15009]] SEVERE:
Failed to initialize end point associated with ProtocolHandler
["ajp-bio-15009"] java.net.BindException: Permission denied
:15009 SEVERE: Failed to initialize end point associated with
ProtocolHandler ["ajp-bio-15009"] java.net.BindException: Permission
denied :15009
11. restarted step 6, this time left IP's as they were, changing only localhost to tomcat-stevenwernercs.rhcloud.com, same result but with original IP's
12. ran out of options online, then I posed this question...
13. then I edited it a lot...
14. patiently wait :)
That is everything I have done, I am not sure why php isnt finding Java.
I looked at previous questions didn't find anything helpful.
Open to anything, thank you
Gears in a non-scable application are not allowed to communicate on any non http/ws port. So if your php java bridge is trying to communicate with the tomcat instance on 15009 (from what i see above) that is not going to work. You could only make requests on 80/443/8000/8443. Can you verify what port the java bridge works over?
Alternate solution: https://bitnami.com/cloud
I got it working using Bitnami with Amazon AWS, it provides free service for 1 year, documentation that is easy to follow, and plentiful and up to date, It took less than an hour.
Disclaimer: Using ssh tunnel for port 8080 i configured tomcat as if on localhost, and moved my hosted .php to the
same microserver that also hosted the tomcat. (I gave up on trying to host php and tomcat separately.)
I have hosted tomcat separately before on my university's tomcat server. But that was a node I had full access to.
I would still like to try Openshifts free solution, although the current resources and methods I've seen seem to no longer be valid. And unfortunately the workarounds are not intuitive enough and are currently over my head. Thank you.

Glassfish + mod_proxy_ajp downloads getting truncated

I've just upgraded to Glassfish 3.1.2 and I'm having problems with file downloads getting truncated:
Glassfish has a jk-listener configured and I'm running it behind Apache with mod_proxy_ajp.
ProxyPass / ajp://www.mydomain.com:8009/
ProxyPassReverse / ajp://www.mydomain.com:8009/
My app generates a zip file on-the-fly and this file is now getting truncated to 256Kb when I download via the ajp proxy. However if I bypass Apache and use the Glassfish http port directly the download completes fully (around 700Kb).
I'm seeing these errors in the Apache logs:
ajp_check_msg_header() got bad signature 2c69
ajp_ilink_receive() received bad header
ajp_read_header: ajp_ilink_receive failed
(120007)APR does not understand this error code: proxy: dialog to xxx.xxx.xxx.xxx:8009 (www.mydomain.com) failed
Any ideas what's going on here?
In our setup with Apache and mod_jk, after upgrading from GlassFish 3.0.1 to 3.1.2, I had to disable chunking in the HTTP tab of the JK network listener.
See this: http://java.net/jira/browse/GLASSFISH-18446

Unable to deploy in Netbeans 6.7.1 and Glassfish v2.1.1

I am trying to deploy a simple WebService in Netbeans 6.7.1 and Glassfish v2.1.1 and am getting the following error. I am using GlassfishESBv2.2 and windows 7 machine. I have tried googling and implemented things as shown in
http://forums.netbeans.org/topic10055-0-asc-0.html . Still unable to deploy. Though the message says that application server is not started, from the Server tab , I am able to see a message which indicates Glassfish has started.Also , doing a netstat after trying to deploy returns this, which means that Glassfish is running.
C:>netstat -an | findstr "4848"
TCP 0.0.0.0:4848 0.0.0.0:0 LISTENING
I have been trying real hard to get this resolved. Any help is highly appreciated.
Error Message :
The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
- IDE timeout: refresh the server node to see if it's running now.
- Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
- Incorrect server configuration (domain.xml to be corrected manually)
- Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
- Invalid installation location.
C:\Users\xyz\Documents\NetBeansProjects\HWebService\nbproject\build-impl.xml:564: Deployment error:
The Sun Java System Application Server could not start.
More information about the cause is in the Server log file.
Possible reasons include:
- IDE timeout: refresh the server node to see if it's running now.
- Port conflicts. (use netstat -a to detect possible port numbers already used by the operating system.)
- Incorrect server configuration (domain.xml to be corrected manually)
- Corrupted Deployed Applications preventing the server to start.(This can be seen in the server.log file. In this case, domain.xml needs to be modified).
- Invalid installation location.
See the server log for details.
BUILD FAILED (total time: 29 seconds)
I've described the solution please visit here...
http://forums.netbeans.org/post-65058.html

Categories