Link to home
Start Free TrialLog in
Avatar of tooki
tooki

asked on

create WAR file

How can I create a WAR file for deploying my JSP application.
Do I need to compile my .java file before I create the WAR file?If so, do I include the .java file when creating the war file?
Is there any tutorial?
-tooki
Avatar of kotan
kotan
Flag of Malaysia image

Of course you have to compile your *.java to *.class files and the *.java files are not necessary to be included in the war file.

Here is the command,
under your web application root.

jar cvf webname.war .
notes the dot at the end.

where webname is your web application context name.
Avatar of tooki
tooki

ASKER

Thanks. I still have questions, I do not know how actually it works. I have the WAR file (fastt.war) of a production system. I need to updated one or two of its JSP files. Now I need a test environment where I do the updates and tests. I have installed tomcat web server on my Windows2000 PC. I have put the WAR file (copied from the production system application server) at C:\tomcat\jakarta-tomcat-4.1.24\webapps\fastt.war
Now I restarted tomcat and I can see the directory created C:\tomcat\jakarta-tomcat-4.1.24\webapps\fastt\ and all JSP,class, java etc. files are created under appropriate folders and I can get to the web page on http://localhost:8080/fastt/index.jsp

But here the application does not work. Do I need to have all Java componets (JDBC driver, LDAP, JavaMail etc) available/installed on my tomcat server to make the application work? (The application work ok in the production system with this WAR file).

If so, I do not have JDBC driver and LDAP module installed in my Java environment on my PC. These are there in the application JAVA/JSP codes.
I get these errors when I click through the application on my tomcat server:

org.apache.jasper.JasperException: Name jdbc is not bound in this Context

I have put two questions about LDAP/JDBC installation for my codes to work.These are few lines of my code in a Java file:
import java.util.*;
import java.io.*;
import netscape.ldap.*;
import java.sql.*;
import oracle.jdbc.*;

I have put two questions for the same:

https://www.experts-exchange.com/questions/20770963/JDBC-driver-download.html

https://www.experts-exchange.com/questions/20766900/Cannot-import-netscape-ldap.html

Any help...
thanks.
-tooki
ASKER CERTIFIED SOLUTION
Avatar of kotan
kotan
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tooki

ASKER

The web.xml file that was there inside the WAR file, does not contain any datasource information.The following is the  web.xml file:

**web.xml***
 <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE web-app (View Source for full doctype...)>
- <web-app>
  <display-name>FASTT</display-name>
  <description>FASTT</description>
- <welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  </web-app>
*****

