Tuesday, November 30, 2004

Setting up java tomcat on linux III - Install JAVA

Install JAVA


  • mkdir /usr/local/java
  • cd /usr/local/src
  • sh j2sdk-1_4_2-linux-i586.bin
  • mv j2sdk1.4.2_06 /usr/local/java
  • cd /usr/local/java
  • ln -s j2sdk1.4.02-06 java

Now the java directory will be in /usr/local/java/java. I do it like this so I can keep all my different JDKs/JREs in one directory and then just change the symbolic link to point to the current one.

Install Tomcat

  • cd /usr/local/src
  • tar xfz jakarta-tomcat-5.5.4.tar.gz
  • mv jakarta-tomcat-5.5.4 /usr/local/
  • ln -s jakarta-tomcat-4.1.29 tomcat

Install ANT

  • cd /usr/local/src
  • unzip apache-ant-1.6.2-bin.zip
  • mv apache-ant-1.6.2 /usr/local
  • cd /usr/local
  • ln -s jakarta-ant-1.6.0 ant
  • ln -s /usr/local/ant/bin/ant /usr/local/bin/ant

Install OPENSSL

  • cd /usr/local/src
  • tar xfz openssl-0.9.7e.tar.gz
  • cd openssl-0.9.7e
  • ./config
  • make
  • make test
  • make install

Setting up java tomcat on linux II

Configure Environment Variables

Edited and add the lines below to '/etc/profile'
Make sure you logout and login for this to take effect.
JAVA_HOME=/usr/local/java/java
CATALINA_HOME=/usr/local/tomcat
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:/sbin:/usr/sbin
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/common/lib/servlet.jar:/usr/local/pgsql/share/java/postgresql.jar:../lib/struts.jar:.
Now add the PATH JAVA_HOME CATALINA_HOME & CLASSPATH if any aren't in the export line
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CATALINA_HOME CLASSPATH

Type env to check your environment variables

Setting up java tomcat on linux I

Downloaded the files
Got all appropriate files from web and place them in /usr/local/src/.
httpd-2.0.48.tar.Z (source) Download Apache Httpd
openssl-0.9.7d.tar.gz (source) Download Openssl
j2sdk-1_4_2_03-linux-i586.bin (binary) Download Java
jakarta-tomcat-4.1.29.tar.gz (binary) Download Tomcat
jakarta-ant-1.6.0-bin.zip (binary) Download Ant
jakarta-tomcat-connectors-1.2.5 (source) Download mod_jk
struts 1.1 (binary) Download Struts
postgresql-7.4.1.tar.gz (source) Download postrgresql
pgaccess-0.98.8.20030520.tar.gz (source) Download pgaccess This is a gui client to access db.

Saturday, November 27, 2004

home networking with TCP/IP and Microsoft Windows

home networking with TCP/IP and Microsoft Windows

Using your Network for file sharing

Have you rebooted your computers recently? We just made a load of configuration changes so be sure to reboot them! When your computers start up, give them a minute or so to become 'aware' of each other. Sometimes you will get error messages if you try to access your network neighborhood too soon.

Next, open your 'Network Neighborhood' or 'My Network Places'. If you do not immediately see your other computers, you may have to drill through the 'entire network' selection.

Once you locate another computer, double click it to view the network shares available. You can right click a network share and select 'Map Network Drive'. This lets you map the share to a local drive letter - like F:. Now you can use that share just like a local hard drive.


In this picture, drive F: is a network share called 'shared' on a computer called 'dual800'

I can't find the other computer!

Try using the 'search for computer' command

Try to map the share into a drive letter manually


--------------------------------------------------------------------------------

Search for a Computer on your network

Sometimes using the "Search for Computers..." command will force your system to find the other computer. Simply right click the "Network Neighborhood" or "My Network Places" icon on your desktop and select "Search for Computers".



You should now see a screen that looks like the this


Type in the full name of the computer you need to find and click search. Remember when I said to keep the computer names simple? This is why!!

Once the computer is found, double click it and map the share into a network drive. You may start seeing this computer in your network neighborhood now too!


If you still can not locate the computer, try manually mapping the drive





