RE: session trakking in jsp or in Bean
> Marju wrote: > I want to track a session of an input a user enter in my jsp page.The jsp page >is using a bean to execute sql queries.That works wel. > > My question is it advisable to track the session in the jsp page or in the >Bean.Which is better I am not sure I follow you here. There is a session object you can get from the request that makes it possible tostore data through several request in the same session. request.getSession().setAttribute("akey", anObject) to set session attributes. request.getSession().getAttribute("akey") to get attributes. If you have users that log in and out you probably should set some user identifying info in the session and a filter to makes sure that the user is logged in for certain requests. Regards, Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: java.lang.Class.getResourceAsStream() throws ClassCastException
> During initilization of my c3p0 connection pool by hibernate the below printed > exception occurs. The exception causes a failure in the c3p0 initilization and > thus hibernate and my application. > > Does anyone know what might cause this behavour? Seems like it is the catalina class loader that fails to cast an object into a org.apache.naming.resources.FileDirContext. I checked the latest source of this class and there is no FileDirContext in WebappClassLoader. From the stack I am guessing that there are class namse in property files that are loaded dynamically. Maybe something is wrong in those property files? What version of tomcat are you using? (Assuming that you are using tomcat that is. Catalina code seem to be involved somehow.) I am not sure if I can help you any further but the folks that can will surely be happy for some details about tomcat versions, platform and so on. Regards, Fredrik The stack trace -- java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance (Constructor.java:494) at com.jsportal.projectportal._config.(_config.java:158) at com.jsportal.projectportal.applicationConfig. (applicationConfig.java:119) at com.jsportal.projectportal.web.webApplicationConfig. (webApplicationConfig.java:85) at com.jsportal.projectportal.web.ApplicationStartupServlet.setUpApplicatio n(ApplicationStartupServlet.java:123) at com.jsportal.projectportal.web.ApplicationStartupServlet.init (ApplicationStartupServlet.java:53) at org.apache.catalina.core.StandardWrapper.load (StandardWrapper.java:852) at org.apache.catalina.core.StandardContext.loadOnStartup (StandardContext.java:3267) at org.apache.catalina.core.StandardContext.start (StandardContext.java:3384) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.start (StandardHost.java:612) at org.apache.catalina.core.ContainerBase.start (ContainerBase.java:1123) at org.apache.catalina.core.StandardEngine.start (StandardEngine.java:307) at org.apache.catalina.core.StandardService.start (StandardService.java:388) at org.apache.catalina.core.StandardServer.start (StandardServer.java:505) at org.apache.catalina.startup.Catalina.start(Catalina.java:776) at org.apache.catalina.startup.Catalina.execute (Catalina.java:681) at org.apache.catalina.startup.Catalina.process (Catalina.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.main (Bootstrap.java:243) Caused by: java.lang.ExceptionInInitializerError at com.mchange.v2.c3p0.PoolConfig.(PoolConfig.java:93) at org.hibernate.connection.C3P0ConnectionProvider.configure (C3P0ConnectionProvider.java:84) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider (ConnectionProviderFactory.java:124) at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider (ConnectionProviderFactory.java:56) at org.hibernate.cfg.SettingsFactory.createConnectionProvider (SettingsFactory.java:366) at org.hibernate.cfg.SettingsFactory.buildSettings (SettingsFactory.java:60) at org.hibernate.cfg.Configuration.buildSettings (Configuration.java:1859) at org.hibernate.cfg.Configuration.buildSessionFactory (Configuration.java:1152) at com.jsportal.projectportal.transactionManagement.HibernateResource.(HibernateResource.java:45) ... 26 more Caused by: java.lang.ClassCastException: org.apache.naming.resources.FileDirContext at org.apache.catalina.loader.WebappClassLoader.findResourceInternal (WebappClassLoader.java:1585) at org.apache.catalina.loader.WebappClassLoader.findResource (WebappClassLoader.java:914) at org.apache.catalina.loader.WebappClassLoader.getResourceAsStream (WebappClassLoader.java:) at java.lang.Class.getResourceAsStream(Class.java:1998) at com.mchange.v2.cfg.BasicMultiPropertiesConfig. (BasicMultiPropertiesConfig.java:48) at com.mchange.v2.cfg.BasicMultiPropertiesConfig. (BasicMultiPropertiesConfig.java:39) at com.mchange.v2.cfg.MultiPropertiesConfig.read (MultiPropertiesConfig.java:64) at com.mchange.v2.cfg.MultiPropertiesConfig.readVmConfig (MultiPropertiesConfig.jav
RE: error Ljavax/servlet/http/HttpServletRequest
Hi, > I `m calling a bean from a jsp page that return HttpServletRequest snippet > > HttpServletRequest req= myBean.getMessage(); > out.write(req.getParameter("mess")); > where mess is a variable that was set in the bean > > My problem jsp can`t compile I got the following errors > >javax.servlet.ServletException: com.MyBean.getMessage() >Ljavax/servlet/http/HttpServletRequest; >java.lang.NoSuchMethodError: com.MyBean.getMessage() >Ljavax/servlet/http/HttpServletRequest; I feel this question should be answered by reading up on Java - it has not much to do with tomcat. The exception you get is easy to find on the web I googled "java.lang.NoSuchMethodError" and got as first result the Sun javadoc for the class. It's here: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/NoSuchMethodError.html . It says: "Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method." (Now this explanation may be hard to understand if you are not somewhat used to OO terminology. If this is the case I suggest you read up on OO and its use in Java.) Anyway, this means that there is no method in your class com.MyBean called getMessage that returns an instance of javax.servlet.http.HttpServletRequest. It would be interesting to know why you are passing around the HttpServletRequest in this way. It is easily accesible from the JSP page anyway. Regards, Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Concept for modeling hierarchical data
Florian Lindner wrote: > > Florian Lindner wrote: > > >Hello, > > >I'm searching for the best concept of how to use and save > > >hierarchical data. I have a structure like PC file system with meta > > >data. There a folder objects and files objects of different types. > > >Every object have data like permissions, date and author. And they > > >have type-specific data fields like resolution (of an image type) or > > >location (of an meeting > > > type) or ingredients (of an recipe type). > > >What is the best way to store that kind of data? What database is > > >recommendable? What concepts of persistance? Or not using managed > > >persistance and do it manually? > > > > If you want to do it manually, a hierarchical tree can be represented > > by just one table: > > > > CREATE TABLE tree ( > > id INTEGER PRIMARY KEY, > > parent_id INTEGER > > ); > > > > With managed persistence, be carefull not to configure it to load the > > entire tree at once. > > > > As for a DB, any decent relational DB will do. > > In this concept I need a table for every type of objekt I want? It depends on if you want the DB to handle data integrity for you. If you are happy to have everything as key-value pairs you can come away with two tables. Add a table with columns kay, values and a foreign key to the suggested tree table. If you want specific data integrity per type you will have to have one table per type. It also seems that some data is there for all types (permissions, date and author). Maybe you want to reuse that definition in one table. In the end it depends on what you will be using this tree of data for, how will you access it and what technology will be used? Will it be read-only or both reads and writes? Volumes? Number of users? If data is to be updated by several users I think youl should definitely use a relational database of some kind. If it is read-only then XML files will be good enough. Hibernate is a good persistence framework to use if you want to do the modeling in XML or Java. Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.5.x and java 1.4.x
>> The only thing needed to run on 1.4 is the compatibility package, which >> contains a few class files that are standard in the 1.5 JRE but have to >> be downloaded separately for 1.4. > > It's not class files it contains: it's xml and jmx jars. I haven't quoted out of > context: I know the details. And just maybe there may be class files in the jar files? Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Avoid duplication of database settings
Sorry about the "antispammed" subject in my previous post. >>> I have an application consisting of a web application and some stand >>> alone java clients. Both the web application and the java clients use >>> a database. The problem is that the database configuration is >>> duplicated. > >> If you are doing it the ant way I recommend using filtering. > > Thanks for the suggestion. I will have a look at it. > >Do you know if frameworks like Spring or Hibernate solves this kind of problems? I don't know about spring but in hibernate there is one configuration file that you can share between webapp and standalone clients. (Using it in my current project.) If you only use Hibernate to access your database you will be fine. It is also possible to get the DataSource from the hibernate configuration if you want to access the database directly (for performance reasons). I have some SQL scripts that need the database info so I use filtering anyway both as a way to have the configuration values in one place and as a way to easily build for different environments. Regards, Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [SPAM] - Re: Avoid duplication of database settings - Number of numbers in MIME From exceeds maximum threshold
>>> I have an application consisting of a web application and some stand >>> alone java clients. Both the web application and the java clients use >>> a database. The problem is that the database configuration >>> is duplicated. > >> If you are doing it the ant way I recommend using filtering. > > Thanks for the suggestion. I will have a look at it. > >Do you know if frameworks like Spring or Hibernate solves this kind of problems? I don't know about spring but in hibernate there is one configuration file that you can share between webapp and standalone clients. (Using it in my current project.) If you only use Hibernate to access your database you will be fine. It is also possible to get the DataSource from the hibernate configuration if you want to access the database directly (for performance reasons). I have some SQL scripts that need the database info so I use filtering anyway both as a way to have the configuration values in one place and as a way to easily build for different environments. Regards, Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat IIS-redirector help
> Curious though, I think you mentioned that you added the isapi filter to the web > sites container, on not the web site itself, is this correct? Yepp - I think you should be able to do it either way. If you want the filter to be active for all your web sites you can add it at the top level. That's the way I have done it. Maybe it doesn't work if you add it directly on the website itself? Fredrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat IIS-redirector help
Hi, > I had not added the DLL to the web services extension section until I read your > email, however I am still having the same problem. Can someone tell me how to > verify that I can execute /Jakarta/isapi_redirect.dll from my vhost? > (http://hostname/jakarta/isapi_redirect.dll) <---is this right? > No - you should set up a web site in IIS that uses the ISAPI filter to talk to Tomcat. > Is there something that perhaps I did not configure somewhere else that could be > causing this problem? Probably. I did this recently and followed the guide here: http://tomcat.apache.org/connectors-doc/howto/iis.html . There are several steps to do. Steps that comes to mind: - In your web site in IIS you need a virtual directory that is called "jakarta" that is mapped to the directory where JK is installed. - Your web site of "Web sites" should have the ISAPI filter installed. - JK uses 2 property files that is defined in the registry. If you used the installer for JK this should be no problem. Otherwise you need to enter stuff in the registry. The file called uriworkermap.properties should contain the mapping you need to talk to in Tomcat. - The only part that isn't documented is the one you just managed to do regarding the "Web Services Extensions". All the details is in the official documentation for JK. Follow the link and good luck with the tweaking. Regards, Fredrik Rubensson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JasperException: No tag "xhtml" defined in tag library associated with uri "urn:jsptagdir:/WEB-INF/tags
Hi, I don't know anything about this xtags taglib you seem to be using so just take the following comments for what they are > org.apache.jasper.JasperException: No tag "xhtml" defined in tag library > associated with uri "urn:jsptagdir:/WEB-INF/tags" I would say this means that we are missing a file called tags in the WEB-INF directory of the webapp. The gile is supposed to define the tag xhtml. The reason we get this is the first line in the jspx file: > > I have tried downloading the xtags and adding them to the WEB_INF folder in the > ROOT directory but this has not helped. Any assistance would be greatly > appreciated. Your url to the app seem to suggest that the webapp is called viewscast. You should add the file to /vieewscast/WEB-INF/ rather than .../ROOT/WEB-INF/ . And then there seem to be a conflict between the name of the taglib. The exception misses "tags" while you are downloading "xtags". May be one of those silly things... Hope this helped, Fredrik Rubensson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: jsp cannont find my bean class
Hi, > Where to place the jsp file? It can be in any directory under you webapp. Typically you place it in the root directory of your app. So if your app is called "mygoodapp" the jsp can be placed in /webapps/mygoodapp/ or any subdirectory. If it is called jsppage.jsp you can access it with http://localhost:8080/mygoodapp/jsppage.jsp assuming that you have a default installation of tomcat. Regards, Fredrik Rubensson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [SPAM] - Avoid duplication of database settings - Number of numbers in MIME From exceeds maximum threshold
Hi, > I have an application consisting of a web application and some stand alone java > clients. Both the web application and the java clients use a database. The > problem is that the database configuration is duplicated. > > When I change the database settings, I have to reconfigure both the webapp > (META-INF/context.xml) and the java clients (mydatabasesettings.properties). > > I'd like to avoid this duplication. One possible solution would be to generate > the context.xml based on mydatabasesettings.properties with an Ant script. Are > there any better solutions? If you are doing it the ant way I recommend using filtering. There is a task called filter (see http://ant.apache.org/manual/CoreTasks/filter.html). You put the values you want to use at several places in its own property file for example dbname=mydb, in the places you want to insert it you go @dbname@ instead of the actual name. When you run the filter task all values in the filter property file is put in its correct places. (I use this now to build for different environments. One property file for development, one for test and one for production. But in you case you onle need on file I guess.) If you are using Maven there is some more support for filtering although the ant task still needs to be called explicilty. Regards, Fredrik Rubensson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
IIS connector (JK-1.2.15) fails to call Tomcat - returns 404
bc' [Tue Jan 03 08:24:15 2006] [1444:3060] [debug] jk_uri_worker_map.c (486): Found an exact match ajp13w -> /vbc [Tue Jan 03 08:24:15 2006] [1444:3060] [debug] jk_isapi_plugin.c (845): check if [/vbc] is points to the web-inf directory [Tue Jan 03 08:24:15 2006] [1444:3060] [debug] jk_isapi_plugin.c (863): [/vbc] is a servlet url - should redirect to ajp13w Any help would be highly appreicated. Regards, Fredrik Rubensson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]