PDA

View Full Version : installing LPS under IDE


javadog
08-08-2003, 10:40 AM
Hi,

I would like to use LPS within Sun ONE Studio. I am not sure about what is the best way to go: to try and run LPS using the S1S Tomcat; or, to create a new Tomcat instance under S1S using the LPS Tomcat, then set the "Target Server" execution property for the WEB-INF to the new instance.

The reason why I want to do this is to use the embedded Pointbase database, and also to use the excellent XML module in S1S.

Thanks,

j-dog

antun
08-08-2003, 11:10 AM
The last person that we know that accomplished this, took the "create a new Tomcat instance under S1S using the LPS Tomcat" route.

However you could easily try downloading the LPS DE Core (i.e. just the lps-v1 webapp), and installing that in the S1S Tomcat instance.

Do you know what version of Tomcat the S1S one is?

javadog
08-08-2003, 11:58 AM
Hi Antun,

From the release notes, it is Tomcat 4.0.1. I hesitate to run it as an external instance, because when I setup the new instance, I have a choice of either minimal changes made by S1S, or the other choice is to make full modifications of the LPS Tomcat. I'm afraid if I do the latter it will break LPS.

How do I just get the LPS DE Core? Is there a "How to?" for installing it in other servlet containers?

As a suggestion, I think it would be nice if Laszlo or somebody could wrap up the LPS DE Core in a Netbeans module (nbm) or Eclipse plug-in to make it easy on us lazy guys...

Thanks for your quick response,

j-dog

antun
08-08-2003, 12:59 PM
Oops! Forgot to give you the DE Core link:

http://www.laszlosystems.com/developers/download/#decore

DE Core install instructions are here:

http://www.laszlosystems.com/developers/download/installation-v1/install-instructions-core.php

And there's lots of good deployment info in the Deployer's Guide:

http://www.laszlosystems.com/developers/learn/documentation/deployers-guide-v1.php

-Antun

pablo
08-08-2003, 01:15 PM
Hi j-dog,

If you already have LPS installed on your machine, the easiest thing to do is:

[list=1]
Go to your Sun ONE Studio IDE.

Right-mouse click on your Tomcat server (typically localhost:8081) and pick "Add Context".

Edit the "Select Web Module" input box to "lps-v1" (this should automatically set the "Context Path" to "/lps-v1"). Click OK when done.

Right-click on the /lps-v1 context and select Properties.

Click on the "docBase" value and change it to where the lps-v1 webapp directory exists. Since you installed Laszlo w/Tomcat, the lps-v1 webapp directory will exist under "webapp" directory under the Laszlo Tomcat. Close the window when you're done.

Restart your S1S Tomcat server.

When you're done with these steps, you should be able to use lps-v1 by going to http://localhost:8081/lps-v1/.
[/list=1]

pablo

javadog
08-08-2003, 02:15 PM
Hi pablo,

I was able to get it to work by registering the LPS Tomcat server running at 8080 and then adding the context (I believe adding the server did this automatically for me, because I have several contexts that were created).

However, trying to create a context on the Internal Tomcat fails. Here is a stack trace; perhaps it has to do with the load order of some library class?

2003-08-08 14:55:48 StandardWrapper[/lps-v1:default]: Loading container servlet default
2003-08-08 14:55:49 default: init
2003-08-08 14:55:49 jsp: init
2003-08-08 14:55:49 StandardContext[/lps-v1]: Servlet /lps-v1 threw load() exception
javax.servlet.ServletException: Servlet.init() for servlet jsp threw exception
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:871)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3267)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:3384)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:612)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:307)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:388)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:505)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:776)
at org.apache.catalina.startup.Catalina.execute(Catal ina.java:681)
at org.apache.catalina.startup.Catalina.process(Catal ina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:243)
----- Root Cause -----
java.lang.ClassCastException

Now I just need to figure out how to get Pointbase working with the context, but I'll save that for a later post.

Thanks,

j-dog

pablo
08-08-2003, 02:59 PM
Hi j-dog,

I can't seem to replicate the stack trace. Can you tell me how you installed the context and which version of Sun ONE Studio you're using?

Thanks,
pablo

javadog
08-08-2003, 03:15 PM
Hi pablo,

I installed it just as you instructed.

I am using SOS v.4 update 1, which was the last supported version before Sun discontinued the CE version.

I am running JDK 1.4.1 under SOS, but I configured LPS to use JDK 1.4.2. Perhaps that has something to do with it?

Any way, I am happy with getting the external LPS Tomcat instance to work and can add or use contexts that way. I almost have the Pointbase working, except that the SQL connection is using the Tomcat admin user to make the connection, instead of the Pointbase user. I think I can add the Pointbase user to the Tomcat user db, but I'm not sure what role to use. Let me know if you know the answer to that, otherwise I will post a follow-up later when I figure it out...

Thanks again,

j-dog

javadog
08-08-2003, 03:39 PM
I got it working, it was quite simple really, just need to pass the username and password in the connection string. Here is the code:

<%-- getcontacts.jsp --%>

<%@ page import="java.sql.*"%>
<phonebook>
<%
Connection connection = null;
try {
Class.forName("com.pointbase.jdbc.jdbcUniversalDriver");
connection = DriverManager.getConnection("jdbc:pointbase:server://localhost/contact", "PBPUBLIC", "PBPUBLIC");
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select * from contact");
while (rs.next()) {
%>
<contact firstName="<%= rs.getString("first_name")%>"
lastName="<%= rs.getString("last_name")%>"
phone="<%= rs.getString("phone")%>"
email="<%= rs.getString("email")%>"
/>
<%
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
}
}
%>
</phonebook>

pablo
08-08-2003, 03:56 PM
Hi j-dog,

Sorry, I was using SOS 5 SE and adding a context just worked for me. I was looking around for your version of SOS, but couldn't find it anywhere to download and test. It's possible it could've been an issue with the class loader.

I'm glad you were able to get LPS running and interfacing with Pointbase!

Thanks,
pablo