--------------------------------------------------------------------------------

Map a Network Drive

First, collect the COMPUTER NAME and SHARE NAME that you wish to map. Next, right click the "Network Neighborhood" or "My Network Places" icon on your desktop and select "Map Network Drive".


Select an drive letter and then type in the full path to the network share on the other computer. The syntax of the share should be \\computername\sharename as shown above.

home networking with TCP/IP and Microsoft Windows

home networking with TCP/IP and Microsoft Windows: "TCP/IP Home Networking
and File Sharing Tutorial"

Im trying to setup my home pcs at home that are connected to the internet via a wireless router, into a little home network. here goes:

First,
Check Your Internet Connection
Ensure all of your computers can connect to the Internet. This is the best way to ensure that your computers have good connectivity between them and have TCP/IP loaded. If all of your computers can connect to the Internet, the rest of this tutorial will be a breeze.

DONE

Next,
Update Windows
All versions of Microsoft Windows have networking bugs - Windows 98, 98SE, ME, NT, 2000, XP all need important updates to work correctly. It is VERY IMPORTANT that you update Microsoft Windows with the latest patches to get your home network running correctly. Do this with the 'Windows Update' selection on your Start Menu Or see How to Update Windows for a step by step tutorial for each Microsoft operating system.

DONE

Configure Windows 2000
with NetBIOS over TCP/IP
From your desktop, right click the "My Network Places" and select Properties.
Be sure 'Client for Microsoft Networks" and "File and Printer Sharing" are both installed. If they are not installed, click the "Install Button" to install them now.
Next, select the "Internet Protocol (TCP/IP)" and click Properties.
Next, click the Advanced Button
Select the WINS tab. Under the "NetBios Setting" area, select the "Enable NetBIOS over TCP/IP"

DONE

Make sure each computer is in the same workgroup
A 'workgroup' is simply a logical grouping of computers. On a home network, only a single workgroup is needed. If all of your computers are not in the same workgroup, they may not be able to see each other correctly. Just make one up and stick to it. Keep it simple and easy to remember.
Each computer should get the SAME WORKGROUP name and a DIFFERENT computer name. Again, keep all names simple and easy to remember.
Fun Network Naming Examples
Workgroup: Atom
Computers: Neutrino, Quark, Electron, Proton, Neutron, etc...
Workgroup: Sol
Computers: Earth, Mars, Venus, Jupiter, Saturn, etc...
Workgroup: Milkeyway
Computers: Sirus, Centauri, Vega, Deneb, Canopus, Proxima, Rigil, etc...

Windows 2000
From your desktop, right click the "My Computer" icon and select Properties.
Next, Select the "Network Identification Tab" and click the "Properties button"
Type in the workgroup name you have selected and a unique computer name that is easy to remember.

THEN
Share a Folder on Each Computer
(All computers are configured)
A folder or printer must be shared on each computer for them to show up in your network neighborhood. The next set of pages will show you how to share a folder. Windows 2000 NOTE: You need to create a NEW SHARE. The default drive shares are not 'network shares'.

What is a network share?
A network share is a logical way for other computers to access portions of your hard drive. Other computers see the share on the network and can load and save data files just like a local hard drive. Remember, a network share just represents shared hard drive space - not shared programs. If a program was installed on computer A, you can't normally run it on computer B unless it gets installed there too.
Share a folder or the whole hard drive?
Many people turn their entire hard drive into a network share. I consider this fairly unwise - especially if you have a wireless (802.11b) network. Wireless networking is vulnerable to hackers. With only a few folders shared, only those folders can be easily attacked.
I always suggest creating a folder on your hard drive called 'shared' and sharing that. In this way, you will never have to wonder what files are shared and what files are not.
Create The Network Share
Create a folder on your hard drive and name it SHARE. Next, right click the new folder and select "Sharing". You should see a display like this.


Select "Share This Folder"
Then click the "Permissions Button"

DONE

User Security - IMPORTANT

