using old port after chaging domain.xml - netbeans

I am using Glassfish V3 which comes with netbeans only , as there are few servers running on my pc , i have changed the port from 8080 to 8787 of glassfish v3 by altering domain.xml
<http-listener id="http-listener-1" port="8787" address="0.0.0.0" default-virtual-server="server" server-name="" />
<http-listener id="http-listener-2" port="8181" enabled="false" address="0.0.0.0" security-enabled="true" default-virtual-server="server" server-name="">
Now when i deploy the restful webservies over server or click on Test Restful Webservice in netbeans
i am getting a page in a browser which still uses the old port and even there is not webservice option get displayed on it the page is blank. here is the screen shot
note: i tried restarting it may times but still using the old port

In your Netbeans project node there must be a sub node like "Generated sources (rest-test)" or similar (I don't have Netbeans in english).
If you expand this node, there must be a file named test-resbeans.html. Open this file and check the following entry:
var baseURL = "http://localhost:8080/MyFirstWebService/||/resources";
The term MyFirstWebservice needs to be replaced by your services's name.
Change the port there if necessary.

There was an open issue for something similar. I fixed it a while back, but the change will be in NB 7.0. I do not think anybody will backport the change into 6.7... but you never know.

Related

How can I access to my app with WildFly

I'm having a very painful time with WildFly.
I successfully deployed my war and the log said
WFLYUT0021: Registered web context: /myapp
And I can't access the app with 404.
http://192.168.56.101:8080/myapp/index.html
What did I do wrong?
Are you sure, you have an index.html at the right place in your war-file? You must probably post more information on your file structure, web.xml, etc.
Another stumbling block could be in standalone.xml (config file of wildfly): To which IP is the application server bound? 127.0.0.1? Or 0.0.0.0?
Try accessing the app with http://localhost:8080/... (on the machine you deployed it). If this works, you need to change your standalone.xml file (replace all '127.0.0.1' occurrences with '0.0.0.0' is the easiest way)
Hope this helps. Otherwise, try to be more specific.

Mamp Pro 4 HTTP and HTTPS

Is it not possible in Mamp Pro 4 to have both http and https? The application I am working on requires both depending on the page.
I must be missing something as it makes no sense when I enable SSL only https works and http then stops working.
I tried going through the http.conf, but really have no idea whats causing this.
I think it just generates the vhost for https only and then removes http. Doesn't even look like you can manually edit it.
Any suggestion would be great.
Well to update my own post and if anyone else has this problem.
The software is currently not capable of this on the same hostname.
According to Mamp support you have to create two hosts with the same name (e.g. sample.app and sample.app.).
Enable one of the "sample.app" hostnames to use SSL
Enable the second host entry "sample.app" to not use SSL. (Don't forget to hold Alt or Option when clicking on +)
Point both to the same directory.
Mamp will highlight this in red, as its warning that you have two of the same hostnames.
So currently this is the only solution I am aware of for this issue.
Hope they resolve this in future updates as a lot of applications, especially ecommerce rely on the ability to switch between http and https.
You can see this on the Mamp Pro documentation here.
I got a simple solution by edit template:
Open Mamp Pro
File > Edit Template > Apache > httpd-ssl.conf
Add these line after
<VirtualHost *:80>
ServerName MAMP_SSLVirtualHost_ServerName_MAMP
MAMP_SSLVirtualHost_ServerAdmin_MAMP
MAMP_SSLVirtualHost_DirectoryIndex_MAMP
DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP
</VirtualHost>
Mamp Pro 5 in 2020 Update
To tag onto MrDuy's great response, as the Alt Click on the + doesn't seem to work in V5, editing the httpd-ssl.conf template seems to be the way to go.
However MrDuy's answer assumes you're using port 80 for HTTP inside MAMP, which is not the default 8888. Additionally, and I can't speak for MAMP PRO 4 users, the snippet needs to be placed before the MAMP_SSLVirtualHost_iteration_end_MAMP line at the bottom of the file, as obviously this is the end marker that MAMP uses to conduct its iteration of the hosts in the GUI.
TLDR;
Follow the first two steps in MrDuy's answer:
Open MAMP Pro
File > Edit Template > Apache > httpd-ssl.conf
Then, at the bottom of the file, locate the line with MAMP_SSLVirtualHost_iteration_end_MAMP Before this line, paste the following:
<VirtualHost *:8888>
ServerName MAMP_SSLVirtualHost_ServerName_MAMP
MAMP_SSLVirtualHost_ServerAdmin_MAMP
MAMP_SSLVirtualHost_DirectoryIndex_MAMP
DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP
</VirtualHost>
It would've been niced to use the placeholder markers MAMP uses in it's non SSL config file (MAMP_VirtualHost_IP_MAMP, MAMP_VirtualHost_Port_MAMP etc) but obviously these aren't passed in the file. Which means that if you decide to change the HTTP port, you must also manually update this file.
#MAMP, can't we make this a default? :`(
Cheers!

414 URI too long with Apache Tomcat Eclipse

I have a long uri when i launch my query.
I use apache tomcat 7.0.42 as server. I know my request is long but i want to increase the uri's length limit to do my requests. Because i always have a
414 error : request too long.
How can i do that ?
I've already tried with maxHttpHeader in server.xml but there was no effects. It appears that : when i restart my server with eclispe, the 'maxHttpHeader' disappears ... why ?
<Connector URIEncoding="UTF-8" maxHttpHeaderSize="65536" connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
Is any files to configure or to modify to handle this error ? I really need to.
My request is to fill a dataTable.
Thank's in advanced.
i just pass my request in POST. Now it works !
when i restart my server with eclispe, the 'maxHttpHeader' disappears
Using eclipse WTP your tomcat's server config is not (only) stored in the conf folder of the tomcat installation.
Go to the Servers view and double-click on your server, under General Information you will find a Configuration path field that points to the configuration directory. Usually this is a folder in a separate eclipse project (called Servers).
After editing the server.xml there you can synchronize your server (in the Servers view) and the changes should not vanish anymore.
Edit: As for maxHttpHeader: just saw you are defining the maxHttpHeader setting for your 8080 connector and using a redirect to 8443. The setting will not take effect for https connections. Try adding the same setting to your 8443connector.

Weblogic 12.2.1 upgrade domain reconfigure.sh.

I need to upgrade a weblogic domain to 12.2.1 from 12.1.3. I tried to use the reconfigure.sh weblogic utility. While using that utility, i am getting the below exception. The old domain is from weblogic 12.1.3. Any clues?
Exception in thread "Thread-4" java.lang.IllegalArgumentException: Invalid host:port
at com.oracle.cie.domain.jdbc.AddressList$HostPort.<init>(AddressList.java:133)
at com.oracle.cie.domain.jdbc.AddressList.setList(AddressList.java:78)
at com.oracle.cie.domain.jdbc.GridLinkRacHandler.createOnsHost(G
I had the same error. In my case it was cause about the custom DataSource configured in the domain, specifically with a data source configured as GridLink without ONS configuration.
As I resolved was, first I made a backup of config.xml file, then I removed all the custom datasource references, like this:
<jdbc-system-resource>
<name>mds-soa</name>
<target>soa_cluster,AdminServer</target>
<descriptor-file-name>jdbc/mds-soa-jdbc.xml</descriptor-file-name>
</jdbc-system-resource>
<!--jdbc-system-resource>
<name>OrchDS</name>
<target>jms_cluster</target>
<descriptor-file-name>jdbc/OrchDS-1529-jdbc.xml</descriptor-file-name>
</jdbc-system-resource-->
Be careful, when you reconfigure the domain, all the comments in the config.ml file was removed.
Then start the wizard for reconfig the domain until setup progress windows, just to make sure you pass all the validations and then exit.
Add one by one until found the descriptor file who has the error.
I hope this help you.

How to run multiple instances of JBoss in a one single machine?

I need to run multiple(more than 4) instances of JBoss server on a single machine.
I am using JBoss 4.2.3 GA.
I found the answer. We have to configure the jboss-service.xml to run multiple instances in the same machine.
We may need to keep the same "default" instance same as it is under the JBOSS_HOME\Server.
We have to create another folder say "instance2" under JBOSS_HOME\Server.
Copy all the contents from JBOSS_HOME\Server\default to this newly created folder.
Now goto conf folder under JBOSS_HOME\Server\instance2 directory.
Edit the jboss-service.xml.
Search for mbean code="org.jboss.services.binding.ServiceBindingManager" in this configuration file.
By default this xml tag is commented. We have to un comment it and change the value ports-00 to ports-01.
Then start this instance2 jboss instance. We can access this application by using the port number 8180.
We can go for at maximum of 3 instances with this way.
To run more than this we have to add some more running tags in
JBOSS_HOME\docs\examples\binding-manager\sample-bindings.xml.
You can make things a lot simpler by simply changing the IP that the server is bound to.
You will need to copy the entire jboss folder several times and configure run.bat to use the -b parameter on startup.
If this is a Windows server and you're running jboss as a service, you might want to edit the service.bat for each instance too so that the servers all have different names in the services control panel.
Part of the problem we ran into when trying to use different HTTP ports was that jboss uses 'lots' of ports for different purposes and it was a pain to edit all of these port numbers to be unique on each instance. By changing the bind address you can avoid this problem entirely.
Create multiple loopback adapters and bind each ip address to different instance.
No need of changing port.
RK
1) Copy the default folder with new name: instance name
2) In jboss-service.xml Uncomment the ServiceBindingManager mbean and change the ServerName to ports-01 or 02 or 03 e.g:ports-01 and ports-01/02/03 configuration should be there in sample-bindings.xml(present in docs/examples/binding-manager) And make the changes in all the ports mentioned under ports-01/02/03 tags, So that ports will not get conflict. Remember the server will run on the binding port like 8080/8180/8182.
from cmd promt go to the bin folder and run the instances with cmd:
run -c instancename
Running multiple instances of JBoss on the same server:
We should keep the "default" instance same as it is under the **JBOSS_HOME\Server
Copy the default folder with new name (instance name) say default2 under JBOSS_HOME\Server. Copy all the contents from JBOSS_HOME\Server\default to this newly created folder.
The binding service manager needs to be enabled in conf/jboss-service.xml for instances that are not using the default ports.
a. (i.e.) In the copied instance, go to conf folder under JBOSS_HOME\Server\default2 directory. Edit the jboss-service.xml.
b. Search for mbean code="org.jboss.services.binding.ServiceBindingManager" in this configuration file.
c. By default this xml tag is commented. We have to uncomment it and change the value ports-00 to ports-01.
In the same file, Under "Socket transport Connector", in the "Configuration" section, serverBindPort must be changed to another value or it will conflict with the default (4446).
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.remoting:service=Connector,transport=socket"
display-name="Socket transport Connector">
...
<attribute name="Configuration">
...
<attribute name="serverBindPort">25447</attribute>
...
In default2/deploy/ejb3.deployer/META-INF/jboss-service.xml, for the remoting.transport.Connector mbean, port 3873 must be changed to another value or it will conflict with the default.
<mbean code="org.jboss.remoting.transport.Connector"
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
<depends>jboss.aop:service=AspectDeployer</depends>
<attribute name="InvokerLocator">socket://${jboss.bind.address}:25874</attribute>
...
In default2\deploy\jboss-web.deployer\server.xml
set redirect port value to the one configured in step 4
<Connector port="8180" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="25447" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Also, the port value configured in step 5
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="25010" address="${jboss.bind.address}" protocol="AJP/1.3" //change the connector port value to avoid conflict
emptySessionPath="true" enableLookups="false" redirectPort="25874" /> // port value configured in step 5
In summary, the directory structure for setting up two other instances would be something
like the below with modifications in the filenames in bold.
$JBOSS_HOME/server/default
$JBOSS_HOME/server/default2
$JBOSS_HOME/server/default2/conf/jboss-service.xml
$JBOSS_HOME/server/default2/deploy/ejb3.deployer/META-INF/jboss-service.xml
$JBOSS_HOME/server/default2/deploy/jboss-web.deployer/server.xml**
$JBOSS_HOME/server/default3
$JBOSS_HOME/server/default3/conf/jboss-service.xml
$JBOSS_HOME/server/default3/deploy/ejb3.deployer/META-INF/jboss-service.xml
$JBOSS_HOME/server/default3/deploy/jboss-web.deployer/server.xml**
7.From command prompt go to the bin folder and run the instances with cmd:
run -c instancename
In this case, it is: run -c default2
And applications accessed with url’s like:
http://localhost:8080/myapp/
http://localhost:8180/myapp/
http://localhost:8280/myapp/
Note: We can go for maximum of 3 instances with this way.
To run more than this we have to add some more running tags in JBOSS_HOME\docs\examples\binding-manager\sample-bindings.xml.
I used this article to install mine.
http://wiki.adempiere.net/Setup_2_Adempiere_JBoss_server_in_1_physical_server
You should create different services to control the adempiere servers.
Also if you work with jasper report, use unique file names for reports or you will face permission denied exception.
Ex : if you attach "report.jrxml" to two servers. Server will create /tmp/report.jrxml tmp file.
The second server will also try to create the same file and get crashed
Copy complete JBOSS setup to new location, and start new server with offset option, which will start server on existing ip and changing port to previously_configured_port+offset
standalone.bat -c standalone-full.xml -Djboss.socket.binding.port-offset=100
This command will make default jboss console 9990 to 10090
Now you can add your war file in new deployments folder and start deployment on new port
The quickest and easiest way that comes into mind is simply configuring multiple IP addresses to the hosting machine. Then you can use the different IP addresses to bind to each instance. Doing this means you don't have to change any default ports and allows for an easier environment to manage.
We can easily do this on JBOSS EAP
For first instance, just start the JBOSS as it is.
for the second instance,
Copy the JBOSS home folder to a different location.
go to standalone/configuration/standalone.xml. go to the section(at bottom of the file) and set port-offset value to some value(EX: 10000) which doesn't have any port binding issue on currently running application. Here the default port-offeset value is 0.
start the second instance as usual .