Refreshing Helper Class Files? HELP!

Hi -
          I have a webapplication which has a number of JSP files, HTML pages, and helper .java files. In working with the JSP files, I know that WL will automatically refresh them when they are modified. However, if I'm working with the helper .java files I have to reboot the server in order to see any modifications. Is there a way to automatically refresh these files? Any suggestions as to to good development setups for debugging these things?
          Thanks,
          Robert
          Software Engineer
          Carescience, Inc.
          

In WebLogic 6.x you can hot-redeploy your web-app after you recompile classes in
          WEB-INF/classes.
          Also, for development convinience, you can look at using Resin (http://www.caucho.com) -
          it has an option to automatically compile .java files in WEB-INF/classes and it detects
          any changes to .java files (similar to how JSP works), and recompiles modified source
          files and redeploys web-app if nesessary.
          ROBERT BOND <[email protected]> wrote:
          > Hi -
          > I have a webapplication which has a number of JSP files, HTML pages, and helper .java files. In working with the JSP files, I know that WL will automatically refresh them when they are modified. However, if I'm working with the helper .java files I have to reboot the server in order to see any modifications. Is there a way to automatically refresh these files? Any suggestions as to to good development setups for debugging these things?
          > Thanks,
          > Robert
          > Software Engineer
          > Carescience, Inc.
          Dimitri
          

Similar Messages

  • Reading files from within helper classes

    From within a servlet, I can get the servlet context to get a path to the "web" directory of my project and easily access properties files for my project. If I create another package in my project to hold helper classes that perform some specific function and want to create and/or read from a properties file, I get a path to the bin directory of my servlet container:
    Servlet Path: D:\Documents and Settings\Josh\My Documents\Josh\Projects\ServletSandBox\build\web\
    Helper Class File Path: D:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\test
    I'd like to develop my helper packages as reusable APIs, so they're not tied directly to my project or to a servlet in general, but I'd like the properties files to stay somewhere in my project folder, preferably in the WEB-INF directory with the servlet's own specific properties file.
    I can't figure out the best way to handle this. I wanted to just be able to pass the helper class a String if somebody wanted to specify a filename other than the default filename. Does it make sense to specify a file URL instead? Is there any other way to get the calling servlet's context path without having to pass in a variable?
    Thanks

    It seems that the helper API shouldn't need to be given a path to its own config file. I would like to have code that will load the file regardless of whether or not its in a stand alone java app or a servlet. Whenever the helper API is jarred up and imported into my servlet, it can't find the config file unless it's in the "D:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.14\bin\test" directory. OR, if I use the current thread to get the loader, it will locate it in the "classes" folder, which is the only solution I can come up with that will let me write code to load the file that will work, regardless of its implementation.
    The "project" folder I'm talking about is just the NetBeans "project" folder for the servlet, or the "ServetSandBox" folder in my example. I guess that doesn't really matter in the context of the servlet though.
    So is using the current thread the appropriate way to do this? When you say that code will work if I put the resource in the WEB-INF directory, that seems to only be true if I try to load it from the servlet itself, not the helper class. The helper class doesn't find the resource in the WEB-INF directory.
    Also, I would like to be able to write the default values to a new config file if one doesn't exist. How in the heck do I get a pointer to the "classes" folder, or any other folder that I can also read from using the classloader, so I can write to a new file?

  • Add helper class public parts as used DC in EJB DC

    Hi Experts,
    I have created a JAVA DC project containing the helper classes.
    For this helper classes i have created a Jar file.
    I have also created two public parts
    1) with an option Can be packaged into other build results (e.g. SDAs)
    2) with an option Provides an API for developing/compiling other DCs
    Now i want to use these public parts in my EJB DC.
    I have added the API public part in my EJB DC as build time design time and run time.
    Now when i am getting java.lang.NoClassDefFoundError: for the class defined in JAVA DC helper class.
    Can you help me in resolving this?
    Regards,
    Ashish Shah

    Hi
    I have done following things:
    1) I have a java DC containing helper classes and an EJB DC referring to it.
    2) Now to access this EJB DC, I have created a java command bean DC.
    3) And I am using this command bean Java dc in my WebDynpro application.
    4)  Now for deploying the helper class, I have created a library project.
    5)  To this library project I have added the SDA and API public part of helper class as used dc.
    6)  I have added this java library file as used DC in WebDynpro DC and in EJB DC.
    7)  I have added the library reference to the WebDynpro DC for J2ee server component library DC  As pg.comaptsc~dc_aptjl
    8)  When i checked in Visual admin i could see the Assembly (SDA) helper class jar file.
    In my helper class files, I am getting this warning.
    Checking package reservation
    Warning: Package pg.com.apt.help.cls is not reserved for DC : apt/sc/dc_apthc.
    Now in my webdynpro DC when I refer to the helper class through the EJB, I get this error.
    java.lang.NoClassDefFoundError: pg/com/apt/help/cls/TargetMarket at pg.com.atos.WebModuleProject.FetchSDCDataBean.SearchGTINTMDataEJB(FetchSDCDataBean.java:133) at pg.com.atos.WebModuleProject.FetchSDCDataObjectImpl0.SearchGTINTMDataEJB(FetchSDCDataObjectImpl0.java:119) ... 35 more ; nested exception is: java.lang.NoClassDefFoundError: pg/com/apt/help/cls/TargetMarket
    Can you please guide on what I am missing.
    Thanks in advance.
    Regards,
    Ashish Shah
    Edited by: ashish shah on Dec 18, 2007 3:23 PM

  • Compiling servlet with helper class

    Hello,
    I have to write a very large number of database queries and huge amount of code so I decided to make each helper *.class file for each table.
    Now I have a main servlet that should instantiate each of these helper classes and conduct DB operations:
    //Servlet code
    RescardreservationTable rv = new RescardreservationTable();
    rv.insertInfo();
    RescardPassengerTable rp = new RescardPassengerTable();
    rp.insertInfo();RescardreservationTable.class
    //does DB opsMy problem is that when I try to compile servlet, I get
    insert_data.java:172: cannot find symbol
    symbol : class RescardreservationTable
    location: class insert_data
    RescardreservationTable rv = new RescardreservationTable();
    Could somebody please tell me how I can make servlet locate my java classes that it has to use?
    Thanks,
    Victor.
    Edited by: vic_sk on Dec 9, 2008 9:29 AM

    Ok, looks like it's solved. Just forcing the compiler with -classpath to look for the required class file.

  • Restart application or reload jar-file(class-files)

    hi,
    i write an update service for my application!everytime a update is available, the new jar-file(my application) will be downloaded and replace the old, running jar-file! now i want to restart my application to use not a mix of old and new class-files in the vm!
    is there any possibility for restarting my java vm or is there another way to "refresh the class-files in the vm"?
    thx mseele

    Hi,
    The easiest way is to terminate the jvm (using System.exit), and just have a loop in the script file that starts your application. In that way your application will be restarted when the jvm exits.
    To write a classloader of your own is another, but a lot harder way.
    /Kaj

  • Using Internet Explorer to view .class files

    How can I refresh the class file itself? I've hit Refresh in IE, but it doesn't update the class file.

    Hold down the Shift-key when you press reload.
    How can I refresh the class file itself? I've hit
    Refresh in IE, but it doesn't update the class file.

  • How to bundle java help class into jar file ?

    Hi, all,
    I have some package in my project, with which I have a java help jar file as classpath, when I run my project, I need the jh.jar file in directory /jar/jh.jar.
    Now, I bundled all my class packages into a jar file, my.jar, together with the /jar directory. When i run my jar file with command:
    java -jar my.jar
    It tells me couldn't find javahelp class.
    What shall I do? How can I create my jar file with the jh.jar?
    Thanks in advance.

    I think you'd be better off just adding the jh.jar as
    a classpath argument and running it like that:
    java -classpath /myjavalibdir/jh.jar -jar myjar.jar
    ...otherwise you're stepping into redistribution of
    binary issues licensing-wise. That won't work either; when you run java with the -jar option, it ignores both the -classpath option and the CLASSPATH environment variable. However, it will see jh.jar automatically if you put it in the <path-to-java>/jre/lib/ext directory. But for distribution purposes, it might be simpler just to combime the contents of jh.jar into myjar.jar (if you use Ant, its <jar> task makes that very easy). Or, you can just run it this way:java -classpath myjar.jar;jar/jh.jar MyMainClassBTW, I don't think redistribution is a problem; otherwise how anyone even use JavaHelp?

  • Including helper classes in java proxy jar file

    I must not be using the right header search criteria because I'm sure this question
    has been asked before. In a Web Service File (.jws) I've imported a couple of
    helper classes that function as data transfer objects. I did this to maintain
    consistency with other portions of the application. The Java Proxy jar file generated
    by Workshop does not include these files. Is there a way of including these dependencies
    or do I need to distribute another jar file with my helper classes?

    Hi Naichen,
    I was able to successfully run both the autotype and clientgen Ant task, on the
    WSDL you provided. The code behind those Ant tasks are pretty much what the WebLogic
    Web Services test page run. Are you using WLS 8.1 SP2? If not, you might want
    to try with that version.
    Regards,
    Mike Wooten
    "Naichen Liu" <[email protected]> wrote:
    >
    >
    >
    Hi,
    I am having a warning message when trying to generate java proxy jar
    file on weblogic8.1
    webservice test web app, the message is as follows:
    "Warning Failed to generate client proxy from WSDL definition for this
    service.
    Prescription Please verify the <types> section of the WSDL."
    in the mean time, on weblogic starting terminal, I saw the following
    exceptions,
    C:\DOCUME~1\u252738\LOCALS~1\Temp\wlwproxy37508.jar1533409921\com\ual\www\rcc\cb
    t\schema\modifypnr\AlphaLength4Deserializer.java:36: cannot resolve symbol
    symbol : class FacetUtils
    location: package binding
    weblogic.xml.schema.binding.FacetUtils.checkLengthFacet(__typed_obj,4L);
    ^
    C:\DOCUME~1\u252738\LOCALS~1\Temp\wlwproxy37508.jar1533409921\com\ual\www\rcc\cb
    t\schema\modifypnr\OSIFieldAnonTypeDeserializer.java:36: cannot resolve
    symbol
    symbol : class FacetUtils
    location: package binding
    weblogic.xml.schema.binding.FacetUtils.checkMaxLengthFacet(__typed_obj,69L);
    ^
    C:\DOCUME~1\u252738\LOCALS~1\Temp\wlwproxy37508.jar1533409921\com\ual\www\rcc\cb
    t\schema\modifypnr\AlphaLength2Deserializer.java:36: cannot resolve symbol
    symbol : class FacetUtils
    location: package binding
    weblogic.xml.schema.binding.FacetUtils.checkLengthFacet(__typed_obj,2L);
    ^
    C:\DOCUME~1\u252738\LOCALS~1\Temp\wlwproxy37508.jar1533409921\com\ual\www\rcc\cb
    t\schema\modifypnr\FreeFormAnonTypeDeserializer.java:36: cannot resolve
    symbol
    symbol : class FacetUtils"
    Can anybody help me about this issue? I attached WSDL file, also United
    Airlines
    got an enterprise weblogic license deal with BEA, any help will be highly
    appreciated.
    Thanks!!!
    Naichen

  • How to get info from a .class file at run time? thanks for help

    I need to get methods and properties (variables) from a .class file at run time.
    as u know, javap.exe can do that in an independent way. but i need to get info at run time once the .class or packeges have been changed, javap is not suitable in the case.
    i try to read data directly from .class file but it's hard to know the file format.
    e.g. a class looks like (java file):
    class MyClass extends Frame
    int i0;
    String s0;
    public String getName()
    if the file is compiled to .class file, how to get properties (variables: i0,s0) and methods String getName() from the .class file by an applicaton at run time?
    Doclet is not suitable for speed reason, it is too slow to get right info in right format.
    Thanks for any help, please write a little bit more in detail if you know.

    Use the Java Reflection API. Have a look at the Reflection section of the Java Tutorial located at http://java.sun.com/docs/books/tutorial/reflect/index.html

  • HELP: ClassLoader cannot find .class file

    Hi,everybody:
    I'm working on a project of auto-testing, and need the java.lang.ClassLoader to load the to-be-tested java file.
    It can be simply described as the following code:
    public class tt {
    public static void main(String[] args) throws Exception{
    Class testClass;
    String testClassName="TestExample";
    String path = System.getProperty("java.io.tmpdir");
    URL[] urls = {new URL("file://" + path )};
    ClassLoader testCaseLoader = new URLClassLoader(urls);
    testClass = testCaseLoader.loadClass(testClassName);
    The process is that, put the to-be-tested file to a certain directory, compile it, and finally load it. For example, in the above code, i want to load the class "TestExample".
    But it always report the exception: java.lang.ClassNotFoundException: TestExample .
    Note, cannot put the to-be-loaded .class file in the same directory with the loading-code, or the loading-code will defaultly find the to-be-loaded .class file , and there would be no exception.
    I use jdk6.
    I really cannot figure out the problem. Could anyone help me? Thanks a lot.

    MyCoy wrote:
    To malcolmmc:
    thanks. but what is FQN ?
    Fully Qualified Name
    That is, the class name including the package name. Eg java.lang.Object

  • Beginner: Can't convert a hello.class file into a jar file: HELP PLEASE!!!

    Hi, I created a hello.java file, converted into a hello.class file by using the java 2SDk compiler. The problem is that the hello.class file is in a directory I created: C:\JavaBuilder\hello.class
    I have a problem converting the hello class file into a jar file. I don't know which approach to take. I've looked at tutorials...but I keep getting more confused each time I view the tutorials on creating jar files. Please can someone help..by taking me through a step by step process. Please be explicit and do not leave or assume that I know any details because I'm a new born beginner. Thank you very much, I seriously appreciate it.

    Hi i did as you suggested, only with these exceptions:
    jar -cvf hello.jar C:\JavaBuilder\hello.class
    I did this and got the message: "adding : C:\JavaBuilder\hello.class (in=1150) (out=708) (deflated=38%)"
    The problem is that when I tried to execute the jar file...by typing: " java -jar hello.jar" I received the error message: "Failed to load Main-Class Manifest attribute from hello.jar" Is there any way to correct this problem? please help, thank you.

  • Plz help load class files

    hai forum,
    Plz help me out regarding this trouble.
    I have extracted class files of a jar file into a local directory D:\myClass.
    Now i need to access these class files.I loaded the path D:\myClass using URL ClassLoader.
                                  File file = new File("D:myClass");               
                          URL url = file.toURL();         
                          URL[] urls = new URL[]{url};
                          ClassLoader cl = new URLClassLoader(urls);
                          Class c = cl.loadClass(classname);The rest of the code is for listing the methods of the class file.But the class file is not getting loaded and thus the methods are not listed.
    Has it got anything to do with the way i have extracted and stored the class files?
    Plz help me identify my mistake.
    Thank you.

    Hi, I will borrow this thread to discuss my problem with loading a class file.
    How do you use the class when you have loaded it?
    I'm using this code:
    File file = new File("C:\\Foo\\Foo.class");
    URL url = file.toURL();
    URL[] urls = new URL[]url;
    ClassLoader cl = new URLClassLoader(urls);
    Class c = cl.loadClass(cl.getClass().getName());
    Object o = c.newInstance(); <-- This can't be done, my applet just stops and starts to wait or something. I don't get any exception or anything.
    The class Foo.class has a constructor that's prints some text and a function that can print some other text. Is it possible to call that function in some way?

  • HELP!!! java.lang.ClassFormatError: (Truncated class file)

    Hello all,
    I'm writing a ClassLoader and the funniest things are happening. If I load a compiled class for the first time after compilation everything is ok. Once I change the class and recompile it, it starts putting out java.lang.ClassFormatError: (Truncated class file). If I alter the changes back to normal and recompile. It works again. Is there some sort of buffer which keeps the once loaded class in memory, even after rebooting?
    Please help, I'm at a loss
    Gideon

    hi dmbdmb,
    I got following error when try to run a java code in JBoss.
    15:39:56,696 ERROR [LogInterceptor] Unexpected Error:
    java.lang.ClassFormatError: Thilina (Truncated class file)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
    at com.sun.tools.javac.v8.StringCompiler$Loader.findClass(StringCompiler
    .java:63)
    at com.sun.tools.javac.v8.StringCompiler.executeMethodWithReturnType(Str
    ingCompiler.java:120)
    at cc.aot.qVoice.domain.ejb.qVoiceManager.qVoiceManagerEJB.getVxmlString
    (qVoiceManagerEJB.java:125)
    I use JBoss 3.0.6 and sdk 1.4. In my program, classes are create and load on the fly. Then using Reflection API I called some
    methods in the dynamically created class(this class not
    write into a file and it is taken as a String variable).
    I refferd this url as a guid to write class loader and compiler.(actually same thing i copied
    from there and change it's name Pmat1 to StringCompiler)
    http://forum.java.sun.com/thread.jsp?thread=347467&forum=4&message=1439418
    When I run this as a normal application, it is work well. Then I try to run it in a jboss and it will give the above error.
    In here I Wote some EJBs and struts also and i called the methodds in the StringCompiler(Pamat1) class in a EJB. Thilina is
    the name of the dynamically created calss and StringCompiler is the class that includes the class loader and compiler methods
    as in the above url. qVoiceManagerEJB has a getvxmlString method. Whithin this method
    i called required the methods in the String compiler.
    Can u some body help me. Thanx in advanced for any help.
    anjithalb

  • Beginner: Can't convert a hello.class file into a jar file. Please Help!!!

    Hi, I created a hello.java file, converted into a hello.class file by using the java 2SDk compiler. The problem is that the hello.class file is in a directory I created: C:\JavaBuilder\hello.class
    I have a problem converting the hello class file into a jar file. I don't know which approach to take. I've looked at tutorials...but I keep getting more confused each time I view the tutorials on creating jar files. Please can someone help..by taking me through a step by step process. Please be explicit and do not leave or assume that I know any details because I'm a new born beginner. Thank you very much, I seriously appreciate it.

    Hi!
    first of all, you should use an upper-case character for the first letter of your classes...
    To answer your question :
    1) you must create a directory named "meta-inf" in your directory "C:\JavaBuilder"
    2) then,you must create a file named "manifest.mf" in this directory
    it's like a property file and it must contain this :
    Main-Class: hello
    (don't forget to type <enter> after "hello")
    3) in the directory "C:\JavaBuilder", you can enter the following command :
    "jar cvfM hello.jar meta-inf\manifest.mf hello.class"
    (check jar.exe is in your path)
    4) you can run your jar by the command :
    "java -jar hello.jar"

  • Help - Invalid Class File Format

    Got the following error when I was trying to load a JSP that imports a servlet class:
    2001-08-12 03:17:12 - Ctx( /guestbook ): JasperException: R( /guestbook + /Guest
    Book.jsp + null) Unable to compile class for JSPerror: Invalid class file format
    : C:\tomcat\jakarta-tomcat-3.2.1\webapps\guestbook\WEB-INF\classes\com\zen\guest
    book\GuestBook.class, wrong version: 46, expected 45
    C:\tomcat\jakarta-tomcat-3.2.1\work\localhost_8080%2Fguestbook\_0002fGuestBook_0
    002ejspGuestBook_jsp_6.java:14: Class com.zen.guestbook.GuestBook not found in i
    mport.
    import com.zen.guestbook.GuestBook;
    2 errors
    Apparently the GuestBook class is found but for some reason it couldn't be loaded/compiled by Jasper. Anybody has a clue about the "wrong version" error? Thanks a lot.

    I started with JDK1.4, switched back to JDK1.3 after seeing the error but it didn't help.
    The first line of installation.html says:
    "Tomcat will operate under any Java Development Kit (JDK) environment that provides a JDK 1.1, JDK 1.2 (also known as Java2 Standard Edition, or J2SE) or later platform" - so I assume I don't have to go back to JDK1.2?
    Thanks.

Maybe you are looking for