miercuri, 21 mai 2014

How to install Apache FOP and print PDF, CSV from Oracle APEX

First, you have to install the JDK. Download the <version>-linux-x64.bin file from oracle.com and just install it, by providing the above command:

./<version>-linux-x64.bin

It will install in usr/java. Just keep in mind the location and proceed further.

Download the oc4j software from here:

http://www.oracle.com/technetwork/middleware/ias/downloads/utilsoft-090603.html

And unzip it somewhere on the server, of course, keeping in mind the location.

Now make two files:

(Every step you'll make from now, pay attention at the custom parts of your commands, paths, etc.)

vi envoc.sh

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/oc4j
export OC4J_HOME=$ORACLE_HOME
export JAVA_HOME=$ORACLE_BASE/jdk1.6.0_45
export J2EE_HOME=$ORACLE_HOME/j2ee/home
export PATH=$JAVA_HOME/bin:$PATH:/opt/oracle/oc4j/bin


vi startoc4j.sh

. envoc.sh

java -jar /u01/app/oracle/oc4j/j2ee/home/oc4j.jar

Run the startoc4j.sh.
Now the instance will start for the first time and will prompt you for the admin password. 

Next step, installing the war file:

go to    http://localhost:8888/em/

>> applications tab

>> deploy button

>> Select archive 

then

>> Archive is already present on the server where Application Server Control is running.
and provide the path to the fop.war file, on the server

>>next

Clear the <context root> field and click next, then click deploy.

Now you have to make some settings in APEX.
Go to

localhost:8080/apex/apex_admin

>>manage instance >> instance settings >> report printing
print server = standard
print server protocol could be even https if you like
print server host address = localhost
print server port = 8888
print server script = /fop/apex_fop.jsp

Now everything is fine, except the network services in database:

BEGIN

DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'www.xml',


description => 'APEX FOP',


principal => 'APEX_030200'


is_grant => true,


privilege => 'connect');



DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'www.xml',


principal => 'APEX_030200',


is_grant => true,


privilege => 'resolve');



DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'www.xml',


host => 'localhost');


END;


/
COMMIT;

Just pay attention at the custom part of this script above, the name of the apex user.

vineri, 9 mai 2014

ORA-1017: invalid username/password; logon denied - coming from an oracle application form (IAS)

Almost sure the problem is inside of the database.
Just follow this:


sqlplus / as sysdba
alter system set sec_case_sensitive_logon=false scope=both;
exit
orapwd file=/opt/oracle/db/dbs/orapw$ORACLE_SID password=pass ignorecase=y

If the problem will persist, let me know!

luni, 5 mai 2014

Oracle APEX: "The requested URL /apex/f was not found on this server" or "A username and password are being requested by http://hostname:8080/apex. Site says: XDB"

You will find tons of advices about unlocking two users: ANONYMOUS and XDB.
In fact, the problem, is buggy.
I will enumerate some posbile recipes, but i warn you, the list will never be complete, probably.
I studied some time this problem and, for me, seems to be more like a bug. In order to get rid of any headache, better install OHS and just use it without any trouble. If not, read above:

First, let's make sure the listener is listening:

sqlplus / as sysdba
EXEC DBMS_XDB.SETHTTPPORT(8080)

Further, will consider the problem is not solved.
Virtually, one or more of the users that concern the apex instance (apex_0xxxxx, apex_public_user, anonymous, XDB) is expired or locked.
So, run, one by one (you can't in a row, i know you're tempted):

alter user xxxx identified by xxxx account unlock;

After these 4 commands, it can be possible the message be still there. From my experience, once i had to make the passwords exactly like the usernames. And after this, the message has gone.

Well, let's assume the problem is still there.

Change the level of debug for the embedded plsql gateway:

exec dbms_epg.set_global_attribute('log-level',7);

If you are lucky, will find the error in one of the tracking files from the  BACKGROUND_DUMP_DEST.
Once, i have found one of the above users, i don't remember which one was experiencing a lack of grants on tablespace sysaux. I don't know what can be useful in having rights on that tablespace, but truth is, the .trc file was complaining about this. After the proper corection (grant tablespace etc.), the problem was solved.

Another time, the problem was this:

lsnrctl status
somewhere, in the response, i noticed:
 (Description= (Address=(Protocol=tcp)(Host=127.0.0.1)(Port=8080))Presentation=HTTP)(Session=Raw))

That  127.0.0.1 part is not good, because you cannot connect remotely, in this case, hust locally, on the server.
This problem will disappear after

sqlplus / as sysdba
EXEC DBMS_XDB.SETHTTPPORT(8080) ;

and, if the 127.0.0.1 is still there, bounce the listener.


Sometime, you forgot to:


@apex_epg_config.sql /u01/app/oracle/product/11.2.0.3/db

If you are in a hurry, and i know how it is, under critical circumstances, use a temporary workaround:

EXEC DBMS_XDB.SETHTTPPORT(8081) ;

Changing the port is the most easy, fast, and posible to succeed operation.


Could work and you can save your job for a day or two :)