Saturday, August 10, 2013

How to redirect in Glassfish server 3.x

 URL Redirection Within a Domain
You can use the url-prefix element of the redirect_ property to forward a URL to another URL in the same domain.
The following procedure shows how to enable visitors to a web site to type in and be redirected or forwarded to
1.    Log in to the Admin Console of Sun Java System Application Server or GlassFish.
2.    In the Admin Console, expand the Configurations node.
3.    Expand the server-config node.
Ignore this step if you are running a developer domain (a domain that does not have clustering capability).
4.    Expand HTTP Service.
5.    Expand Virtual Servers.
6.    Click server.
7.    On the Edit Virtual Server page, click the Add Property button.
8.    In the Name column, type redirect_1.
9.    If you are using Application Server 9.0, type from=/<context-root>/myproduct1 url-prefix=/mywarname/mypages/products/myproduct1.jsp in the Value column.
Note - The value of the <context-root> you provide here needs to match the value of the context root specified in the web.xml or application.xml file.
If you are using Application Server 9.1, type from=/myproduct1 url-prefix=/mywarname/mypages/products/myproduct1.jsp in the Value column.

My example was redirect from /test to

<property name="redirect_1" value="from=/test url-prefix="/>

Monday, May 6, 2013

couldn't add command channel address in use

Spent sometime around this error using chroot bind 9.x
couldn't add command channel address in use

 Guys, assuming your bind config is correct - this error is related to service "portserve" running and using this port!
ps -ef|grep portreserve|grep -v grep
root      1349     1  0 May06 ?        00:00:00 /sbin/portreserve

stop the service and disable from startup:

service portreserve stop
Stopping portreserve: [  OK  ]
[root@WNS3 etc]# chkconfig portreserve off

Friday, April 26, 2013

Installing Apex Listener 2.x

In this example i am installing Oracle Apex Listener 2.x and integrating into Glassfish 3.2.
 This article only covers installing listener  correctly so when you deploy it into Glassfish it works properly.

( in some of my attempts I kept getting java.lang.IllegalStateException: PWC3990: getWriter() has already been called for this response) errors.

Assuming you already have Oracle Apex installed.

1. as user oracle create directory apex_listener
2. cd apex_listener and download
3. unzip
## setup configdir -jar apex.war configdir /home/oracle/apex_listener
[host$ java -jar apex.war configdir /home/oracle/apex_listener
Apr 26, 2013 2:39:52 PM oracle.dbtools.common.config.cmds.ConfigDir execute
INFO: Set config.dir to /home/oracle/apex_listener in: /home/oracle/apex_listener/apex.war

## configure database connection properties -jar apex.war setup
Apr 26, 2013 2:40:28 PM oracle.dbtools.common.config.file.ConfigurationFolder logConfigFolder
INFO: Using configuration folder: /home/oracle/apex_listener/apex
Enter the name of the database server [localhost]:

Enter the database listen port [1521]:1521
Enter 1 to specify the database service name, or 2 to specify the database SID [1]:2
Enter the database SID [xe]:SID-NAME
Enter the database user name [APEX_PUBLIC_USER]:
Enter the database password for APEX_PUBLIC_USER:
Confirm password:
Enter 1 to enter passwords for the RESTful Services database users (APEX_LISTENER,APEX_REST_PUBLIC_USER), 2 to use the same password as used for APEX_PUBLIC_USER or, 3 to skip this step [1]:2
Apr 26, 2013 2:41:12 PM oracle.dbtools.common.config.file.ConfigurationFiles update
INFO: Updated configurations: defaults, apex, apex_al, apex_rt

6. Log in to Glassfish server and deploy newly created apex.war file

Once deployed you can access your Apex page via Glassfish.