What’s internal resource views?

In Spring MVC or any web application, for good practice, it’s always recommended to put the entire views or JSP files under “WEB-INF” folder, to protect it from direct access via manual entered URL. Those views under “WEB-INF” folder are named as internal resource views, as it’s only accessible by the servlet or Spring’s controllers class. In Spring MVC, InternalResourceViewResolver is used to resolve “internal resource view” (in simple, it’s final output, jsp or htmp page) based on a predefined URL pattern. In additional, it allow you to add some predefined prefix or suffix to the view name (prefix + view name + suffix), and generate the final view page URL.

ADMR0104E- Unable to read document

ไม่สามารถ start Dmgr ได้เพราะมีการเปลี่ยนจาก root ที่ start เป็น user อื่น

ปัญหาที่เจอในระบบงานเพราะมีบาง directory ที่อ้างอิงยังเป็น root อยู่
เช่น 1. /appserver/config/temp
       2. /appserver/logs/ffdc

วิธีแก้ คือเปลี่ยน ภายใต้ directory นั้น ให้เป็นของ user ก็พอ (chown)


While we were trying to deploy an application on WAS 6.0.2.19 .. we had the following errors:
0000002e FileDocument  E   ADMR0104E: The system is unable to read document cells/server/nodes/nodename/perftuners.xml: java.io.IOException: The file access permissions do not allow the specified action.
0000002e WorkSpaceMast E   Unable to create temp file for document: cells/server/nodes/nodename/perftuners.xml
0000002e ServerRuleDri E  perfalert.Exception.errorjava.security.PrivilegedActionException: com.ibm.ws.sm.workspace.WorkSpaceException: WKSP0012E Exception when while extracting cells/server/nodes/nodename/perftuners.xml from Config Repository–com.ibm.websphere.management.exception.DocumentIOException: Unable to create temp file for document: cells/CU01-tx8aiuci00230/nodes/NU01-tx8aiuci00230/perftuners.xml
[7/14/09 13:40:47:586 CDT] 0000002e ServerRuleDri E   perfalert.Exception.error
We figured out the error is mainly beacuse of the permissions issue.
Some files are owned by root user which is preventing the was user to write the files to tmp directory which are created while deploying the application .


Work Around:
1. check who owns:  /appserver/config/temp
2. check who owns: /appserver/logs/ffdc
3. If possible try to chown everything under /Appserver and  /DMGR to wasuser. If any files are not owned by wasuser they will be displayed.



Ref: 1 , 2 , 3

Websphere interview questions

Oracle Sql Developer through a socks firewall

1. Go to directory sqldeveloper\ide\bin
2. Backup file ide.conf by copying ide.conf to ide.conf.backup
3. Add the following to the ide.conf

AddVMOption -DsocksProxyHost= [host]
AddVMOption -DsocksProxyPort= [port]

ex.

AddVMOption -DsocksProxyHost=127.0.0.1
AddVMOption -DsocksProxyPort=1080

Get current directory in batch file

used %cd% 


example

@echo off
set current=%cd%
pushd ..
set parent=%cd%
popd

echo current %current%
echo parent %parent%

Java : Setting Locale System Properties

System PropertyDescription
user.language
Two-letter language name code based on ISO 639.
user.region
Two-letter region name code based on ISO 3166.
file.encoding
Default character-encoding name based on the IANA Charset MIB.


ex.
-Duser.country=US -Duser.language=en

Ref: 1.

ดู locale ได้จาก Ref

If you have ever tried to open an excel document and received the error that says "There was a problem sending the command to the program", you can fix it by doing the following:


  • Open Excel 2007
  • Open the Menu in the top left
  • Click the "Excel Options" button 
  • Click the advanced tab on the left of the options screen
  • Under the general options uncheck the box "Ignore other application that use Dynamic Data Exchange (DDE)"   

Webservice client ignore SSL certificate errors


If you are dealing with a web service call using the Axis framework, there is a much simpler answer. If all want is for your client to be able to call the SSL web service and ignore SSL certificate errors, just put this statement before you invoke any web services:
System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
The usual disclaimers about this being a Very Bad Thing to do in a production environment apply.
I found this at the Axis wiki.