An account needs to be created for each uniqe 'login' name on your network. For instance, if you log into a Windows 98 computer with the login name 'ted', then you must create a Windows 2000 login called 'ted'.
From the control panel, double click the admin tools icon. Next, click the Computer management icon. This will bring up a screen like the one below. From here, open the Local Users and Groups tree and add a new user by right clicking on the 'Users folder' and select 'Add new user' .

Create a user name that MATCHES the user name used to log into your other Windows computer. I would suggest assigning a password to this ID. I have sometimes had trouble using 'blank passwords'. You should also UNCHECK the 'User must change password' line and CHECK 'password never expires'.

DONE

User Security - IMPORTANT

An account needs to be created for each uniqe 'login' name on your network. For instance, if you log into a Windows 98 computer with the login name 'ted', then you must create a Windows 2000 login called 'ted'.
From the control panel, double click the admin tools icon. Next, click the Computer management icon. This will bring up a screen like the one below. From here, open the Local Users and Groups tree and add a new user by right clicking on the 'Users folder' and select 'Add new user' .

Create a user name that MATCHES the user name used to log into your other Windows computer. I would suggest assigning a password to this ID. I have sometimes had trouble using 'blank passwords'. You should also UNCHECK the 'User must change password' line and CHECK 'password never expires'.

From your windows 98/98se/me computer, you will see this IPC$ dialog box when trying to access a Windows 2000 network share.
Just use the password you assigned to the user name you logged into the Windows 98/98SE/ME computer with

DONE

THEN
Mapping Drives, Browsing the network
First of all, reboot your computers! We just made a load of configuration changes! When your computers start up, give them a minute or so to become 'aware' of each other. Sometimes you will get error messages if you try to access your network neighborhood too soon.
Tell me more about Network Browsing, Searching and Mapping network drives

DONE


Using your Network for file sharing
Have you rebooted your computers recently? We just made a load of configuration changes so be sure to reboot them! When your computers start up, give them a minute or so to become 'aware' of each other. Sometimes you will get error messages if you try to access your network neighborhood too soon.
Next, open your 'Network Neighborhood' or 'My Network Places'. If you do not immediately see your other computers, you may have to drill through the 'entire network' selection.
Once you locate another computer, double click it to view the network shares available. You can right click a network share and select 'Map Network Drive'. This lets you map the share to a local drive letter - like F:. Now you can use that share just like a local hard drive.

In this picture, drive F: is a network share called 'shared' on a computer called 'dual800'
I can't find the other computer!
Try using the 'search for computer' command
Try to map the share into a drive letter manually
Search for a Computer on your network
Sometimes using the "Search for Computers..." command will force your system to find the other computer. Simply right click the "Network Neighborhood" or "My Network Places" icon on your desktop and select "Search for Computers".
You should now see a screen that looks like the this

Type in the full name of the computer you need to find and click search. Remember when I said to keep the computer names simple? This is why!!
Once the computer is found, double click it and map the share into a network drive. You may start seeing this computer in your network neighborhood now too!
If you still can not locate the computer, try manually mapping the drive
Map a Network Drive
First, collect the COMPUTER NAME and SHARE NAME that you wish to map. Next, right click the "Network Neighborhood" or "My Network Places" icon on your desktop and select "Map Network Drive".
A screen like this should appear
Select an drive letter and then type in the full path to the network share on the other computer. The syntax of the share should be \\computername\sharename as shown above. In this example drive F: will be mapped to a network share called 'shared' on a computer called 'dual800'
Example of a mapped share in Explorer

In this picture, drive F: is a network share called 'shared' on a computer called 'dual800'
You are Finished with this tutorial!
Return to the tutorial

Tuesday, November 23, 2004

Hibernate 3 sql-query not working

I have had a problem using order by on one of my mappings.

So as an attempted solution I have tried upgrading the application to Hibernate3, and tried to use the sql-query, so that I could use my own sql statement to load the object.

For some reason it is not working as hibernate is still generating its own SQL and ignoring the fact that I have specified loader in the class mapping. Is this a bug or am I doing something wrong.

The documentation seems very precise on how to use this, so any help would be most appreciated.

Failing this I may have to switch over to Ibatis so that I can get complete control of the SQL, as im pretty stuck at the moment, and all im trying to do is retrieve shopping baskets in description order? Hibernate version: Hibernate 3.0 alpha Mapping documents: <hibernate-mapping package="com.bertrams.bertweb.domain.order"> <class name="Basket" table="BBSHBM"> <composite-id name="id" class="BasketKey"> <key-property name="account" type="long" column="SBACCT"/> <key-property name="branch" type="long" column="SBBRAN"/> <key-property name="uuid" type="com.bertrams.bertweb.dao.hibernate.TrimmedString" column="SBUUID"/> </composite-id> <property name="description" type="com.bertrams.bertweb.dao.hibernate.TrimmedString"> <column name="SBDESC" sql-type="char(50)" not-null="true"/> </property> <property name="type" type="com.bertrams.bertweb.dao.hibernate.TrimmedString"> <column name="SBTYPE" sql-type="char(20)" not-null="true"/> </property> <map name="basketItems" inverse="true" lazy="false" cascade="all"> <key> <column name="SGACCT"/> <column name="SGBRAN"/> <column name="SGUUID"/> </key> <composite-index class="BasketItemIndex"> <key-property name="seqn" type="long" column="SGSEQN"/> <key-property name="isbn" type="com.bertrams.bertweb.dao.hibernate.TrimmedString" column="SGISBN"/> </composite-index> <one-to-many class="BasketItem"/> </map> [b]<loader query-ref="basketLoader"/>[/b] </class> [b] <sql-query name="basketLoader"> <return alias="b" class="Basket"/> SELECT {b}.SBACCT AS {b.id.account}, {b}.SBBRAN AS {b.id.branch}, {b}.SBUUID AS {b.id.uuid}, {b}.SBTYPE AS {b.type}, {b}.SBTYPEID AS {b.typeId}, {b}.SBSTAT AS {b.status}, {b}.SBCDAT AS {b.created}, {b}.SBCUSR AS {b.createdBy}, {b}.SBCPGM AS {b.createdByPgm}, {b}.SBMDAT AS {b.modified}, {b}.SBMUSR AS {b.modifiedBy}, {b}.SBMPGM AS {b.modifiedByPgm} FROM BBSHBM {b} WHERE {b}.SBACCT=? and {b}.SBBRAN=? AND {b}.SBSTAT='OPN' ORDER BY SBDESC </sql-query> [/b] </hibernate-mapping> Code between sessionFactory.openSession() and session.close(): Customer customer = (Customer)currentSession().get(Customer.class, ck); Full stack trace of any exception that occurs: Name and version of the database you are using: db2/400 v5r1 The generated SQL (show_sql=true): Hibernate: select baskets0_.SBACCT as SBACCT__, baskets0_.SBBRAN as SBBRAN__, baskets0_.SBUUID as SBUUID__, baskets0_.SBACCT as SBACCT0_, baskets0_.SBBRAN as SBBRAN0_, baskets0_.SBUUID as SBUUID0_, baskets0_.SBDESC as SBDESC3_0_, baskets0_.SBTYPE as SBTYPE3_0_, baskets0_.SBTYPEID as SBTYPEID3_0_, baskets0_.SBSTAT as SBSTAT3_0_, baskets0_.SBCDAT as SBCDAT3_0_, baskets0_.SBCUSR as SBCUSR3_0_, baskets0_.SBCPGM as SBCPGM3_0_, baskets0_.SBMDAT as SBMDAT3_0_, baskets0_.SBMUSR as SBMUSR3_0_, baskets0_.SBMPGM as SBMPGM3_0_ from BBSHBM baskets0_ where baskets0_.SBACCT=? and baskets0_.SBBRAN=? and baskets0_.SBSTAT='OPN' Debug level Hibernate log excerpt

Order-by problem in hibernate on as400

I am having a problem using order-by on as400. I have used it previously in other mapping files, no problem, but for some reason hibernate seems to be using the wrong field name in the order-by. It looks as if it is giving the result field a new name in the sql statement, but using the original name in the order-by
Anyone have any workarounds for this, or suggest what im doing wrong?
the order-by is on SBDESC , a description field that I want to sort on?
Hibernate version:
2.1.6 (also tried on 2.1.2 and 3 with the same result)
Mapping documents:
<hibernate-mapping package="com.bertrams.bertweb.domain.customer">
<class name="Customer" table="BBEDPDL5">
<composite-id name="id" class="CustomerKey">
<key-property name="account" type="long" column="BEACCN"/>
<key-property name="branch" type="long" column="BEBRAC"/>
</composite-id>