I have seen two files ldapfilt.jar and ldapjdk.jar inside the directory .../webapps/fastt/WEB-INF/lib in my local webserver loaction (after I have put the WAR file there under the .../webapps/ directory.

These two files contain some class files:

C:\>jar tf ldapfilt.jar
netscape/ldap/util/BadFilterException.class
netscape/ldap/util/LDAPFilter.class
netscape/ldap/util/LDAPFilterDescriptor.class
netscape/ldap/util/LDAPFilterList.class
netscape/ldap/util/LDAPIntFilterList.class
netscape/ldap/util/LDAPIntFilterSet.class
com/
com/oroinc/
com/oroinc/text/
com/oroinc/text/regex/
com/oroinc/text/regex/Pattern.class
com/oroinc/text/regex/1.class
com/oroinc/text/regex/2.class
com/oroinc/text/regex/3.class
com/oroinc/text/regex/4.class
com/oroinc/text/regex/MalformedPatternException.class
com/oroinc/text/regex/MatchResult.class
com/oroinc/text/regex/PatternCompiler.class
com/oroinc/text/regex/PatternMatcher.class
com/oroinc/text/regex/PatternMatcherInput.class
com/oroinc/text/regex/Perl5Compiler.class
com/oroinc/text/regex/Perl5Debug.class
com/oroinc/text/regex/Perl5Matcher.class
com/oroinc/text/regex/Perl5Pattern.class
com/oroinc/text/regex/Perl5StreamInput.class
com/oroinc/text/regex/Util.class

C:\>jar tf ldapjdk.jar
netscape/ldap/LDAPAttribute.class
netscape/ldap/LDAPModification.class
netscape/ldap/LDAPAttributeSchema.class
netscape/ldap/LDAPAttributeSet.class
netscape/ldap/LDAPCache.class
netscape/ldap/Timer.class
netscape/ldap/TimerRunnable.class
netscape/ldap/TimerEvent.class
netscape/ldap/TimerEventListener.class
netscape/ldap/LDAPCheckComm.class
netscape/ldap/LDAPCompareAttrNames.class
netscape/ldap/LDAPConnection.class
netscape/ldap/ResponseControl.class
netscape/ldap/LDAPConnThread.class
netscape/ldap/LDAPControl.class
netscape/ldap/LDAPDN.class
netscape/ldap/LDAPEntry.class
netscape/ldap/LDAPEntryComparator.class
netscape/ldap/LDAPException.class
netscape/ldap/LDAPExtendedOperation.class
netscape/ldap/LDAPMatchingRuleSchema.class
netscape/ldap/LDAPModificationSet.class
netscape/ldap/LDAPObjectClassSchema.class
netscape/ldap/LDAPRebind.class
netscape/ldap/LDAPRebindAuth.class
netscape/ldap/LDAPReferralException.class
netscape/ldap/LDAPResourceBundle.class
netscape/ldap/LDAPResponseListener.class
netscape/ldap/LDAPSchema.class
netscape/ldap/LDAPSchemaElement.class
netscape/ldap/LDAPSearchConstraints.class
netscape/ldap/LDAPSearchListener.class
netscape/ldap/LDAPSearchResults.class
netscape/ldap/LDAPSocketFactory.class
netscape/ldap/LDAPSortKey.class
netscape/ldap/LDAPSSLSocketFactory.class
netscape/ldap/LDAPSSLSocketFactoryExt.class
netscape/ldap/LDAPSSLSocketWrapFactory.class
netscape/ldap/LDAPSSLSocket.class
netscape/ldap/LDAPUrl.class
netscape/ldap/LDAPv2.class
netscape/ldap/LDAPv3.class
netscape/ldap/client/JDAPAVA.class
netscape/ldap/client/JDAPFilter.class
netscape/ldap/client/JDAPFilterAnd.class
netscape/ldap/client/JDAPFilterSet.class
netscape/ldap/client/JDAPFilterOr.class
netscape/ldap/client/JDAPFilterNot.class
netscape/ldap/client/JDAPFilterApproxMatch.class
netscape/ldap/client/JDAPFilterAVA.class
netscape/ldap/client/JDAPFilterGreaterOrEqual.class
netscape/ldap/client/JDAPFilterLessOrEqual.class
netscape/ldap/client/JDAPFilterExtensible.class
netscape/ldap/client/JDAPFilterPresent.class
netscape/ldap/client/JDAPFilterEqualityMatch.class
netscape/ldap/client/JDAPFilterSubString.class
netscape/ldap/client/JDAPFilterOpers.class
netscape/ldap/client/JDAPBERTagDecoder.class
netscape/ldap/client/JDAPControl.class
netscape/ldap/client/JDAPMessage.class
netscape/ldap/client/opers/JDAPAbandonRequest.class
netscape/ldap/client/opers/JDAPAddRequest.class
netscape/ldap/client/opers/JDAPAddResponse.class
netscape/ldap/client/opers/JDAPBaseDNRequest.class
netscape/ldap/client/opers/JDAPBindRequest.class
netscape/ldap/client/opers/JDAPBindResponse.class
netscape/ldap/client/opers/JDAPCompareRequest.class
netscape/ldap/client/opers/JDAPCompareResponse.class
netscape/ldap/client/opers/JDAPDeleteRequest.class
netscape/ldap/client/opers/JDAPDeleteResponse.class
netscape/ldap/client/opers/JDAPExtendedRequest.class
netscape/ldap/client/opers/JDAPExtendedResponse.class
netscape/ldap/client/opers/JDAPModifyRDNRequest.class
netscape/ldap/client/opers/JDAPModifyRDNResponse.class
netscape/ldap/client/opers/JDAPModifyRequest.class
netscape/ldap/client/opers/JDAPModifyResponse.class
netscape/ldap/client/opers/JDAPProtocolOp.class
netscape/ldap/client/opers/JDAPResult.class
netscape/ldap/client/opers/JDAPSearchRequest.class
netscape/ldap/client/opers/JDAPSearchResponse.class
netscape/ldap/client/opers/JDAPSearchResult.class
netscape/ldap/client/opers/JDAPSearchResultReference.class
netscape/ldap/client/opers/JDAPUnbindRequest.class
netscape/ldap/ber/stream/BERAny.class
netscape/ldap/ber/stream/BERBitString.class
netscape/ldap/ber/stream/BERBoolean.class
netscape/ldap/ber/stream/BERCharacterString.class
netscape/ldap/ber/stream/BERChoice.class
netscape/ldap/ber/stream/BERConstruct.class
netscape/ldap/ber/stream/BERElement.class
netscape/ldap/ber/stream/BEREnumerated.class
netscape/ldap/ber/stream/BERInteger.class
netscape/ldap/ber/stream/BERIntegral.class
netscape/ldap/ber/stream/BERNull.class
netscape/ldap/ber/stream/BERNumericString.class
netscape/ldap/ber/stream/BERObjectId.class
netscape/ldap/ber/stream/BEROctetString.class
netscape/ldap/ber/stream/BERPrintableString.class
netscape/ldap/ber/stream/BERReal.class
netscape/ldap/ber/stream/BERSequence.class
netscape/ldap/ber/stream/BERSet.class
netscape/ldap/ber/stream/BERTag.class
netscape/ldap/ber/stream/BERTagDecoder.class
netscape/ldap/ber/stream/BERUTCTime.class
netscape/ldap/ber/stream/BERVisibleString.class
netscape/ldap/controls/LDAPEntryChangeControl.class
netscape/ldap/controls/LDAPPasswordExpiredControl.class
netscape/ldap/controls/LDAPPasswordExpiringControl.class
netscape/ldap/controls/LDAPPersistSearchControl.class
netscape/ldap/controls/LDAPProxiedAuthControl.class
netscape/ldap/controls/LDAPSortControl.class
netscape/ldap/controls/LDAPStringControl.class
netscape/ldap/controls/LDAPVirtualListControl.class
netscape/ldap/controls/LDAPVirtualListResponse.class
netscape/ldap/util/DN.class
netscape/ldap/util/RDN.class
netscape/ldap/util/ByteBuf.class
netscape/ldap/util/GetOpt.class
netscape/ldap/util/LDIF.class
netscape/ldap/util/LDIF$LineReader.class
netscape/ldap/util/LDIFAddContent.class
netscape/ldap/util/LDIFAttributeContent.class
netscape/ldap/util/LDIFContent.class
netscape/ldap/util/LDIFDeleteContent.class
netscape/ldap/util/LDIFModDNContent.class
netscape/ldap/util/LDIFModifyContent.class
netscape/ldap/util/LDIFRecord.class
netscape/ldap/util/MimeBase64Decoder.class
netscape/ldap/util/MimeBase64Encoder.class
netscape/ldap/util/MimeEncoder.class
netscape/ldap/errors/ErrorCodes.props
netscape/ldap/errors/ErrorCodes_de.props
netscape/ldap/errors/ErrorCodes_fr.props
netscape/ldap/errors/ErrorCodes_ja.props
com/netscape/sasl/SASLClientCB.class
com/netscape/sasl/SASLClientMechanismDriver.class
com/netscape/sasl/SASLException.class
com/netscape/sasl/SASLGetLanguageCB.class
com/netscape/sasl/SASLInfoClientCB.class
com/netscape/sasl/SASLMechanismFactory.class
com/netscape/sasl/SASLNamePasswordClientCB.class
com/netscape/sasl/SASLOkayCancelClientCB.class
com/netscape/sasl/SASLPasswordClientCB.class
com/netscape/sasl/SASLSecurityLayer.class
com/netscape/sasl/SASLWarningClientCB.class
com/netscape/sasl/mechanisms/SASLExternalMechanism.class
LDAPDelete.class
LDAPModify.class
LDAPSearch.class
LDAPTool.class
LDAPTool$1.class

thanks.
-tooki
tooki, trust me... i think you should use the IDE tools to help you to do such things...
I means, the conventional way (dos prompt) will work, but if you use the development tools to handle those stuffs will make your life easier...

previous i faced the same problem. and when i complied and war it using the dos prompt, my application server just refuse to accept that .war file.

I sugegst you to have a look at the Netbean IDE. Just a clikc button for you to war your files.
Avatar of tooki

ASKER

I have problem to connect to the database from my JSP code.So in any case, I have to specify the connect string to connect to the database server, the database name and user/password. I do not know where I shall specify these info (inside my JSP code or in any file like web.xml in the tomcat web server location).
thanks.-tooki
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial