Creating jar file for entity bean
I am trying to deploy an entity bean..i compiled all the java files and created a dir by name META_INF and copied ejb-jar.xml
and the other two .xml files which are needed to this dir. then using ,ant i tried to create the jar file ,,but it is giving the following error
during the process ..PLs Help me
Buildfile: build.xml
clean:
[delete] Deleting directory D:\ejb\entity\build
[delete] Deleting directory D:\ejb\entity\dist
init:
[mkdir] Created dir: D:\ejb\entity\build
[mkdir] Created dir: D:\ejb\entity\build\META-INF
[mkdir] Created dir: D:\ejb\entity\dist
compile_ejb:
[javac] Compiling 3 source files to D:\ejb\entity\build
jar_ejb:
[jar] Building jar: D:\ejb\entity\dist\Cabin.jar
ejbc:
[java] java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
[java] at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
[java] at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
[java] at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils.java:151)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:139)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:130)
[java] at weblogic.ejbc20.runBody(ejbc20.java:338)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:79)
[java] at weblogic.ejbc.main(ejbc.java:21)
[java] ERROR: java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
compile_webapp:
Total time: 20 second
The Ejb jar file structure for WebLogic server:
META-INF/ejb-jar.xml
META-INF/weblogic-ejb-jar.xml
META-INF/weblogic-cmp-rdbms-jar.xml
Ejb Bean Class
Remote interface
Home interface
Similar Messages
-
Problem while creating JAR file for my swing application
Hi...
Using my swings application I am trying to Run different software�s .
My program is Running fine from command prompt. If I create JAR file
It is giving error like �Failed to load Main-Class manifest attribute from .jar�
Can anybody help me to creating JAR file
Thanks in advance
Cheers
Mallikhi,
User following command
jar-cmf textfile_name.txt Jarfile_name *
here you have to make manifest file
and making jar file you have reach there by command promt
and manifest file have some constraint also as well as format
format are
Manifest-Version: 1.0
Class-path: jar file name which are using in app separed by space
Created-By: 1.5.0 (Sun Microsystems Inc.)
Main-Class: Main class name
and end of file is not have carriage return -
Can anybody tell me how to make the jar file to deploy an EJB in websphere??
There are many ways.
You can use Ant to build your Jar file, but you need to construct your ant build file.
Or make your EJB in an exploded directory structure and then use Jar utility like
jar -cvf xxxx.jar.
or if you are using WSAD, it will construct everything for you. But you need to do some additions in the deployment descriptor. -
Help! How to create Jar file for a packaged class?
Hi!
I am new in jar complexities. I made a swing frame that just prompts a JOptionPane when executed. I accomplished the same using jar without packaging my class SwingTest.
But when i package it, it doesn't run. Can any one tell me how to make jar file of packaged classes and include images in the jar files too!
Really Thanx!Call the Jar from the commandline to see the exceptions thrown.
java -jar <jarFileName> <className> -
Somebody tell me how to create setup file for the software which is made by using java programming. We can create jar file for that purpose but I want to create setup file or exe file.
open source
- izpack (windows, linux, macos) www.izforge.com or org
- nsis.sf.net (winblows only)
commercial
- www.zerog.com 's InstallAnywhere -
Why to make the .jar file of the each bean?
is it necessary?
I am new to EJB.....
expecting kind response.
Thanks.Do you mean, "Why make a *.jar file for each bean?" (sorry, but your question seems like master Yoda's speech)
If that is your question, you don't need to put each bean in a separate jar but group all the ejb in a single jar (all the beans that logically belong to each other -- a module that is). -
How to create a .jar file for the BPEL project
hi all,
how can i create a .jar file for my BPEL project, i am trying to deploy the project but getting an error :
"Error: [Error ORABPEL-10902]: compilation failed [Description]: in "C:\OraBPELPM\integration\jdev\jdev\mywork\Workspace_BPELDemo\BPEL_Report\BPEL_Report.bpel", XML parsing failed because "". [Potential fix]: n/a. "
and when doubel cliking on this error Jdev take me to the beginning of the ".bpel" file.
I 'm really stuck in here i am not able to deploy the process!
Thanks,
RanaRana:
If you haven't already, I would post this question in the BPEL forum. I would expect a much better turnaround there.
Johnny Lee -
Do JNDI look up for entity beans from a session bean in different jars
I have a problem doing entity beans JNDI look up from a session bean which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one jar and
I specify ejb-local-reference-description for session bean, it should work. However,
due to some reason, they have to be in separated packages but still in the same
container. Then question how to do JNDI lookup given entity beans only have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)In weblogic-ejb-jar.xml use jndi-name instead of local-jndi-name in reference-descriptor
element.
"Qiming He" <[email protected]> wrote:
>
I have a problem doing entity beans JNDI look up from a session bean
which is deployed
as a separate package (session.jar) from the entity beans (entity.jar)
I believe if both session bean and entity beans are deployed into one
jar and
I specify ejb-local-reference-description for session bean, it should
work. However,
due to some reason, they have to be in separated packages but still in
the same
container. Then question how to do JNDI lookup given entity beans only
have local
interfaces?
FYI.
1 both session.jar and entity.jar are self-contained. i.e., no deployment
error.
each JNDI name can be viewed from JNDI tree
2. weblogic-ejb-jar.xml for session.jar
<weblogic-ejb-jar>
<description><![CDATA[Generated by XDoclet]]></description>
<weblogic-enterprise-bean>
<ejb-name>PetstoreLogic</ejb-name>
<stateless-session-descriptor>
</stateless-session-descriptor>
<reference-descriptor>
</reference-descriptor>
<jndi-name>PetstoreLogic</jndi-name>
<local-jndi-name>PetstoreLogicLocal</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
3. weblogic-ejb-jar.xml (code snip) for entity.jar
<weblogic-enterprise-bean>
<ejb-name>Account</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<reference-descriptor>
</reference-descriptor>
<local-jndi-name>net.sourceforge.cpetstore/AccountLocalHome</local-jndi-name>
</weblogic-enterprise-bean>
4. if I do
accountLocalHome = (AccountLocalHome) ic.lookup("net/sourceforge/cpetstore/AccountLocalHome");
get error like:
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException:
While trying to look up /app/ejb/net.sourceforge.cpetstore-entity.jar#Account/local-home
in /app/ejb/cpetstore-ejb.jar#PetstoreLogic.; remaining name '/app/ejb/net/sourceforge/cpetstore-entity/jar#Account/local-home'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:869)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:150)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338) -
Need inputs for creating Jar file
Hi All,
I am doing the scenario as file to mail. so here i am using java mappings for sending the file in mail attachment.
as i can see in my system there are already one imported archive exists with name called "java_mappings".
in that i can find 10 to 12 mapings which are used for different interface.
i have tried to export the imported archive to my local system and created the project with same in NWDS.
but here i can not find jar file.
can anyone suggest how can i get jar file for already exist the imported archive.
second option is if i want to create new mappings then how can i get the Jar file.
thanks,
BhaskarHi Bhaskar,
Jar file is an archive which consists of all class files needed by Java mapping. If you have a folder named Java_mapping and you guess that it is being used in different interfaces, then it should have the class files in it... may be the source code is missing...
I will suggest you to export it into your local machine and extract using winzip.. then you might see some file with .class extesnion. Try a tool like frontendplus which will make java code from java class file to get there code..
Now if you are trying to make one for your requirement i would suggest to read the stefan grube blog..
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3414700%29ID1981012450DB01072979760660502867End?blog=/pub/wlg/4774
Also note that the java mapping is just a jar file which has:
1. the com.sap.xpi.ib.mapping.lib.jar (PI7.1) or aii_map_api.jar (PI7.0 or XI3.0) file
2. You java code class file.
Regards
Suraj -
MBeanMaker is not creating Schema folder in JAR file for custom authenticat
I have created a custom authentication provider.I am using following code of build.xml to generate jar file for custom authentication provider
<target name="build.mdf" depends="copyConfigFiles">
<java classname="weblogic.management.commo.WebLogicMBeanMaker" fork="true" failonerror="true">
<jvmarg line="-Dfiles=./build/mili -DMDF=./build/mili/MILIAuthenticator.xml -DcreateStubs=true"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement location="./build/mili"/>
<pathelement location="./lib/weblogic.jar"/>
<pathelement location="./lib/wlManagement.jar"/>
<pathelement location="./lib/jcifs-1.2.0.jar"/>
</classpath>
</java>
</target>
<target name="copySrcFiles" depends="build.mdf">
<copy todir="./build/mili" flatten="true" overwrite="true">
<fileset dir="./src/java">
<include name="**/MILI*.java"/>
</fileset>
</copy>
</target>
<target name="SecurityProviderJar" depends="copySrcFiles">
<java classname="weblogic.management.commo.WebLogicMBeanMaker" fork="true" failonerror="true">
<jvmarg line="-Dfiles=./build/mili -DMJF=./build/MiliSecurityProviders.jar"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement location="./build"/>
<pathelement location="./lib/wlManagement.jar"/>
<pathelement location="./lib/weblogic.jar"/>
<pathelement location="./lib/jcifs-1.2.0.jar"/>
</classpath>
</java>
</target>
Build.xml is running fine without giving any error,but it is not generating schema folder in the jar file.
beacause of that my custom authentication provider is not comming in admin console.
Kindly help me to resolve this.Hi Ramesh,
Try out the following
1) Copy mediator.jar from SOA_HOME>/soa/modules/oracle.soa.mediator_11.1.1 to <MW_HOME>//soa/modules/oracle.soa.ext_11.1.1/classes
2) Goto <MW_HOME>//soa/modules/oracle.soa.ext_11.1.1/classes and run the following command:
a. jar -xvf mediator.jar
3) Now remove the jar file, i.e., mediator.jar from classes folder.
4) Restart the server.
Regards,
Srijith -
Do I need to Create Primary Key Class for Entity beans with Local interface
Do I need to Create Primary Key Class for Entity beans with Local interface?
I have created my entity bean with the wizard in Sun One Studio and it does not create a primary key class for you.
I thought that the primary key class was required. My key is made up of only one field.
Anyone know the answer.
Jimu dont need to create a primary key class for a entity bean.if ur table's primary key feild(int ,float) is a built in or primitive data type,then u dont need one.But if ur table has a primary key field which is non primitive (for example StudentID,ItemID etc)then u have to create a primary key class.
hope this helps :-) -
How to disable cache implementation in 8.1 SP6 for entity beans
How to disable cache implementation in 8.1 SP6 for entity beans
In our production environment, we want to disable cache implementation for entity beans. We are using weblogic 8.1 SP6.
Weblogic cache implementation has been causing many cachefull exceptions so we want that it fetches the data from database everytime instead of cache.Check the "max-beans-in-cache" setting in your weblogic-ejb-jar.xml. The cache full exception, means that a new bean could not be created because of this cache being full.
Nothing to do with fetching from the database directly.
If you really want direct fetches then do not use beans at all. Consider using direct JDCB/SQL calls (without a entity bean) to fetch huge data.
Let's again review your application based on the below explanation before making a decision on which configuration change to perform:
If you truly have many ejbs simultaneously enrolled in transactions, then yes, the cache must be big enough to hold all the instances.
Your cache must have a max size large enough to handle your peak simultaneous transaction load.
Also, try to ask the following query to your application developer. Does every user actually have to have more than one bean in the cache ? Are many of these values read-only reference values that are not updated ?
SOLUTION CHOICE:
1. If you are testing with more number of users simultaneously, then you will need to increase the "max-beans-in-cache" setting in your weblogic-ejb-jar.xml to match the load.
2. If you have few users but still seeing a lot of beans, then consult with your application developer and try to ask the above questions (Does every user have more than......) and based on that try to redesign/tune your application to make it an effective Entity bean model.
3. If you have queries where huge result sets are returned, consider using plain/direct JDB/SQL calls.
Arun -
Error creating jar file in deployment model
I m trying to deploy a new application using JDeveloper 10.1.3.1.0
the project consists of 2 project model(Toplink session ejb session Bean) and viewcontroller(ADF Faces).
Although i have succesfully created once a war file for viewcontroller a jar file for model and an eear file for the application, after a few changes i cannot create the model jar file in a new deployment...
I get the following error
Target platform is Standard J2EE.
java.lang.NullPointerException
at oracle.ide.net.AlikeStrings.packStringArray(AlikeStrings.java:192)
at oracle.ide.net.AlikeStrings.<init>(AlikeStrings.java:445)
at oracle.ide.net.JarIndex.buildIndex(JarIndex.java:574)
at oracle.ide.net.JarUtil.getJarIndex(JarUtil.java:270)
at oracle.jdevimpl.deploy.JarUtil.needToWriteJarFile(JarUtil.java:802)
at oracle.jdevimpl.deploy.JarUtil.writeJarFile(JarUtil.java:642)
at oracle.jdevimpl.deploy.ejb.EjbDeployer.deploy(EjbDeployer.java:64)
at oracle.jdevimpl.deploy.ModulePackager.deploy(ModulePackager.java:139)
at oracle.jdevimpl.deploy.DynamicDeployer.deploy(DynamicDeployer.java:84)
at oracle.jdevimpl.deploy.DynamicDeployer.deploy(DynamicDeployer.java:84)
at oracle.jdevimpl.deploy.J2eeProfileDt$CleanupTransientProfilesDeployer.deploy(J2eeProfileDt.java:71)
at oracle.jdevimpl.deploy.FinalDeployer.deploy(FinalDeployer.java:48)
at oracle.jdevimpl.deploy.AsyncDeployer$1.runImpl(AsyncDeployer.java:67)
at oracle.jdevimpl.deploy.AsyncDeployer$1.run(AsyncDeployer.java:53)
Elapsed time for deployment: 3 seconds
#### Deployment incomplete. #### 26 Απρ 2007 11:38:13 πμI have the same problem!!!! When I deploy a EAR. So, I try file by file (.jar and .war). The jar file is ok but i get this message when I deploy my .war file
---- Deployment started. ---- 5/04/2011 03:48:01 PM
Target platform is Standard J2EE.
java.lang.NullPointerException
at oracle.ide.net.AlikeStrings.packStringArray(AlikeStrings.java:192)
at oracle.ide.net.AlikeStrings.<init>(AlikeStrings.java:445)
at oracle.ide.net.JarIndex.buildIndex(JarIndex.java:574)
at oracle.ide.net.JarUtil.getJarIndex(JarUtil.java:270)
at oracle.jdevimpl.deploy.JarUtil.needToWriteJarFile(JarUtil.java:802)
at oracle.jdevimpl.deploy.JarUtil.writeJarFile(JarUtil.java:642)
at oracle.jdevimpl.deploy.war.WarDeployer.writeWarFile(WarDeployer.java:210)
at oracle.jdevimpl.deploy.war.WarDeployer.deploy(WarDeployer.java:67)
at oracle.jdevimpl.deploy.ModulePackager.deploy(ModulePackager.java:139)
at oracle.jdevimpl.deploy.DynamicDeployer.deploy(DynamicDeployer.java:84)
at oracle.jdevimpl.deploy.DynamicDeployer.deploy(DynamicDeployer.java:84)
at oracle.jdevimpl.deploy.J2eeProfileDt$CleanupTransientProfilesDeployer.deploy(J2eeProfileDt.java:71)
at oracle.jdevimpl.deploy.FinalDeployer.deploy(FinalDeployer.java:48)
at oracle.jdevimpl.deploy.AsyncDeployer$1.runImpl(AsyncDeployer.java:67)
at oracle.jdevimpl.deploy.AsyncDeployer$1.run(AsyncDeployer.java:53)
Elapsed time for deployment: 13 seconds
#### Deployment incomplete. #### 5/04/2011 03:48:14 PM -
How set diff. timeouts for entity beans?
How do i set diff. timeouts for diff. entity beans? Is it in the ejb-jar.xml file? Is this refreshed every time it is accesses?
Hi there,
Although not familiar with all of the App servers on the market, I'd say that you are unlikely to find a timeout value for Entity Beans. Passivation of Entity beans is normally a function of the commit options supported by a specific App server. For example, with Commit Option C an entity bean instance should always be returned to the instance pool after a transaction has completed. You can find details of the various commit options in the EJB specification which you can view or download from:
http://java.sun.com/products/ejb/docs.html
Hope this helps
Amanda
Developer Technical Support
Sun Microsystems
http://www.sun.com/developers -
How can i create Jar file using Eclipse IDE.
Hi Guys
Am new to java. I want convert my project into executable jar file.
In my project am using itext.jar.And some other folder.
already i create jar file.But its not working.only its working 4 modules after that its say file cannot found exception.but the file path is correct.i dont know why its happen.
This is my project folder strutre also
Log:->
src(folder)
logs(folder)
comments(folder)
lib-->itext.jar.
images-->1,gif
properties-->catconfig.properties (file)
now can i create jar file
this code also show error when i run the jar file
And this is my catconfig. properties file
fileName=total_system_log.log
DDSingle=DD_bysingleIP_comment.txt
DDRange=DD_byrange_comment.txt
NDPing=ping_comments.txt
NDFPing=fping_comments.txt
reportFileName=report.txt
moduleFileName=Modules.txt
propFileName=nameDetails.properties
Choice=DDSingle
logFileName=DDSingleIP_10.32.0.2.log
finalReport=FinalReport.txt
logFilePath=\logs\
commentFilePath=\\Comments\\
its very urgent for me . could u pls send my error and u r ideas.
thanks for u r Ansewering.
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.ArrayList;
public class LogReader {
public void getValuesFromFilesOnly(String Choice,String logFileName)
try {
ArrayList commentsList = new ArrayList();
ArrayList tempList = new ArrayList();
String userdir = System.getProperty("user.dir");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String commentDir =ResourceBundle.getBundle("catconfig").getString(Choice);
String commentFilePath=ResourceBundle.getBundle("catconfig").getString("commentFilePath");
String currentdir1 =userdir+logFilePath+logFileName;
StringBuffer strBuff=new StringBuffer();
RandomAccessFile randomFile = null;
RandomAccessFile commentsFile = null;
String tempLine = null;
String commentLine = null;
String catVersion = null;
String finalReport=null;
int colon = 0;
int counter = 0;
boolean startFlag = false;
boolean endFlag = false;
boolean endOfFileFlag = false;
System.out.println("Log file checked----->"+currentdir1);
System.out.println("comments file used--->"+commentDir);
try {
randomFile = new RandomAccessFile(currentdir1, "r");
} catch (Exception e) {
System.out.println("exception@getValuesFromFilesOnly@begin : "+e);
System.out.println("hi test1");
String commentDir1=userdir+commentFilePath+commentDir;
try{
System.out.println("Comment Dir:"+commentDir1);
commentsFile = new RandomAccessFile(commentDir1, "r");
catch (Exception e) {
System.out.println("exception@getValuesFromCommentDirOnly@begin : "+e);
while ((commentLine = commentsFile.readLine()) != null) {
String checkLine = commentLine.substring(commentLine.indexOf("=")+1, commentLine.length());
String message = commentLine.substring(0,commentLine.indexOf("="));
commentsList.add(checkLine);
commentsFile.close();
String startComment = (String)commentsList.get(0);
String endComment = (String)commentsList.get(commentsList.size()-1);
strBuff.append(" CAT LOG REPORT \n\n");
while ((tempLine = randomFile.readLine()) != null) {
if(tempLine.contains("CAT version is :"))
colon = tempLine.indexOf("is :");
catVersion = tempLine.substring(colon+4,tempLine.length());
String version=tempLine;
strBuff.append("Version : "+catVersion+"\n");
System.out.println("catVersion is :"+catVersion);
commentsFile = new RandomAccessFile(commentDir1, "r");
while ((commentLine = commentsFile.readLine()) != null) {
String checkLine = commentLine.substring(commentLine.indexOf("=")+1, commentLine.length());
String message = commentLine.substring(0,commentLine.indexOf("="));
checkLine=checkLine.toLowerCase();
tempLine=tempLine.toLowerCase();
if(tempLine.contains(checkLine))
colon = tempLine.indexOf("info -");
catVersion = tempLine.substring(colon+7,tempLine.length());
strBuff.append(message+" ==> "+catVersion+"\n");
System.out.println(message+" ==> "+catVersion);
tempList.add(message+" ==> "+catVersion);
if (catVersion.contains(startComment)){
startFlag = true;
counter++;
System.out.println("*******startFlag**********"+startFlag);
if (catVersion.contains(endComment)){
endFlag = true;
System.out.println("*******endFlag**********"+endFlag);
if (startFlag == true && endFlag == true){
System.out.println("******************************************");
System.out.println("-------------Successfull completion-------");
System.out.println("******************************************");
startFlag = false;
endFlag = false;
counter = 0;
tempList.clear();
if (startFlag == true && endFlag == false && counter > 1){
System.out.println("******************************************");
System.out.println("---------------Failure after-----:"+tempList.get(tempList.size()-1));
System.out.println("******************************************");
//startFlag = false;
//endFlag = false;
counter = 0;
tempList.clear();
commentsFile.close();
endOfFileFlag = true;
if (startFlag == true && endFlag == false && endOfFileFlag == true){
System.out.println("******************************************");
System.out.println("---------------Failure after-----:"+tempList.get(tempList.size()-1));
System.out.println("******************************************");
startFlag = false;
endFlag = false;
counter = 0;
tempList.clear();
randomFile.close();
System.out.println("hi");
finalReport=ResourceBundle.getBundle("catconfig").getString("finalReport");
savereportFile(strBuff,finalReport);
System.out.println("Report Generated");
} catch (Exception e){
System.out.println("Exception@getValuesFromFilesOnly : "+e);
public void findDetails()
String currentdir1 = ResourceBundle.getBundle("catconfig").getString("fileName");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String userdir = System.getProperty("user.dir");
RandomAccessFile randomFile = null;
StringBuffer strBuff=new StringBuffer();
StringBuffer strBuff1=new StringBuffer();
StringBuffer strBuff2=new StringBuffer();
String tempLine = null;
String catVersion = null;
String timeStr=null;
String nameStr=null;
String startIP="";
String endIP="";
String tempStart="";
String tempEnd="";
String reportFileName="";
String moduleFileName="";
String propFileName="";
int startPos=0;
int endPos=0;
int fromIndex=0;
boolean versionFlag=false;
boolean ndFlag=false;
boolean ddFlag=false;
try {
randomFile = new RandomAccessFile(userdir+logFilePath+currentdir1, "r");
while ((tempLine = randomFile.readLine()) != null) {
if(tempLine.contains("CAT version is :") && !versionFlag)
startPos = tempLine.indexOf("is :");
catVersion = tempLine.substring(startPos+4,tempLine.length());
String version=tempLine;
strBuff.append("version : "+version+"\n");
versionFlag=true;
//System.out.println("version : "+version);
if(tempLine.contains("Inside NetworkDiscoverySlider.jsp"))
ndFlag=true;
strBuff.append("ND start : "+tempLine+"\n");
if(tempLine.contains("Inside NetworkDiscoveryDetails.jsp"))
strBuff.append("ND end : "+tempLine+"\n");
//System.out.println(" ND end : "+tempLine);
if(tempLine.contains("Given IPRange from"))
startPos = tempLine.indexOf("from");
catVersion = tempLine.substring(startPos+5,tempLine.length());
strBuff.append("NDRange : "+catVersion+"\n");
//strBuff.append("NDRange : "+tempLine+"\n");
//System.out.println("NDRange :"+catVersion);
startPos=0;
fromIndex=tempLine.indexOf(":");
endPos= tempLine.indexOf(':', fromIndex+2);
//System.out.println("fromIndex : "+fromIndex+" endPos : "+endPos);
timeStr=tempLine.substring(startPos, endPos);
nameStr=catVersion.replaceAll(" ", "_");
strBuff2.append("ND_"+timeStr+" "+catVersion+" = "+"NDRange_"+nameStr+".log\n");
if(tempLine.contains("inside ByIpAddress.jsp"))
ddFlag=true;
strBuff.append("DD Start : "+tempLine+"\n");
if(tempLine.contains("start_IpAddress:"))
startPos = tempLine.indexOf("start_IpAddress:");
catVersion = tempLine.substring(startPos+16,tempLine.length());
startIP=catVersion;
if(tempLine.contains("end_IpAddress"))
startPos = tempLine.indexOf("end_IpAddress");
catVersion = tempLine.substring(startPos+13,tempLine.length());
endIP=catVersion;
if(endIP.length()==0)
System.out.println("hi5");
strBuff.append("DDSingleIP : "+startIP+"\n");
//strBuff.append("DDSingleIP : "+tempLine+"\n");
//System.out.println("DDSingleIP : "+startIP);
//startPos = tempLine.indexOf(" ");
startPos=0;
fromIndex=tempLine.indexOf(":");
endPos= tempLine.indexOf(':', fromIndex+2);
timeStr=tempLine.substring(startPos, endPos);
strBuff2.append("DD_"+timeStr+" "+startIP+" = "+"DDSingleIP_"+startIP+".log\n");
else
strBuff.append("DDRangeIP : "+startIP + " to "+ endIP+"\n");
//strBuff.append("DDRangeIP : "+tempLine+"\n");
//System.out.println("DDRangeIP : "+startIP + " to "+ endIP);
//startPos = tempLine.indexOf(" ");
startPos=0;
fromIndex=tempLine.indexOf(":");
endPos= tempLine.indexOf(':', fromIndex+2);
timeStr=tempLine.substring(startPos, endPos);
strBuff2.append("DD_"+timeStr+" "+startIP+" to "+endIP+" = "+"DDRangeIP_"+startIP +"_to_"+ endIP+".log\n");
if(tempLine.contains("set percentage completedCount: 100"))
System.out.println("hi...1");
strBuff.append("DD End : "+tempLine+"\n");
//System.out.println("DD End : "+tempLine);
reportFileName=ResourceBundle.getBundle("catconfig").getString("reportFileName");
savereportFile(strBuff,reportFileName);
if(ndFlag)
strBuff1.append("Network Discovery\n");
if(ddFlag)
strBuff1.append("Device Discovery\n");
moduleFileName=ResourceBundle.getBundle("catconfig").getString("moduleFileName");
savereportFile(strBuff1,moduleFileName);
propFileName=ResourceBundle.getBundle("catconfig").getString("propFileName");
savereportFile(strBuff2,propFileName);
} catch (Exception e)
System.out.println("error hi1");
System.out.println("Exception@findDetails : "+e);
public void savereportFile(StringBuffer strBuff,String targetFileName)
try{
String userdir = System.getProperty("user.dir");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String reportFile=userdir+logFilePath+targetFileName;
String fileContent="";
fileContent=strBuff.toString();
//System.out.println("file content : "+fileContent);
FileWriter fileWriter = new FileWriter(reportFile);
if(fileContent!=null)
fileWriter.write(fileContent);
fileWriter.close();
catch(Exception e)
System.out.println("error hi1");
System.out.println("Exception@savereportFile : "+e);
public ArrayList<String> getFileNames()
String reportFile=ResourceBundle.getBundle("catconfig").getString("reportFileName");
String logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
String userdir = System.getProperty("user.dir");
RandomAccessFile repFile=null;
String reportLine = null;
int colon=0;
int fromIndex=0;
int startPos=0;
int endPos=0;
String timeStr="";
String fileName=null;
ArrayList<String> nameList=new ArrayList<String>();
try
reportFile=userdir+logFilePath+reportFile;
repFile = new RandomAccessFile(reportFile, "r");
while ((reportLine = repFile.readLine()) != null) {
if(reportLine.contains("NDRange"))
colon=reportLine.indexOf(" : ");
fileName=reportLine.substring(colon+3, reportLine.length());
fileName="NDRange_"+fileName.replaceAll(" ", "_");
nameList.add(fileName);
System.out.println("fileName : "+fileName);
if(reportLine.contains("DDSingleIP"))
colon=reportLine.indexOf(" : ");
fileName=reportLine.substring(colon+3, reportLine.length());
fileName="DDSingleIP_"+fileName.replaceAll(" ", "_");
nameList.add(fileName);
System.out.println("fileName : "+fileName);
if(reportLine.contains("DDRangeIP"))
colon=reportLine.indexOf(" : ");
fileName=reportLine.substring(colon+3, reportLine.length());
fileName="DDRangeIP_"+fileName.replaceAll(" ", "_");
nameList.add(fileName);
System.out.println("fileName : "+fileName);
repFile.close();
catch(Exception e)
System.out.println("Error@getFileNames : "+e);
return nameList;
public void writeFile(String oldLogName,String newLogName)
try
FileOutputStream writeFile=null;
String line = null;
String userdir = System.getProperty("user.dir");
String reportFile=ResourceBundle.getBundle("catconfig").getString("reportFileName");
String newLogPath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
RandomAccessFile repFile=null;
String reportLine = null;
String tempLine=null;
String prevLine=null;
String nextLine=null;
String target=null;
String tempStr=null;
String startStr=null;
String endStr=null;
int pos=0;
boolean flag=false;
boolean writeFlag=false;
boolean versionFlag=false;
//System.out.println("newLogName : "+newLogName);
newLogPath=userdir+newLogPath;
System.out.println("newLogPath : "+newLogPath);
BufferedReader buffRead = new BufferedReader(new FileReader(oldLogName));
writeFile = new FileOutputStream(newLogPath+newLogName+".log", false);//true-for append mode
DataOutputStream dout=new DataOutputStream(writeFile);
tempStr=newLogName.replace("_", " ");
pos=tempStr.indexOf(" ");
startStr=tempStr.substring(0,pos);
endStr=tempStr.substring(pos+1, tempStr.length());
target=startStr+" : "+endStr;
System.out.println("target ===> "+target);
reportFile=newLogPath+reportFile;
repFile = new RandomAccessFile(reportFile, "r");
while ((reportLine = repFile.readLine()) != null) {
if(reportLine.contains(target))
flag=true;
prevLine=tempLine;
//System.out.println("prevLine *****: "+prevLine);
else
tempLine=reportLine;
if(flag==true)
nextLine=reportLine;
flag=false;
//System.out.println("nextLine *******:"+nextLine);
break;
repFile.close();
if(prevLine!=null && prevLine.length()>0)
pos=prevLine.lastIndexOf(" : ");
prevLine=prevLine.substring(pos+3, prevLine.length());
//System.out.println("prevLine : "+prevLine);
else
System.out.println("Starting line not available for : "+target);
if(nextLine!=null && nextLine.length()>0)
pos=nextLine.lastIndexOf(" : ");
nextLine=nextLine.substring(pos+3, nextLine.length());
//System.out.println("nextLine : "+nextLine);
else
System.out.println("Ending line not available for : "+target);
nextLine=prevLine;
while ((line=buffRead.readLine()) != null) {
if(line.contains("CAT version is :") && !versionFlag)
versionFlag=true;
dout.writeBytes(line+"\n");
if(line.contains(prevLine))
writeFlag=true;
if(line.contains(nextLine))
writeFlag=false;
break;
if(writeFlag)
dout.writeBytes(line+"\n");
dout.writeBytes(nextLine+"\n");
buffRead.close();
System.out.println("done");
catch(Exception e)
System.out.println("Exception@writeFile : "+e.getMessage());
public String folderCheck(String foldName)
File folder=null;
File newFile=null;
String[] folderContent=null;
String tempFileName="";
String newLogName="";
int count=0;
String logFilePath="";
String fileName="";
String feedBackMsg="";
String userdir = System.getProperty("user.dir");
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
fileName=ResourceBundle.getBundle("catconfig").getString("fileName");
folder=new File(foldName);
if(folder.isDirectory())
newLogName=userdir+logFilePath+fileName;
//System.out.println("newLogName : "+newLogName);
newFile=new File(newLogName);
if(newFile.exists())
newFile.delete();
folderContent= folder.list();
if (folderContent != null && folderContent.length>0)
System.out.println("folder has files : "+folderContent.length);
for(int iterate=0;iterate < folderContent.length;iterate++){
if (folderContent[iterate].toLowerCase().contains("system"))
count++;
tempFileName=foldName+"/"+folderContent[iterate];
try
FileOutputStream appendedFile=null;
BufferedReader buffRead = new BufferedReader(new FileReader(tempFileName));
appendedFile = new FileOutputStream(newLogName, true);//true-for append mode
DataOutputStream dout=new DataOutputStream(appendedFile);
String line = null;
System.out.println("writting : "+tempFileName);
while ((line=buffRead.readLine()) != null) {
dout.writeBytes(line+"\n");
buffRead.close();
//System.out.println("done");
catch(Exception e)
System.out.println("Exception@folderCheck : "+e);
if(count==0)
feedBackMsg="syslognotavail";
//System.out.println("System Log(s) not available");
else
feedBackMsg="syslogavail";
//System.out.println(count +" System log(s) avail");
else
feedBackMsg="filesnotavail";
//System.out.println("Files are not in the folder");
else
feedBackMsg="Dirnotavil";
//System.out.println("Directory not exists in the given name");
return feedBackMsg;
public ArrayList<String> loadFileContent(String selectedStr)
//System.out.println("inside loadFileContent()");
String logFilePath="";
String propFileName="";
String line="";
String choice="";
String tempStr="";
int startPos=0;
int endPos=0;
ArrayList<String> timeList=new ArrayList<String>();
String userdir = System.getProperty("user.dir");
try
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
propFileName=ResourceBundle.getBundle("catconfig").getString("propFileName");
propFileName=userdir+logFilePath+propFileName;
BufferedReader buffRead = new BufferedReader(new FileReader(propFileName));
if(selectedStr.equalsIgnoreCase("Device Discovery"))
choice="DD";
else if(selectedStr.equalsIgnoreCase("Network Discovery"))
choice="ND";
while ((line=buffRead.readLine()) != null) {
if(line.contains(choice))
System.out.println(line);
startPos=line.indexOf("_");
endPos=line.indexOf(" =");
tempStr=line.substring(startPos+1, endPos);
System.out.println("tempStr : "+tempStr);
timeList.add(tempStr);
buffRead.close();
catch(Exception e)
System.out.println("Exception@loadFileContent : "+e);
return timeList;
public String getFileName(String timeStr)
System.out.println("inside getFileName");
String logFilePath="";
String propFileName="";
String line="";
String tempStr="";
int startPos=0;
String userdir = System.getProperty("user.dir");
try
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
propFileName=ResourceBundle.getBundle("catconfig").getString("propFileName");
propFileName=userdir+logFilePath+propFileName;
BufferedReader buffRead = new BufferedReader(new FileReader(propFileName));
while ((line=buffRead.readLine()) != null) {
if(line.contains(timeStr))
System.out.println(line);
startPos=line.indexOf(" = ");
tempStr=line.substring(startPos+3, line.length());
System.out.println("tempStr : "+tempStr);
buffRead.close();
catch(Exception e)
System.out.println("Exception@loadFileContent : "+e);
return tempStr;
public ArrayList loadFile()
String logFilePath="";
String moduleFileName="";
String line="";
ArrayList<String> moduleList=new ArrayList<String>();
String userdir = System.getProperty("user.dir");
try
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
moduleFileName=ResourceBundle.getBundle("catconfig").getString("moduleFileName");
moduleFileName=userdir+logFilePath+moduleFileName;
BufferedReader buffRead = new BufferedReader(new FileReader(moduleFileName));
while ((line=buffRead.readLine()) != null) {
moduleList.add(line);
buffRead.close();
catch(Exception e)
System.out.println("Exception@loadFile : "+e);
return moduleList;
public static void main(String[] args) {
System.out.println("Inside main");
//String userdir = System.getProperty("user.dir");
//System.out.println("userdir : "+userdir);
/*ArrayList<String> fileNameList=new ArrayList<String>();
String Choice="";
String logFileName="";
String logFilePath="";
String totalLog="";
String newLog="";
String folderName="";
Choice=ResourceBundle.getBundle("catconfig").getString("Choice");
logFileName=ResourceBundle.getBundle("catconfig").getString("logFileName");
logFilePath=ResourceBundle.getBundle("catconfig").getString("logFilePath");
folderName=ResourceBundle.getBundle("catconfig").getString("folderName");
totalLog=ResourceBundle.getBundle("catconfig").getString("fileName"); */
/*try
//to write the total log
//folderCheck(folderName);
//to find the details in the given log
//findDetails();
//to split the logs accordingly
totalLog=logFilePath+totalLog;
fileNameList=getFileNames();;
System.out.println("FileNameList size = "+fileNameList.size());
for(int i=0;i<fileNameList.size();i++)
newLog=fileNameList.get(i).toString();
writeFile(totalLog,newLog);
//to analyse the logs & to produce reports
//getValuesFromFilesOnly(Choice,logFileName);
}catch (Exception e)
System.out.println(e.getMessage());
}[JSP is used for server validation.
So you need a an application server (like Tomcat or Jboss) to execute your jsp files.
you can create the .war file of your simple jsp application and put it in the server.
then you will have to access your page using a web browser.
the URL will be
http://<ComputerName or IP Address>:<PortNumber>/<WarFileName>/<MainJspPage>
(eg: http://100.100.100.252:8080/SimpleApplication/mainPage.jsp)
-Achyuth
Maybe you are looking for
-
How to dynamically include textelement in smartforms
Hi Experts, I need to print payslip using smartform and need to take the values from pay99_result. I took all the values and filled in the internal table and passed to smart forms, but the requirement is when ever particular wage type is given for an
-
My usb cord was working perfectly earlier today & now when I plug it up to my computer it tells me "Device has malfunctioned" I have tried uninstalling the device & then reconnecting the device .
-
Creating and/or editing a TextEdit document invisibly
I have a script in which the text of a result is set to a new TextEdit document, but that text needs editing prior to displaying the document. As in the following example, I can do the editing invisibly, but creating the initial new document results
-
MS Word 2003 - highlighting problem
Hi, i have a problem with Word 2003, which i have as part of office 03 pro edition. When i drag select some text in it, typing something in doesn't overwrite it, it just sticks the new text in infront of the selection. Pressing backspace also doesn't
-
Embedding Swing Components within Javafx Scene (on a Mac)
Currently I trying to embed swing components into javafx through steps located here: SwingNode The Myth not the reality | In-SideFX Was able to get it working on a PC, however when the packaged jar is run on a mac, I end up with the "Headless excepti