Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

tomasz brymora

Greenhorn
+ Follow
since May 31, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tomasz brymora

Greetings!

I got lost trying to save and read an image file from a db.

I get file upload taken care of where a servlet populates a bean with the image file and other info,
but I can't get to be written to the db.

What's the best way to procede, starting with the bean?

Would this be appropriate:


Given the following table:


... waht's the correct way to make the insert?
I'm using iBatis for handling the jdbc part of the app.

... partial iBatis sqlMap:

... from what I gathered, pg uses a path to the image file for importing it, so should I store to a temp dir on
the server and feed pg the path to it?
Would the bean then require a String for the imageBody variable instead of the MultipartFile?

Am I using the datatype for this operation (oid)?

Before this I was able to store the image file in the db as 'bytea' but ran into problems trying to retrieve it:

INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
org.springframework.dao.DataIntegrityViolationExce ption: SqlMapClient operation; SQL [];
--- The error occurred in com/persistance/sqlmaps_xml/imagesSqlMap.xml.
--- The error occurred while applying a result map.
--- Check the getImageResult.
--- Check the result mapping for the 'imageBody' property.
--- Cause: org.postgresql.util.PSQLException: Bad value for type int : \377 ... rest omitted...


... so I'll appreciate any feedback you might have.
Would iBatis be helpful in creating sequential, 'auto-generated' keys, or does it still need to be taken care of entirely in the application code to keep the project code database neutral as much as possible?
QUICK UPDATE:
turns out the initial problem was the fact that I needed to deploy COMPILED servlets, not sources. So much for making the wrong initial assumptions. That stems from an insanely positive experience of using another host service, where all one needs is to drop SOURCES into the appropriate places.

... so now, I've added NetBeans 4.0 to mess and was able to mirror the live projects structure in NetBeans. After compiling and uploading the sources, now I'm getting this Unknow Source error:

org.apache.jasper.JasperException: MultipartRequest
at org.apache.jasper.servlet.JspServletWrapper.service(Unknown Source)

... rest of error printout skept ....

The web.xml file is the same one from yesterday, so do I have a web.xml error or pathing error in the JSP file?
17 years ago
JSP
... another PACKAGE DOES NOT EXIST problem tryint to run a JSP that needs some beans.


THE JSP IN QUESTION: (/java-sumton/)

<%@ page language="java" import="java.util.*, JavaTomek_v1.*" %>

<jsp:useBean id="req" class="JavaTomek_v1.MultipartRequest">
<jsp:setProperty name="req" property="request" value="<%= request %>" />
</jsp:useBean>
<jsp:useBean id="validInput" scope="session" class="JavaTomek_v1.ValidEMail" />
<jsp:useBean id="se" scope="session" class="JavaTomek_v1.SendEMail"></jsp:useBean>

TOP OF THE MultipartRequest servlet: (/java-sumton/WEB-INF/classes/JavaTomek_v1)

package JavaTomek_v1;

import javax.servlet.http.*;
import java.io.*;
import java.util.*;

THE ERROR:

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /sumton_mail.jsp

Generated servlet error:
[javac] Compiling 1 source file

/var/tomcat4/work/Standalone/localhost/java-sumton/sumton_mail_jsp.java:8: package JavaTomek_v1 does not exist
import JavaTomek_v1.*;