<map name="baskets" where="SBSTAT='OPN'" [b]order-by="SBDESC"[/b]>
<key>
<column name="SBACCT"/>
<column name="SBBRAN"/>
</key>
<index column="SBUUID" type="com.bertrams.bertweb.dao.hibernate.TrimmedString"/>
<one-to-many class="com.bertrams.bertweb.domain.order.Basket"/>
</map>
</class>
</hibernate-mapping>
<hibernate-mapping package="com.bertrams.bertweb.domain.order">
<class name="Basket" table="BBSHBM">
<composite-id name="id" class="BasketKey">
<key-property name="account" type="long" column="SBACCT"/>
<key-property name="branch" type="long" column="SBBRAN"/>
<key-property name="uuid" type="com.bertrams.bertweb.dao.hibernate.TrimmedString" column="SBUUID"/>
</composite-id>

<property name="description" type="com.bertrams.bertweb.dao.hibernate.TrimmedString">
<column name="SBDESC" sql-type="char(50)" not-null="true"/>
</property>
</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Customer customer = (Customer)currentSession().get(Customer.class, ck);

Full stack trace of any exception that occurs:
Hibernate: select baskets0_.SBACCT as SBACCT__, baskets0_.SBBRAN as SBBRAN__, baskets0_.SBUUID as SBUUID__, baskets0_.SBACCT as SBACCT0_, baskets0_.SBBRAN as SBBRAN0_, baskets0_.SBUUID as SBUUID0_, baskets0_.SBDESC as SBDESC0_, baskets0_.SBTYPE as SBTYPE0_, baskets0_.SBTYPEID as SBTYPEID0_, baskets0_.SBSTAT as SBSTAT0_, baskets0_.SBCDAT as SBCDAT0_, baskets0_.SBCUSR as SBCUSR0_, baskets0_.SBCPGM as SBCPGM0_, baskets0_.SBMDAT as SBMDAT0_, baskets0_.SBMUSR as SBMUSR0_, baskets0_.SBMPGM as SBMPGM0_ from BBSHBM baskets0_ where baskets0_.SBACCT=? and baskets0_.SBBRAN=? and baskets0_.SBSTAT='OPN' order by baskets0_.SBDESC
[22/11/04 15:38:41:562 GMT] 5a795a79 SystemOut O as400: PreparedStatement STMT0005 (1741514701) open. Parent: Connection S44B4901 (744107098) .
as400: PreparedStatement STMT0005 (1741514701) : Escape processing = "true".
as400: PreparedStatement STMT0005 (1741514701) : Fetch direction = "1000".
as400: PreparedStatement STMT0005 (1741514701) : Fetch size = "0".
as400: PreparedStatement STMT0005 (1741514701) : Max field size = "0".
as400: PreparedStatement STMT0005 (1741514701) : Max rows = "0".
as400: PreparedStatement STMT0005 (1741514701) : Query timeout = "0".
as400: PreparedStatement STMT0005 (1741514701) : Result set conncurrency = "1007".
as400: PreparedStatement STMT0005 (1741514701) : Result set type = "1003".
as400: PreparedStatement STMT0005 (1741514701) : Preparing [select baskets0_.SBACCT as SBACCT__, baskets0_.SBBRAN as SBBRAN__, baskets0_.SBUUID as SBUUID__, baskets0_.SBACCT as SBACCT0_, baskets0_.SBBRAN as SBBRAN0_, baskets0_.SBUUID as SBUUID0_, baskets0_.SBDESC as SBDESC0_, baskets0_.SBTYPE as SBTYPE0_, baskets0_.SBTYPEID as SBTYPEID0_, baskets0_.SBSTAT as SBSTAT0_, baskets0_.SBCDAT as SBCDAT0_, baskets0_.SBCUSR as SBCUSR0_, baskets0_.SBCPGM as SBCPGM0_, baskets0_.SBMDAT as SBMDAT0_, baskets0_.SBMUSR as SBMUSR0_, baskets0_.SBMPGM as SBMPGM0_ from BBSHBM baskets0_ where baskets0_.SBACCT=? and baskets0_.SBBRAN=? and baskets0_.SBSTAT='OPN' order by baskets0_.SBDESC].
SQLException: SQLState(42707) vendor code(-208)
[22/11/04 15:38:41:656 GMT] 5a795a79 JDBCException W net.sf.hibernate.util.JDBCExceptionReporter SQL Error: -208, SQLState: 42707
[22/11/04 15:38:41:687 GMT] 5a795a79 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter [SQL0208] ORDER BY column SBDESC or expression not in result table.
[22/11/04 15:38:41:718 GMT] 5a795a79 JDBCException W net.sf.hibernate.util.JDBCExceptionReporter SQL Error: -208, SQLState: 42707
[22/11/04 15:38:41:718 GMT] 5a795a79 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter [SQL0208] ORDER BY column SBDESC or expression not in result table.
[22/11/04 15:38:41:734 GMT] 5a795a79 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter could not initialize collection: [com.bertrams.bertweb.domain.customer.Customer.baskets#[account:63173][branch:1]]
[22/11/04 15:38:41:734 GMT] 5a795a79 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter TRAS0014I: The following exception was logged java.sql.SQLException: [SQL0208] ORDER BY column SBDESC or expression not in result table.
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at java.sql.SQLException.<init>(SQLException.java:52)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1075)
at com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
at com.ibm.as400.access.AS400JDBCConnectionHandle.prepareStatement(AS400JDBCConnectionHandle.java:669)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1458)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1424)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:257)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:232)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:990)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:965)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3268)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3123)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:931)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1991)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1927)
at com.bertrams.bertweb.dao.CustomerDAO.getCustomer(CustomerDAO.java:20)
at com.bertrams.bertweb.delegate.CustomerDelegate.getCustomerBaskets(CustomerDelegate.java)
at com.bertrams.bertweb.controller.action.ShoppingBasketAction.list(ShoppingBasketAction.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)
.
java.sql.SQLException: [SQL0208] ORDER BY column SBDESC or expression not in result table.
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at java.sql.SQLException.<init>(SQLException.java:52)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:388)
at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatement.java:1075)
at com.ibm.as400.access.AS400JDBCPreparedStatement.<init>(AS400JDBCPreparedStatement.java:208)
at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConnection.java:1419)
at com.ibm.as400.access.AS400JDBCConnectionHandle.prepareStatement(AS400JDBCConnectionHandle.java:669)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1458)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1424)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:257)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:232)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:65)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:990)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:965)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3268)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3123)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:931)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1991)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:1927)
at com.bertrams.bertweb.dao.CustomerDAO.getCustomer(CustomerDAO.java:20)
at com.bertrams.bertweb.delegate.CustomerDelegate.getCustomerBaskets(CustomerDelegate.java)
at com.bertrams.bertweb.controller.action.ShoppingBasketAction.list(ShoppingBasketAction.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)
Name and version of the database you are using:
db2/400 v5r1
The generated SQL (show_sql=true):
Hibernate: select baskets0_.SBACCT as SBACCT__, baskets0_.SBBRAN as SBBRAN__, baskets0_.SBUUID as SBUUID__, baskets0_.SBACCT as SBACCT0_, baskets0_.SBBRAN as SBBRAN0_, baskets0_.SBUUID as SBUUID0_, baskets0_.SBDESC as SBDESC0_, baskets0_.SBTYPE as SBTYPE0_, baskets0_.SBTYPEID as SBTYPEID0_, baskets0_.SBSTAT as SBSTAT0_, baskets0_.SBCDAT as SBCDAT0_, baskets0_.SBCUSR as SBCUSR0_, baskets0_.SBCPGM as SBCPGM0_, baskets0_.SBMDAT as SBMDAT0_, baskets0_.SBMUSR as SBMUSR0_, baskets0_.SBMPGM as SBMPGM0_ from BBSHBM baskets0_ where baskets0_.SBACCT=? and baskets0_.SBBRAN=? and baskets0_.SBSTAT='OPN' order by baskets0_.SBDESC
Debug level Hibernate log excerpt:
[/b]

