여러가지 경우에 이 메세지가 뜰 수 있으나
이번 경우는
dbcp파일을 tomcat/common/lib 폴더에 두지 않아 생긴 문제
struts-config.xml 파일에서 data-source설정 부분에서
org.apache.commons.dbcp.BasicDataSource 를 찾지 못한것이다.
사소한거라 잊기 쉬우니 항상 기억하자.
'분류 전체보기'에 해당되는 글 117건
- 2007.07.05 404 - Servlet action is not available
- 2007.07.02 LinuxFedoraCore6 + Apache2.2 + Tomcat5.5.23 + JDK1.6.0_01
- 2007.06.30 How to Install Java in Fedora Core 6 - Java Runtime Environment
- 2007.06.27 error while loading shared libraries
- 2007.06.01 javax.servlet.ServletException: You have an error in your SQL syntax;
- 2007.05.31 HTML 객체 계층도
- 2007.05.29 Vector or ArrayList -- which is better?
- 2007.05.29 IDE 대세는 넷빈즈..
- 2007.05.29 NullPointerException...
- 2007.05.28 warning: unmappable character for encoding MS949 1
LinuxFedoraCore6 + Apache2.2 + Tomcat5.5.23 + JDK1.6.0_01
1.리눅스 설치
공짜인 fedora core6란 놈으로 설치결정.
무조건 yes yes로 설치 종료-_-
2.아파치 설치
http://httpd.apache.org/download.cgi 이곳에서
httpd-2.2.4.tar.gz 라는 녀석을 다운받는다.
/usr/local/ 로 파일을 옮기고 압축을 푼다.
shell> tar zxvf httpd-2.2.4.tar.gz
압축을 푼 디렉토리로 이동
shell> cd httpd-2.2.4
설치를 한다.(과정에 대한 자세한 사항은 모르겠음ㅠ)
shell> ./configure --prefix=/usr/local/apache2 \(아파치가 설치될 디렉토리)
> --enable-rule=SHARED_CORE \(톰캣연동시 필요하다고..)
> --enable-modules=so \(역시 톰캣연동에 필요.)
> --enable-so (php연동시 필요하다고 한다.)
(사실 나는 첫째 줄 옵션만 적용..;;)
shell> make
shell> make install
설치 완료
shell> service httpd start 또는
shell> /usr/local/apache2/bin/apachectl start
로 아파치를 구동한다..
위, 아래 방법의 차이는 나도 모르겠다.
어떻게 service명령어로 실행이 가능한지도.. 아.. 공부해야하나 리눅스..ㅠ
가시적인 차이라면 service로 구동시키면 OK 라는 메세지를 날려주시는데
apachectl은 아무런 반응도 안보이신다. 리눅스께서..
3. JDK설치
http://java.sun.com/javase/downloads/index.jsp
이곳에서 jdk를 다운받는다.(jdk-6u1-linux-i586.rpm.bin)
페도라5에서 jdk를 rpm으로 깔게되면 경로상의 문제가 많이 발생한다는 글을
돌아다니다 본적이 있는데.. 페도라6에서는... 문제 없는듯하다.
다음,
/usr/local/ 디렉토리에 위치시킨후 실행이 가능하도록 권한을 변경한다.
shell> chmod 755 jdk-6u1-linux-i586.rpm.bin
그다음은 설치~
shell> jdk-6u1-linux-i586.rpm.bin
(중간에 y눌러서 라이센스에 동의해준다.)
그다음 파이어 폭스의 플러그인에서 사용하는 java의 링크를 변경한다
shell> ln -s /usr/java/jdk1.6.0_01/jre/plugin/i386/ns7/libjavaplugin_oji.so \
> /usr/lib/mozilla/plugins/libjavaplugin_oji.so
다음은 패스 설정
shell> vi /etc/profile
내용중에 적당한 위치에 다음 구문을 추가
export JAVA_HOME=/usr/java/jdk1.6.0_01
export JRE_HOME=/usr/java/jdk1.6.0_01/jre
다음은 버전확인
shell> java -version
java version "1.6.0_01" 처럼 나오면 완료.
하지만 1.4.2버전으로 나왔는데 그이유는
alternatives에서 java가 manual mode로
1.4.2버전 디렉토리를 링크로 삼고있어서 그렇다고 한다.
(fedora에 포함된 기본 자바 버전)
이럴땐 다음과 같이 해준다.
shell> alternatives --auto java
or
shell> alternatives --confige java 입력후
출력되는 경로중에 알맞은 것을 선택!
4. 톰캣 설치
http://tomcat.apache.org/download-55.cgi 이곳에서
5.5.23버전을 받는다. (core라고 되있는녀석)
apache-tomcat-5.5.23.tar.gz라는 녀석을
역시 /usr/local/로 이동시킨후
푼다.
shell> tar zxvf apache-tomcat-5.5.23.tar.gz
디렉토리 이름이 너무 길어서 맘에 안든다.
심볼릭 링크를 한다.
shell> ln -s apache-tomcat-5.5.23 tomcat
그다음은..
usr/local/tomcat/conf/context.xml을 텍스트 편집기로 열어서 다음과 같이 수정.
<Context reloadable="true">
usr/local/tomcat/conf/server.xml를 텍스트편집기로 열고,
<Host name="localhost"... 처럼 시작되는 곳 밑에 아래내용을 추가한다.
<Context path="" docBase="" debug="0" allowLinking="true"/>
<Listener className="org.apache.catalina.startup.UserConfig" directoryName="public_html" userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
usr/local/tomcat/conf/web.xml 을 열고
다음과 같은 부분을 찾아 주석을 해제한다.
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>org.apache.catalina.servlets.InvokerServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
이부분도 주석해제
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
(이 부분은 확실히.. 아무생각없이 따라했다..)
5. 커넥터 설치
이거 아직도 잘 모르겠다..
By default, Fedora Core 6 systems come with an old Java software installed, so you need to install a newer version of Java Runtime Environment to enjoy all the Java applications out there. In this quick guide, I will teach you how to update/install your Java Environment.
Let's begin by downloading the latest version of JRE (Java Runtime Environment) from here. Just click on the Download link where it says Java Runtime Environment (JRE) 5.0 Update, then you’ll need to accept the license and download the Linux self-extracting file.
WARNING: Please remember to always replace the xx from the jre-1_5_0_xx-linux-i586.bin file with the latest version. At the moment of this guide’s writing, the latest version was 09, so the file should look like this: jre-1_5_0_09-linux-i586.bin
After you have finished downloading the file, you need to move it into the /opt folder. Open a console and type:
mv jre-1_5_0_xx-linux-i586.bin /opt
Now, you will need to make this file executable so you can extract it. Follow the commands below:
cd /opt - so you can go into the /opt directory
chmod +x jre-1_5_0_xx-linux-i586.bin
And now, let's run the executable file with the following command:
./jre-1_5_0_xx-linux-i586.bin
You'll be prompted with the License Agreement, hit space until you are asked if you agree or not. Type Yes and the extraction process will begin. After the extraction process is finished, just remove the binary file with the following command:
rm -rf jre-1_5_0_xx-linux-i586.bin
Now, let's put the Java plugin into your browser's plugin folder. Konqueror, Firefox and Mozilla browsers will all look into the same folder, for plugins. So type the following command:
ln -s /opt/jre1.5.0_xx/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so
Well, now you need to make the Java executable available for the whole system, so you can run all the Java applications you encounter. Create the following file with your preferred text editor:
kwrite /etc/profile.d/java.sh
Now paste the following options into the file, remember to enter a carriage return after these lines, then save it. Remember to replace the xx with the latest version you have downloaded:
export J2RE_HOME=/opt/jre1.5.0_xx
export PATH=$J2RE_HOME/bin:$PATH
Now, type the following command to make that file available:
source /etc/profile.d/java.sh
Then type this command to see if the path is correct:
which java
You will see something like this: /opt/jre1.5.0_09/bin/java
Then type these commands:
/usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.5.0_xx/bin/java 2
/usr/sbin/alternatives --config java
After you have entered the last command, you'll be asked to choose which Java software you want for your system. Just press 2 key and hit enter.
And finally, just type this command to see if everything looks good and your system has a new Java Environment:
/usr/sbin/alternatives --display java
And you can also type this command to see the version of your Java Runtime Environment:
java -version
Mine looks like this:
java version "1.5.0_09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)
Java HotSpot(TM) Client VM (build 1.5.0_09-b01, mixed mode, sharing)
You should now be able to run most of the Java applications out there, with the commands like:
java -jar application.jar
or
javaws application.jnlp
Enjoy!
해결책은...
root>#yum install libstdc++.so.5
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=5' at line 1 org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=5' at line 1 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941) com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623) com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715) com.mysql.jdbc.Connection.execSQL(Connection.java:3243) com.mysql.jdbc.Connection.execSQL(Connection.java:3172) com.mysql.jdbc.Statement.executeQuery(Statement.java:1197) org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) myclasses.BbsDAO.getArticle(BbsDAO.java:84) myclasses.BbsDAO.getArticle(BbsDAO.java:71) myclasses.BbsAction.execute(BbsAction.java:49) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
mysql DB에서 rcount는 int(6)으로 되어있다.
그런데 DAO class 예제상의 코드에서는
long rcount = rs.getLong("rcount");
rs.updateLong("rcount", rcount+1);
이처럼 long형으로 처리하고 있다.
그래서 long->int로 바꾸었더니 자알~ 된다!
역시 책에 있는 예제라고 100% 믿을건 못되는 듯 하다.
By Tony Sintes, JavaWorld.com, 06/22/01
(http://www.javaworld.com/javaworld/javaqa/2001-06/03-qa-0622-vector.html)
Answer:
Sometimes Vector
is better; sometimes ArrayList
is better; sometimes you don't want to use either. I hope you weren't looking for an easy answer because the answer depends upon what you are doing. There are four factors to consider:
- API
- Synchronization
- Data growth
- Usage patterns
Let's explore each in turn.
API
In The Java Programming Language (Addison-Wesley, June 2000) Ken Arnold, James Gosling, and David Holmes describe the Vector
as an analog to the ArrayList
. So, from an API perspective, the two classes are very similar. However, there are still some major differences between the two classes.
Synchronization
Vectors
are synchronized. Any method that touches the Vector
's contents is thread safe. ArrayList
, on the other hand, is unsynchronized, making them, therefore, not thread safe. With that difference in mind, using synchronization will incur a performance hit. So if you don't need a thread-safe collection, use the ArrayList
. Why pay the price of synchronization unnecessarily?
Data growth
Internally, both the ArrayList
and Vector
hold onto their contents using an Array
. You need to keep this fact in mind while using either in your programs. When you insert an element into an ArrayList
or a Vector
, the object will need to expand its internal array if it runs out of room. A Vector
defaults to doubling the size of its array, while the ArrayList
increases its array size by 50 percent. Depending on how you use these classes, you could end up taking a large performance hit while adding new elements. It's always best to set the object's initial capacity to the largest capacity that your program will need. By carefully setting the capacity, you can avoid paying the penalty needed to resize the internal array later. If you don't know how much data you'll have, but you do know the rate at which it grows, Vector
does possess a slight advantage since you can set the increment value.
Usage patterns
Both the ArrayList
and Vector
are good for retrieving elements from a specific position in the container or for adding and removing elements from the end of the container. All of these operations can be performed in constant time -- O(1). However, adding and removing elements from any other position proves more expensive -- linear to be exact: O(n-i), where n is the number of elements and i is the index of the element added or removed. These operations are more expensive because you have to shift all elements at index i and higher over by one element. So what does this all mean?
It means that if you want to index elements or add and remove elements at the end of the array, use either a Vector
or an ArrayList
. If you want to do anything else to the contents, go find yourself another container class. For example, the LinkedList
can add or remove an element at any position in constant time -- O(1). However, indexing an element is a bit slower -- O(i) where i is the index of the element. Traversing an ArrayList
is also easier since you can simply use an index instead of having to create an iterator. The LinkedList
also creates an internal object for each element inserted. So you have to be aware of the extra garbage being created.
Finally, in "PRAXIS 41" from Practical Java (Addison-Wesley, Feb. 2000) Peter Haggar suggests that you use a plain old array in place of either Vector
or ArrayList
-- especially for performance-critical code. By using an array you can avoid synchronization, extra method calls, and suboptimal resizing. You just pay the cost of extra development time.
------------------------------------------------------------------------------------
아무래도 가장중요한건
스레드 안전 여부.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /bbs_list.jsp:146 143: //if(p == null) { p = 1; } 144: out.print(p); 145: 146: int mypage = p.intValue(); 147: int currentBlock = (int)Math.ceil(mypage / (double)numPerBlock); 148: Integer tp = (Integer) request.getAttribute("totalPage"); 149: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
root cause
java.lang.NullPointerException org.apache.jsp.bbs_005flist_jsp._jspService(bbs_005flist_jsp.java:318) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
어의없는 실수.. jsp파일을 바로 먼저 실행해서 생긴문제.
action을 거치질 않아서 속성이 setting되지도 않았는데,
jsp를 바로 실행해서 getting하려 했으니 당연히 안될 수 밖에
bbs.do로 접근하여 실행하면 잘된다.(struts-config.xml에서 input 키워드 부분 비우고 나서...)
이걸로 얼마나 해맸던가... 너무 허무하다ㅠ
jsp파일을 run시킬때 이런 워닝이 떴다.
왜 이런 인코딩 에러가 나는지는 모르겠으나...
jsp파일을 싱글컴파일 하고 실행하니 다시 뜨지 않는다..
왜일까 ... 나에겐 멘토가 필요해...