WEB.XML:
<servlet>
<servlet-name>MultipartRequest</servlet-name>
<servlet-class>JavaTomek_v1.Table</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>MultipartRequest</servlet-name>
<url-pattern>/JavaTomek_v1/*</url-pattern>
</servlet-mapping>

-------

I didn't notice the web.xml make much difference except messing up (JSPs become invisible to Tomcat - 404) the whole setup (requiring tomcat reboot) if I do this:
<url-pattern>JavaTomek_v1</url-pattern>

any ideas about what's happening? I promise to post the solution here when this thing gets working

[Bear edit: edited for language]
[ April 21, 2005: Message edited by: Bear Bibeault ]
17 years ago
JSP
... did you get the example to work? I'm having almost exactly same problem. Would love to find out what happened.
T
17 years ago
JSP
...well, the saga continues, the connectro seems to be working but now I'm not able to compile/run a jsp file quiet yet. the closest i get to it is a 505 error.

I went and try to actually get a better view of what works and what doesn't with the present configuration.

1 - httpd.conf loads mod_jk.c (or it's supposed according to what I see, not mod_jk2.c though)
2 - one of the last lines in httpd.conf specifies a workers2.properties in apache2 dir. (before it had one in jakarta-tomcat5.0 dir.

3 - in apache2/virtual_hosts there's a file named www.cinnamonbaycoffee.com.conf that specifies JkMount(s) that seems to do the trick as far as being able to run/view, say /jsp-examples/ that come with Tomcat

when I comment out those JkMount lines, I cant' see files/directories, [uri: ****] mappings in workers2.properties seem to make no difference, not JkMount(s) in mod_jk.conf file.

4 in jakarta-tomcat5.0/conf I see jk2.properties file but no jk.properties file does it matter?

this is what the files look like:

JK2.PROPERTIES:

channelSocket.address=cinnamonbaycoffee.com
channelSocket.port=8009
channelSocket.serverTimeout=600
channelSocket.maxThreads=50

VIRTUAL_HOSTS/WWW.CINNAMONBAYCOFFEE.COM.CONF:
ServerName www.cinnamonbaycoffee.com
ServerAlias cinnamonbaycoffee.com

Documentroot "/usr/local/www/cinnamonbaycoffee.com/www"
DirectoryIndex index.php index.php3 index.html index.cgi index.htm home.htm

ErrorLog /var/www/cinnamonbaycoffee.com/www/error_log
CustomLog /var/www/cinnamonbaycoffee.com/www/access_log combined

Alias /stats /usr/local/stats/cinnamonbaycoffee.com/www

# JkMount /usr/local/www/cinnamonbaycoffee.com/www/webapps/* cinnamonbaycoffee
# JkMount /jsp-examples/* cinnamonbaycoffee

APACHE2/mod_jk.conf:

JkWorkersFile /usr/local/etc/apache2/workers2.properties
JkLogFile logs/jk.log
JkLogLevel warn

# Jk Mount
JkMount /jsp-examples/* cinnamonbaycoffee.com

(uncommented JkMount here seems to make no difference though)

APACHE2/workers2.properties:

worker.list=cinnamonbaycoffee
# communications channel
[channel.socket:200.46.204.56:8009
info=Ajp13 forwarding over socket
tomcatId=200.46.204.56:8009

worker.cinnamonbaycoffee.port=8009
worker.cinnamonbaycoffee.host=200.46.204.56
worker.cinnamonbaycoffee.type=ajp13
# worker.cinnamonbaycoffee.lbfactor=1

# uri mappings
[uri:/jsp-examples/*]
info=maping jsp-examples context of Tomcat


- uri mapping seems to have no effect either.

.... sheesh, well, if anybody makes any sense out of that I'd love to find out what's happenng.

Hopefully some other poor bastad wont have to suffer as much next time ;-)

T
17 years ago
... hm, I think I found out that the other place is using Resin. Oh well,

New question, regarding the Tomcat Manager.
I was able to enable this one fine and now:

in the ROOT directory I have 'jsp' directory with Form.jsp in it.

I'm trying to deploy it through the manager


I've created a Form.xml file for it:

<Context path="/jsp" docBase="${catalina.home}/server/webapps/jsp"<br /> debug="0" privileged="true">
< !-- some comments -->
<ResourceLink name="users" global="UserDatabase"<br /> type="org.apache.catalina.UserDatabase"/>

</Context>

... I'm entering:

Context Path (optional):
XML Configuration file URL:
WAR or Directory URL:


the error the manager spits out is:
FAIL - Encountered exception java.net.MalformedURLException: no protocol: jsp/Form.xml

... I'm thinking I'm getting closer I think, but is it ever slow!

T
17 years ago
from the browser's perspective I'm trying to run:

http://cinnamonbaycoffee.com/jsp/Form.jsp

on the server the things sits in:

/usr/local/jakarta-tomcat5.0/webapps/ROOT/jsp/Form.jsp

it turns out that after all the config changes, webapps directory is where the browser goes to.

How the other hosting provider had the stuff configured, I don't know, never had root access to my acount on that one.

T
17 years ago
... well, this is what I do when I work in another hosting enviroment, I simply create my .jsp file, then drop it in wherever, literally, (say next to my index.html file for instance) and it runs. I never have to touch anything elese, for all proctical reasons and pursposes I don't ever have to meet Mr. (or Mrs, MS? ) web.xml file.

In the case of the puzzle I brought here it does't work that way. Say the default jsp & servlet examples wtha come with Tomcat are working ok, but if just drop a .jsp file and try to run it I get the avove 500 error

... it's back to scratching my head now.
17 years ago
update: the connector works now at least.

we have the mod_jk doing the work instead of mod_jk2, but it seems to work.

we also changed/added JkMount settings in virtual_hosts file in apache2

next questions I have how do I set up the work environment so I don't have to edit .xml files manually every time I add a .jsp file? I'm afraid some initial editing will be required, but I'd like to set it up in the easiest way possible.

well, yes, this is how much catchup learning I must do in the admin arena:


root cause
java.io.FileNotFoundException: /usr/local/jakarta-tomcat5.0/work/Catalina/localhost/jsp-examples/org/apache/jsp/Form_jsp.java (No such file or directory)

... I'm tryin to run my own test .jsp file and the 500 error shows up, I'm not sure what it REALLY looking at.

thanks
17 years ago
... should I change 'tomcatId=myTomcat' to 'tomcatId=cinnamonbaycoffee.com' in workers2.properties by any chance? here's what's there now:

# Define a socket communication channel
[channel.socket:cinnamonbaycoffee.com:8009]
host=cinnamonbaycoffee.com
port=8009
tomcatId=myTomcat

# Shared Memory file settings
[shm]
file=/usr/local/etc/apache2/jk2.shm
size=1000000

# Define a tomcat worker which will use the
communication channel defned
# in the previous step
[ajp13:cinnamonbaycoffee.com:8009]
channel=channel.socket:myTomcat

this works fine:http://www.cinnamonbaycoffee.com:8080/

apache is running fine (so i think anyway)


I'll do this part a little later, have to bail for the moment:

JkMount /webapps/* cinnamonbaycoffee.com
17 years ago
Hi All!

I have problems integrating Apache2 and Tomcat5 on a FreeBSD server and I'ld like to confess that server administration is a very weak spot for me, as I've always delt with code rather than administration. However I must solve this puzzle eventually.

So I set out armed with Professional Apache Tomcat 5 from Wrox and it's only marginally helpfull in my case. I'll be the first to admit that I might be just not too sharp with it.

I've tried searching for info on the topic that's FreeBSD specific but had limited luck so far.

I've you have anything to share I thank in advance.

This is what I've done (as best as I can recall right
now)

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

1. - in server.xml I just looked at the AJP Connector
and it was/is set to port 8009

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

2. - created the workers2.properties file and it looks
like this:

# workers2.properties set up by Tomasz Brymora
# tomekpilot@yahoo.com
# 4-06-2005

# settings for Logger of type Apache2
[logger.apache2]
file=/usr/local/etc/apache2/logs/error.log
level=INFO
debug=1

# Provide the basic config needed
[config]
file=/usr/local/etc/apache2/workers2.properties
debug=0

# Define a socket communication channel
[channel.socket:cinnamonbaycoffee.com:8009]
host=cinnamonbaycoffee.com
port=8009
tomcatId=myTomcat

# Shared Memory file settings
[shm]
file=/usr/local/etc/apache2/jk2.shm
size=1000000

# Define a tomcat worker which will use the
communication channel defned
# in the previous step
[ajp13:cinnamonbaycoffee.com:8009]
channel=channel.socket:myTomcat

# Map the Tomcat jsp-examples webapp to the Web server
uri space
[uri:/jsp-examples/*]
info=mapping the jsp-examples context of Tomcat

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

3. - in httpd.conf uncommented the line for LoadModule
jk2_module so it can load

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

4. - edited the jk2.properties file:

## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE
TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.

## COMMENTS WILL BE _LOST_

## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.

# Set the desired handler list
# handler.list=apr,request,channelJni
#
# Override the default port for the socketChannel
# changes by Tomasz 4.06.05
channelSocket.address=cinnamonbaycoffee.com
channelSocket.port=8009
channelSocket.serverTimeout=600
channelSocket.maxThreads=50

# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:

# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If set to inprocess the mod_jk2 will Register
natives itself
# This will enable the starting of the Tomcat from
mod_jk2
# apr.jniModeSo=inprocess

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

5. - stoped and started Tomcat, stoped and started
apache2

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

6. - tested it in the browser but I could not get the
JSP examples page without specifying port 8080 in url

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

7. - this morning: re-created workers2.properties
based on the sample in the directory:
workers.properties.sample, this time it looks like
that:

# workers2.properties set up by Tomasz Brymora
# tomekpilot@yahoo.com
# try 2 - 4-06-2005

# this file based on workers.properties.sample

worker.list=cinnamonbaycoffee.com

worker.cinnamonbaycoffee.com.port=8009
worker.cinnamonbaycoffee.com.host=cinnamonbaycoffee.com
worker.cinnamonbaycoffee.com.type=ajp13
worker.cinnamonbaycoffee.com.lbfactor=1

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

8. - restarted Tomcat, restarted Apache

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

9. - discovered the mod_jk.properties file, looked at
it, and created mod_jk2.properties looking like this:

# created by Tomasz Brymorat tomekpilot@yahoo.com
# try 1
# 04.06.2004


# Replace jsp-hostname with the hostname of your JSP
server, as
# specified in workers.properties.
#
IfModule mod_jk2.c
JkWorkersFile
/usr/local/etc/apache2/workers2.properties
JkLogFile logs/jk.log
JkLogLevel warn

# Sample JkMounts. Replace these with the
paths you would
# like to mount from your JSP server.
JkMount /*.jsp cinnamonbaycoffee.com
JkMount /servlet/* cinnamonbaycoffee.com
JkMount /examples/* cinnamonbaycoffee.com
/IfModule

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

10. - restarted Tomcat, restarted Apache, no luck,
still must specify port 8080 in the url to see the JSP
samples page

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

11. - decided to mod the mod_jk.properties file
itself:

# created by Tomasz Brymorat tomekpilot@yahoo.com
# try 1

# did this after trying to create mod_jk2.conf

# 04.06.2004


# Replace jsp-hostname with the hostname of your JSP
server, as
# specified in workers.properties.
#
IfModule mod_jk2.c
JkWorkersFile
/usr/local/etc/apache2/workers2.properties
JkLogFile logs/jk.log
JkLogLevel warn

# Sample JkMounts. Replace these with the
paths you would
# like to mount from your JSP server.
JkMount /*.jsp cinnamonbaycoffee.com
JkMount /servlet/* cinnamonbaycoffee.com
JkMount /examples/* cinnamonbaycoffee.com
/IfModule


# Tomaszh code continued

IfModule mod_jk.c
JkWorkersFile
/usr/local/etc/apache2/workers2.properties
JkLogFile logs/jk.log
JkLogLevel warn

# Jk Mounts
JkMount /*.jsp cinnamonbaycoffee.com
JkMount /servlet/* cinnamonbaycoffee.com
JkMount /examples/* cinnamonbaycoffee.com
/IfModule

-----------

12. - restarted Tomcat and Apache respectively, still
no luck with the url, still get 404 error without
specifying port 8080 in the url to view the JSP
samples page

-----------

now, all the original unmded files are there, just
maked 'name-original'

... any ideas from this vantage point?

well, I really appreciate your help.

Tomasz
17 years ago
Hi All!
I've got me a little web-design-programming project that needs to go live this week and believe it or not I'm still trying to decide/find a hosting provider. Instead of taking a shot in the dark and guessing who to pick, maybe someone could share a word of advice.

At this point all I'm looking for is RELIABILITY, Tomcat and PostgreSql.
Dedicated servers and JVMs are not required (yet anyway).

I guess I could go with the folks I'm using right now, but service can be a little spotty with them.

So far I'm eyeing hub.org cqhost.com and javaservlethosting.com

Does anyone have any recommendations / warnings based on first hand experience with hosting companies?

Thanks in advance!
T
17 years ago
Hi all!
Got a silly simple newbe question I think, but can't find any simple answers.

Wthat are essential differences between JBuilder X and JBuilder 2005?

Want to try JBuldier, run into both downloads but I can't find a feature/comparison matrix for the Foundation edditions of neither.

Any thoughts, experiences, suggestions? Thank you lots in advance!
Hi All!
Just curious if there are any pilots/CFI's/students and/or such here :>
Devised a project for myself and I'd really like to get in touch with aviators/Java folks, and ask for some feedback.
Thanks,
T.
18 years ago