Saturday, November 13, 2004

CVS Respitory on as400 Iseries II

Well got the samba mount to our development as400 working. I could see the as400 IFS from the linux samba mount.

So I setup a directory called repository,at /home/cvs.
Set the access level and access mode of directory /home/cvs/repository: chmod 770 /home/cvs/repository
Set setgid bit on directory /home/cvs/repository: chmod g+s /home/cvs/repository
(last two done via qshell)

Unfortunately the samba mount does not play very nicely with CVS. When i tried to initialise a new repository using the command:
cvs -d /mnt/cvs/repository init

I got an input/output error and the linux box lost the connection to the as400.

Thinking that there must be a way to get this working I did some reading and discovered (Columbus style, as I wasnt the first) NFS.

So I set up NFS on the 400, by first adding this to /etc/EXPORTS:
/home/cvs RW=198.26.21.122,root=198.26.21.122,anon=-1

then starting NFS:
STRNFSSVR SERVER(*ALL)

Then on the linux box, I setup the mount in /etc/fstab so it kicks in on reboot:
198.26.21.122:/home/cvs /mnt/cvs nfs rw

ok, fine and dandy, did reboot and did an ls in /mnt/cvs and hooray, as400 IFS.
Then to setup the cvs repository:

cvs -d /mnt/cvs/repository init