Recursively change ownership of directories


Change the owner of /foo and subfiles to "root", run:
# chown -R root /foo
Where,
  • -R - Recursively change ownership of directories and their contents.
Maximum number of default process is 150.when that abouve error is happened..we can increase our max number of process by

SQL> show parameter processes

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
processes                            integer     150

SQL> select count(*) from v$process;

  COUNT(*)
----------
       149

SQL> alter system set processes=300 scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

SQL> show parameter processes

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
processes                            integer     300




ORA-00020: maximum number of processes (%s) exceeded
Ever received this error message in your alert log? I have on a couple of occasions. Perhaps an application server started spawning more database connections than it normally does in turn creating more processes on the database. The Oracle description of this error is:
Error: ORA 20 Text: maximum number of processes exceeded  
Cause: An operation requested a resource that was unavailable. The maximum number of processes is specified by the initialization parameter PROCESSES. When this maximum is reached, no more requests are processed. Action: Try the operation again in a few minutes. If this message occurs often, shut down Oracle, increase the PROCESSES parameter in the initialization parameter file, and restart Oracle.

But what if you cannot connect to your database to shut it down and increase the parameter?

oradba01t[labdb01]-/home/oracle/>sqlplus  /as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Jun 6 11:25:05 2011
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
ERROR:
ORA-00020: maximum number of processes (%s) exceeded

I always like to look at the alert log to check for any additional details.


How do I connect to the database to increase my processes parameter? Well I remember Tanel Poder blogged about "How to log on even when SYSDBA can't do so?"

oradba01t[labdb01]-/home/oracle/>sqlplus -prelim "/as sysdba"

SQL*Plus: Release 11.1.0.7.0 - Production on Mon Jun 6 11:29:54 2011

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

SQL>

I was able to log on to the instance without getting the error message. Now to see if I can shut it down and start it up to increase the parameter.

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0

It appears that the shutdown abort was successful but the mount command did not complete. Disconnect from the previously connected session and logon normally to start the instance.

How do I connect to the database to increase my processes parameter? Well I remember Tanel Poder blogged about "How to log on even when SYSDBA can't do so?"

oradba01t[labdb01]-/home/oracle/>sqlplus -prelim "/as sysdba"

SQL*Plus: Release 11.1.0.7.0 - Production on Mon Jun 6 11:29:54 2011

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

SQL>

I was able to log on to the instance without getting the error message. Now to see if I can shut it down and start it up to increase the parameter.

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0

It appears that the shutdown abort was successful but the mount command did not complete. Disconnect from the previously connected session and logon normally to start the instance.



setting CPAN for proxy


This is easily firewall/proxy issues. You need to set up http_proxy variable in cpan. Enter the cpan shell by typing cpan at the shell command prompt, and hitting enter. Once in the cpan shell, enter the following:
o conf http_proxy http://:/
cpan may then ask you for the username and password so that you can use the proxy for http traffic, at least.
It's possible that your ftp access is blocked by the firewall. cpan will work around this.
  • You can look to your browser if the proxy configuration is simple.
  • If it is more complex, you'll have to
    • paste the URL to the config script in the browser address
    • open that URL with an editor when the browser prompts you (or use an editor like jEdit that takes http URLs).
Once you parse the case for your location and CPAN, then you can take the server name returned, a the port if any, and either set the environment variable or cpan configuration with the value.

or

C:\ set http_proxy=http://:/C:\ set ftp_proxy=http://:/C:\ cpan 

Configure Proxy On Windows


With Windows 2000/XP

  • Right Click "My Computer", and click Properties
  • Choose the Advanced Tab and click the Environment Variables button at the bottom middle of the window
  • Click the "New" button in the Global Variables section
  • Set the Variable Name to http_proxy
  • Set the Variable Value to http://example.com: 8080
  • If a proxy login is required set the Variable Value tohttp://username:password@example.com: 8080
  • Click OK
  • Click OK

With Windows 95/98/ME


Command line

  • set HTTP_PROXY=http://:
top