Friday, December 5, 2008

Configure JBoss for Oracle

  1. Oracle and JBoss use the same port by default, 8080. If you are using Oracle and JBoss on the same server, modify the http port for Oracle to something other than 8080 (i.e, 8081). Skip this step if you are running Oracle on a different server.
  2. Login to Oracle using SQLPLUS as the SYSTEM user and enter the following script command:


    BEGIN
    dbms_xdb.sethttpport(’8081′);
    END;
    /

    Locate the online_help file in the Oracle \server folder, right click, select properties, and modify the url to:

    http://127.0.0.1:8081/apex/wwv_flow_help.show_help?p_flow_id=4500&p_step_id=1000

    Locate the postDBCreation file in the Oracle server\config\log folder, open it and modify the following line:

    URL=http://127.0.0.1:8081/htmldb/wwv_flow_help.show_help

  3. JBoss needs to know where the Oracle jdbc driver classes are located. This can be done by either, copying the Oracle jdbc archive file to the server default lib folder. Search and locate the ojdbc14.jar file in the Oracle \jdbc\lib folder. Copy the ojdbc14.ja file to the JBoss \server\default\lib folder.
  4. Define a datasource in JBOSS to access a specific Oracle database instance. Copy the /docs/examples/jca/oracle-ds.xml file from the jboss directory to the /server/default/deploy folder in JBoss. Open a text editor (e.g., WordPad or xCode) and modify the file as follows.






  5. OracleDS
    jdbc:oracle:thin:@localhost:1521:xe
    oracle.jdbc.driver.OracleDriver
    homedirectbank
    bank

    Oracle9i



  6. Modify the standardjbosscmp-jdbc.xml configuration file in the JBoss /server/default/conf folder. Add the following and sub-tags to the tag. These tags map the datasource, OracleDS, to the data mapping, Oracle9i, defined further down in this file. The data mapping tag defines how the specific Oracle database types map to the corresponding Java data types.







  7. java:/OracleDS




Configure JBoss for Oracle

  1. Oracle and JBoss use the same port by default, 8080. If you are using Oracle and JBoss on the same server, modify the http port for Oracle to something other than 8080 (i.e, 8081). Skip this step if you are running Oracle on a different server.
  2. Login to Oracle using SQLPLUS as the SYSTEM user and enter the following script command:


    BEGIN
    dbms_xdb.sethttpport(’8081′);
    END;
    /

    Locate the online_help file in the Oracle \server folder, right click, select properties, and modify the url to:

    http://127.0.0.1:8081/apex/wwv_flow_help.show_help?p_flow_id=4500&p_step_id=1000

    Locate the postDBCreation file in the Oracle server\config\log folder, open it and modify the following line:

    URL=http://127.0.0.1:8081/htmldb/wwv_flow_help.show_help

  3. JBoss needs to know where the Oracle jdbc driver classes are located. This can be done by either, copying the Oracle jdbc archive file to the server default lib folder. Search and locate the ojdbc14.jar file in the Oracle \jdbc\lib folder. Copy the ojdbc14.ja file to the JBoss \server\default\lib folder.
  4. Define a datasource in JBOSS to access a specific Oracle database instance. Copy the /docs/examples/jca/oracle-ds.xml file from the jboss directory to the /server/default/deploy folder in JBoss. Open a text editor (e.g., WordPad or xCode) and modify the file as follows.






  5. OracleDS
    jdbc:oracle:thin:@localhost:1521:xe
    oracle.jdbc.driver.OracleDriver
    homedirectbank
    bank

    Oracle9i



  6. Modify the standardjbosscmp-jdbc.xml configuration file in the JBoss /server/default/conf folder. Add the following and sub-tags to the tag. These tags map the datasource, OracleDS, to the data mapping, Oracle9i, defined further down in this file. The data mapping tag defines how the specific Oracle database types map to the corresponding Java data types.







  7. java:/OracleDS




Tuesday, November 18, 2008

Trouble opening java applications in Leopard

I was having trouble executing applications that were developed in java the other day. Here goes a snippet of the error I was getting:

com.apple.launchd[191] ([0x0-0x1fdefdd].????[36322]) posix_spawnp("/Applications/.../Contents/MacOS/JavaApplicationStub", ...): Permission denied

You can easily fix the problem by giving Read, Write and Execute permissions to the user to the JavaApplicationStub executable file.
You do so by running the following command: chmod 777 /[your application path].app/Contents/MacOS/JavaApplicationStub .

Hope that helps.

Thursday, November 6, 2008

Installing code repository subversion (SVN) on Linux Ubuntu

To install subversion, open a terminal and run the following command:

sudo apt-get install subversion libapache2-svn

We're going to create the subversion repository in /svn, although you should choose a location that has a good amount of space.

sudo svnadmin create /home/svn

Next we'll need to edit the configuration file for the subversion webdav module. You can use a different editor if you'd like.

sudo vim /etc/apache2/mods-enabled/dav_svn.conf

The Location element in the configuration file dictates the root directory where subversion will be accessible from, for instance: http://www.server.com/svn

(Don't forget to uncomment the Location closing tag at the end of the document)

The DAV line needs to be uncommented to enable the dav module

#Uncomment this to enable the repository
DAV svn

The SVNPath line should be set to the same place your created the repository with the svnadmin command.

#Set this to the path to your repository
SVNPath /home/svn

The next section will let you turn on authentication. This is just basic authentication, so don't consider it extremely secure. The password file will be located where the AuthUserFile setting sets it to

#Uncomment the following 3 lines to enable Basic Authentication
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd

To create a user on the repository use, the following command:

sudo htpasswd -cm /etc/apache2/dav_svn.passwd

Note that you should only use the -c option the FIRST time that you create a user. After that you will only want to use the -m option, which specifies MD5 encryption of the password, but doesn't recreate the file.

Restart apache by running the following command:

sudo /etc/init.d/apache2 restart

Now if you go in your browser to http://www.server.com/svn, you should see that the repository is enabled for anonymous read access, but commit access will require a username.

If you want to force all users to authenticate even for read access, add the following line right below the AuthUserFile line from above. Restart apache after changing this line.

Require valid-user

Now if you refresh your browser, you'll be prompted for your credentials.

Credit goes to Jason Meridith (http://www.lostechies.com/blogs/jason_meridth/)

How to update Ubuntu Server from command line

  1. First you need to update /etc/apt/sources.list. Just open it up with your favorite editor
    sudo vi /etc/apt/sources.list
  2. Since I was using 5.10, at the end of all the URL’s it should say ‘breezy’. You need to change all of these to ‘edgy’. Write the file out and quit.
  3. Next, we need to update the source list by using the following command
    sudo apt-get update
  4. To upgrade to the new distro, just enter dist-upgrade!
    sudo apt-get dist-upgrade
  5. It will ask you if you want to update all of these packages, just say yes. Also, I had a few times that I had to hit ‘OK’ to confirm some postfix stuff. Since im not running any mail services, I dont need to set this up. Just keep an eye on the update since these messages delay the update.
  6. You may have to force some installs/updates. If so (I had to do this), just enter
    sudo apt-get -f install
  7. Once the upgrade is complete (it took mine forever since I was also downloading a trial game AND cygwin), restart your machine
    sudo shutdown -r now
  8. Done!
Credits go to Jon (http://crazytrain.wordpress.com/)

Wednesday, September 3, 2008

How to determine which applications are listening on which ports

If you want to find out which ports your applications are listening upon you cand easily do so by using two different commands. The following assumes you are in a Windows environment. If you find out the commands for other platforms I would appreciate if you included them as a comment.

netstat -ano ---------> This will give you the list of all ports that are being used by all your processes and will also give you the PID for that process along with some other information
tasklist /SVC ---------> This will give you a list with the names of the processes your computer is running along with their corresponding PID

The command for linux is:
sudo lsof -i [TCP]:[8080]
(don't forget to leave the brakets out and put your own parameters)
As you can see this will give you a list of all processes that are listening on port 8080 through the TCP protocol.