this also ran fine and dandy.

The next step on the linux box was to modify xinetd service to enable pserver protocol

Logged in as root.

Create a file named cvspserver in directory /etc/xinetd.d with this content:

# default:
off # description: An cvs server.
service cvspserver {
disable = no
socket_type = stream
protocol = tcp
user = root
wait = no
server = /usr/bin/cvs
server_args = -f --allow-root=/home/cvs/repository pserver
log_on_success +=USERID
log_on_failure += USERID
}

Open /etc/services and verify that these two lines are present. If they are not, add them:
cvspserver 2401/tcp # CVS client/server operations
cvspserver 2401/udp # CVS client/server operations

Restart xinetd service:
service xinetd restart

did all that, then as instructed, setup the user environment

Open the file /etc/profile. You should to see these lines in the file:
USER='id -un'
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

Add one line after the environment variable MAIL.
CVSROOT=":pserver:$USER@localhost:/home/cvs/repository"

In the file, you should also see a line like this:
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

Modify it and add CVSROOT into the export list like this:
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC CVSROOT

Test the installation by local users

Developer 1 log in as cvsdev1.
Make sure the environment variable is correct by typing this command:

echo $CVSROOT

It should return a result like this related to the user name:
:pserver:cvsdev1@localhost:/home/cvs/repository

I did get an error at this point related to dodgy characters in my etc/profile file. This was caused by downloading the file to windows, (i USE WinSCP), and editing using wordpad which introducing dos style line breaks. To fix this I opened the file in vi, and then did :set ff=unix to change the file format

logged off and tried echo $CVSROOT again, and got the correct result this time!

Then tried to login to cvs (had previously used useradd to create cvs, and 2 other users)
CVS login
was prompted for password but when i entered my linux login, got
cvs [login aborted]: connect to localhost(127.0.0.1):2401 failed: Connection refused

I think this is related to the cvs pserver setup. Ive tried a few things but havent got to the bottom of it on as400 yet.

Friday, November 12, 2004

CVS Repository on the Iseries

One of the things that I have been trying to do this week is
  • Get CVS setup on a PC. This is now down with Mandrake 10 installed, which comes with CVS (dont know what version) and SAMBA installed
  • Setup a mount to a shared directory in the IFS of our development as400. Also done. We created a share of a folder on our dev 170, and then used set up a SAMBA mount to fstab to this share, so that it was done every time the machine is restarted:

//127.0.0.1/cvsserver /mnt/my400 smbfs username=user,password=password,dmask=777,fmask=777