Compiler problems with J2EE

Hi,
I�am only new to the J2EE platform but have experience with J2SE. I have installed J2EE 1.4 and Tomcat server 5.0.28 to study for the Web Component Developer Exam.
When I go to compile my java files, the compiler doesn�t not recognise the J2EE parts of the file. I have imported the correct classes (even the import statements, it doesn�t recognise!) and when I compile, the errors are associated with J2EE classes (i.e. doesn�t recognise HttpServlet....)
I compile in command prompt by typing: javac myFile.java.
I am aware that the file servlet-api.jar is required for these J2EE extras when compiling and I think this is my problem. I have put the location of this file on my classpath (set classpath=.;C:\fileDir\servlet-api.jar) by it still fails to compile. I have also put this location of the file directly into my PATH by this doesnt help!
Can anybody help me out with this configuration problem?
Thanks very much for any help!

You need to have j2ee.jar (which can be found in <j2ee_install_dir>/lib directory in your classpath in order to successfully compile.

Similar Messages

  • Urgent! Serious problem with J2EE Classloader!

    Hi all,
    I'm having a serious problem with j2ee Classloading.
    I have "inherited" a J2EE application where all business classes (invoked by the EJB) are placed in the Application's Server classpath (Weblogic 8.1.4).
    Very bad because every time a class is changed the a.s. must be restarted.
    So I re-enginereed the package putting the business classes in a jar that is referenced by the EJB's MANIFEST file.
    This way all the classes would be loaded by the EJB classloader and no need to start/stop weblogic.
    Unfortunately it's not such !! I discovered that all business classes are loaded via REFLECTION
    Object objCommand = objClass.newInstance();
    Object[] param = new Object[1];
    param[0] = aDataContainer;
    objDataContainerReturn = (DataContainer) objMethod.invoke(objCommand,param);
    and the application server cannot find them using the standard J2EE Classloader mechanism.
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at irma.business.Dispatcher.callService(Dispatcher.java:70)
    Caused by: java.lang.NoClassDefFoundError: irma/utility/log/LogPrintStream
    at irma.business.service.LoginService.login(LoginService.java:79)
    On the other hand they're found if I put the classes on the application server classpath.
    Has anybody got advice for this ? Should I refactor the application giving up reflection ?
    Thanks a lot in advance.

    Reflection uses the classloader as well so it should work fine.
    A common cause of a NoClassDefFoundError is something in a parent classloader that refers to something only available in a child loader.
    For instance, do you have any of your application classes which are in the $CLASSPATH but reference something that is only (now) in the business.jar in your ear?
    -- Rob
    -- Rob
    WLS Blog http://dev2dev.bea.com/blog/rwoollen/

  • Compilation problem with templates while using option -m64

    Hi,
    I have compilation problem with template while using option -m64.
    No problem while using option -m32.
    @ uname -a
    SunOS snt5010 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5220
    $ CC -V
    CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
    Here is some C++ program
    ############# foo5.cpp #############
    template <typename T, T N, unsigned long S = sizeof(T) * 8>
    struct static_number_of_ones
    static const T m_value = static_number_of_ones<T, N, S - 1>::m_value >> 1;
    static const unsigned long m_count = static_number_of_ones<T, N, S - 1>::m_count + (static_number_of_ones<T, N, S - 1>::m_value & 0x1);
    template <typename T, T N>
    struct static_number_of_ones<T, N, 0>
    static const T m_value = N;
    static const unsigned long m_count = 0;
    template <typename T, T N>
    struct static_is_power_of_2
    static const bool m_result = (static_number_of_ones<T,N>::m_count == 1);
    template <unsigned long N>
    struct static_number_is_power_of_2
    static const bool m_result = (static_number_of_ones<unsigned long, N>::m_count == 1);
    int main(int argc)
    int ret = 0;
    if (argc > 1)
    ret += static_is_power_of_2<unsigned short, 16>::m_result;
    ret += static_is_power_of_2<unsigned int, 16>::m_result;
    ret += static_is_power_of_2<unsigned long, 16>::m_result;
    ret += static_number_is_power_of_2<16>::m_result;
    else
    ret += static_is_power_of_2<unsigned short, 17>::m_result;
    ret += static_is_power_of_2<unsigned int, 17>::m_result;
    ret += static_is_power_of_2<unsigned long, 17>::m_result;
    ret += static_number_is_power_of_2<17>::m_result;
    return ret;
    Compiation:
    @ CC -m32 foo5.cpp
    // No problem
    @ CC -m64 foo5.cpp
    "foo5.cpp", line 20: Error: An integer constant expression is required here.
    "foo5.cpp", line 36: Where: While specializing "static_is_power_of_2<unsigned long, 16>".
    "foo5.cpp", line 36: Where: Specialized in non-template code.
    "foo5.cpp", line 26: Error: An integer constant expression is required here.
    "foo5.cpp", line 37: Where: While specializing "static_number_is_power_of_2<16>".
    "foo5.cpp", line 37: Where: Specialized in non-template code.
    "foo5.cpp", line 20: Error: An integer constant expression is required here.
    "foo5.cpp", line 43: Where: While specializing "static_is_power_of_2<unsigned long, 17>".
    "foo5.cpp", line 43: Where: Specialized in non-template code.
    "foo5.cpp", line 26: Error: An integer constant expression is required here.
    "foo5.cpp", line 44: Where: While specializing "static_number_is_power_of_2<17>".
    "foo5.cpp", line 44: Where: Specialized in non-template code.
    4 Error(s) detected.
    Predefined macro:
    @ CC -m32 -xdumpmacros=defs foo5.cpp | & tee log32
    @ CC -m64 -xdumpmacros=defs foo5.cpp | & tee log64
    @ diff log32 log64
    7c7
    < #define __TIME__ "09:24:58"
    #define __TIME__ "09:25:38"20c20
    < #define __sparcv8plus 1
    #define __sparcv9 1[snipped]
    =========================
    What is wrong?
    Thanks,
    Alex Vinokur

    Bug 6749491 has been filed for this problem. It will be visible at [http://bugs.sun.com] in a day or two.
    If you have a service contract with Sun, you can ask to have this bug's priority raised, and get a pre-release version of a compiler patch that fixes the problem.
    Otherwise, you can check for new patches from time to time at
    [http://developers.sun.com/sunstudio/downloads/patches/]
    and see whether this bug is listed as fixed.

  • [svn:fx-trunk] 11707: Fix incremental compilation problem with styles.

    Revision: 11707
    Author:   [email protected]
    Date:     2009-11-12 10:52:49 -0800 (Thu, 12 Nov 2009)
    Log Message:
    Fix incremental compilation problem with styles.
    QE notes: None.
    Doc notes: None.
    Bugs: SDK-24173
    Reviewer: Paul
    Tests run: checkintests
    Is noteworthy for integration: No.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-24173
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.java

    You have used elements like header, footer, footer1 and nav without using the correct DOCTYPE declaration. Replace the first line of your code with
    <!doctype html>
    Also have a look here for other problems http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fhome.surewest.net%2Fstorytales%2F test%2Fforposting.html
    After the above has been fixed, please come back here to fix the remaining problem(s)
    Gramps

  • WebSAPconsole - problem with J2EE

    I am trying to install WebSAPconsole (GUI 6.40), but I have some problems with J2EE (SAPJ2EE620C_39-10001433.sar). OS is Win XP Pro Polish.
    After instalation of J2EE I've tried to start dispatcher and server, and next check HTTP service - but there is no listening on 80 port, and there is no listening on p4 port (3011 - because of this no possibility to start visual administrator).
    Dispatcher and server are listening on ports 2055 and 2077, and I have 2 java.exe processes in Task Manager...
    No any other software occupying 80 and 3011 ports.
    Any suggestions?

    Hello vjara,
    I' new to SAP.Could you please tell me where I can find jstartup/trimming_properties = standard in the instance profile.I try to install WS 6.4 sneak preview and I'm getting error,Unable to start SAP J2EE Engine at step 22.I would appreciate for your help and guidance
    Thanks
    Subha

  • Compile problem with javax.sql

    I have upgraded to sdk 1.4.2 and tried to compile my code. I am getting an error on import javax.sql.* where I am getting the message "Package does not exist" error. As the result of this any class that is in this package gets an error as well. I am using ant to do the build. It does not seem to have a problem with the other import files and some of my code do compile fine except for this one that contains javax.sql.*. Thanks for your help.

    Are you sure that the javax.sql.* stuff exists in your javac classpath? It seems not to be there. Look for j2ee.jar (from Sun J2EE SDK), or something like that (something like it probably came with your app server).
    Mike

  • Compiler Problem with double. Need Help

    Hello,
    I am having a problem with WorkShop Compilers 5.0 98/12/15 C++ 5.0. There is a problem with declaring double inside a nested class which is nested 3 times. Below is the code what shows the problem. If you have Workshop 5.0 please cut and paste the program below and do a simple cc <filename> compile. Run it and you should see the problem.
    ---------------------------cut----------------------------
    #include <stdio.h>
    class myclass3
    public:
    myclass3() {}
    ~myclass3() {}
    short aaa;
    int bbb;
    double ccc;
    char ddd;
    class myclass2
    public:
    myclass2() {}
    ~myclass2() {}
    short aaa;
    int bbb;
    double ccc;
    char ddd;
    myclass3 m_myclass3[50];
    class myclass
    public:
    myclass() {}
    ~myclass() {}
    int a;
    char b;
    float c;
    short aa;
    double bb;
    myclass2 m_myclass2;
    int main()
    myclass m_myclass;
    m_myclass.m_myclass2.m_myclass3[1].ccc = 11111.1111;
    printf("<%f>\n",m_myclass.m_myclass2.m_myclass3[1].ccc);
    return 0;
    ---------------------------cut----------------------------
    The result I get on my machine is
    <-3100025845628125216032986949222617505819484589120973946744108811398502585541238252995581839380933130321904775653231251529249013141831370896782391931299571941247444654355877793201472387703486841059940760873131775588361546584668766208.000000>
    This is definitly incorrect. Does anyone have this problem? Is this a compiler bug? If you figure it out please email me at [email protected]
    Thanks
    Salman Ahmad

    Salman - I tested your program on an up to date version of the C++
    5.0 compiler and received the following results:
    a.out<11111.111100>
    That is what I would expect...
    Have you installed all of the patches for the 5.0 compiler? It is
    possible that this problem was found and fixed.
    The current basic patchid's for CC 5.0 on sparc are: 107311-12, 107357-11, and the libC patch for your version of the OS.

  • JSP Compilation Problems With JSTL tags

    My JSP worked well when I used JSP expressions, scriptlets, .... I tried to use JSTL instead and encountered some compilation problems. I am unable to see my mistakes and need help:
    Problme #1:
    int offset = 0;
    try
       <c:set var="offset" value="${requestScope.offset}" />
    catch ( Exception e )
        // do nothing
    }The above code has two compilation errors:
    Generated servlet error:
    [javac] Compiling 1 source file
    illegal start of expression
    <c:set var="offset" value="${requestScope.offset}" />
    ^
    Generated servlet error:
    ';' expected
    <c:set var="offset" value="${requestScope.offset}" />
    ^
    Problem #2:
    <c:set var="threadBean" value="${requestScope.ThreadBean}" />
    int threadID_int = ParamUtil.getParameterInt( request, "thread" );
    <c:if test="${threadBean.threadID} != threadID_int">
        throw new AssertionException( "The two threadID are not the same." );
    </c:if>Generated servlet error:
    illegal start of expression
    <c:if test="${threadBean.threadID != threadID_int}">
    ^

    I have deleted the Java code around the JSTL tags. Now, what is wrong with this <c:if test=" ... "> tag? It seems that I have problems to get JSTL tags right.
    It seems that I have problems to get JSTL tags right....
    <c:if test="${attachBean.attachMimeType.startsWith('image/')}">
         <html:img page="getattachment?attach=<c:out value='${attachBean.attachID}' />" alt="<c:out value='${attachBean.attachFilename}' />" title="<c:out value='${attachBean.attachFilename}' />" border="0" />
    </c:if>error message:
    74: tag = 'if' / attribute = 'test': An error occurred while parsing custom action attribute "test" with value "${attachBean.attachMimeType.startsWith('image/')}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]

  • Compiling problem with 1.4

    my code is compiling well in 1.3 and the same is giving error if i compile with 1.4 compiler. pls help me out. here is the sample code which compiles fine with 1.3 and gives error in 1.4.
    String lv_str_AdvPay = (String).valueOf(lv_db_AdvPay);
    -atthuluri

    my code is compiling well in 1.3 and the same is
    giving error if i compile with 1.4 compiler. pls help
    me out. here is the sample code which compiles fine
    with 1.3 and gives error in 1.4.
    String lv_str_AdvPay =
    (String).valueOf(lv_db_AdvPay);What's the error message? And what's the context of the code - what type is lv_db_AdvPay?
    Regards,
    Bhaveet

  • Compiling Problem With Command Line

    I am facing problem to compile the following class:
    the error code is Like the following :
    Sorry, I was trying to understand the members of a class declaration
    but I got confused when I saw 'var' which is a keyword.var city: String;
    {color:#ff0000}class Address {
    var city: String;
    }{color}
    But when i compile the following class there was no error.
    {color:#339966}class Address {
    attribute city: String;
    }{color}
    Ok I consider that it takes attribute key word.
    But in NetBeans 6.5 The following code is OK
    {color:#339966}class Address {
    var city: String;
    }{color}
    Could Any One tell me where is the problem.
    With Best Regards
    A S M Russel.
    Edited by: Russel8930 on Dec 9, 2008 2:25 PM
    Edited by: Russel8930 on Dec 9, 2008 2:28 PM

    You have two different versions of the compiler on your machine. The right syntax is the one with the var-keyword.

  • Problem with J2EE

    Hi, I am new to Java Enterprise Edition. I am trying to install J2EE 1.3.1 on Win 2000 with service pack 4, and I am getting the following error
    16 bit Windows Subsystem
    c:\WINNT\SYSTEM32\AUTOEXEC.NT. The system file is not suitable for running MSDOS and Microsoft Windows applications. Choose 'Close' to terminate the application.
    Plz help me to solve this problem.

    Open that autoexec.nt and check if it matches with this:
    @echo off
    REM AUTOEXEC.BAT is not used to initialize the MS-DOS environment.
    REM AUTOEXEC.NT is used to initialize the MS-DOS environment unless a
    REM different startup file is specified in an application's PIF.
    REM Install CD ROM extensions
    lh %SystemRoot%\system32\mscdexnt.exe
    REM Install network redirector (load before dosx.exe)
    lh %SystemRoot%\system32\redir
    REM Install DPMI support
    lh %SystemRoot%\system32\dosx

  • Sun ejb tutorial compilation problem with sample code

    I have been trying to follow the ejb tutorial off of Sun's web site. However, I get the following problem when I try to compile the sample code.
    prompt>javac Demo.java
    works fine
    Prompt>javac DemoBean.java
    works fine
    Prompt>javac DemoHome.java
    DemoHome.java:23: cannot resolve symbol
    symbol : class Demo
    location: interface ejb.demo.DemoHome
    public Demo create() throws CreateException, RemoteException;
    ^
    1 error
    Prompt>
    Can anyone help me out as I have tried several books which conveniently skip the part about compiling errors.
    I noticed I don't have a CLASSPATH variable and then i created one with just '.' in it and that didn't work. any help would be appreciated as this is driving me crazy. Thanks.

    try to change the order of the exception.
    first RemoteException and then CreateException

  • Jbuilder compiler problem with xml DOM - please help.

    my problem is that I am using jbuilder 4 professional to compile/run my code.
    However I want to use the XML DOM but jbuilder does not appear to support the necessary packages for use with XML.
    How can I get round this.
    Can I compile instead from the command line - I am using JDK1.4 which supports the java xml packages necessary. Or is there a way of adding the necessary files to my project?
    thanks, B

    Add the required jar files to your project properties->classpath in JBuilder
    The only problem is that. I have been using JBuilder without any problems.

  • Runtime compilation problem with java7

    Since switching from Java 6 to Java 7 our application's memory foot print has increased significantly. Diagnosing the problem lead us to the java compiler. Our application generates, compiles and accesses source code at run-time via the JSR-000199 compiler API. We create a new instance of the compiler and class loader for every compilation, which may be sub-optimal but that is the way it is for now.
    The behaviour we observer is:
    in Java 6 our application uses under 300MB of memory and runs consistent.
    in Java 7 the application uses as much memory as is available, plus a little bit extra outside the heap. For example on a 7.5GB heap on a 8GB system, the java process is killed by oom-killer after allocating over 8.8GB (8GB physical +1 GB swap).
    The main object using up the space is the SharedNameTable object. One of the theories we were throwing around was that between Java 6 to Java 7 a week reference was changed to a soft reference, resulting in object being kept in memory for longer.
    We are looking for any pointers which could explain our observation and maybe even some suggested option to get Java 7 to free up resources and utilise less memory. I fully appreciate that what we are doing is quite non-standard and would like to avoid getting into the reasons of how we got there.

    The reason oom-killer kills my java process is because the process is using more than all the available memory. The system has got 8GB or RAM and 1GB of swap space. I set the heap to 7.5GB and 256MB permgen, leaving me with 256MB for the OS and 1GB of swap space for just in case. I appreciate the Java process will allocate more than the heap and permgen combined, but I didn't expect it to go over by 1.3 GB. Shortly before oom-killer did its job the java process was using around 8.8GB.
    Maybe you can shed some light on how best to size the heap in this configuration.

  • C++5.0 compile problem with STL

    Hi,
    I got the following compiling error, when I am using #include <vector>.
    It looks like it complains one variable declared more than once.
    The following is the program, nothing but include <vector>.
    By the way, I am using C++5.0.
    #include <vector>
    int main() { }
    CC a.cpp
    "/usr/include/iso/wchar_iso.h", line 100: Error: Multiple declaration for mbstate_t.
    "/opt/SUNWspro/SC5.0/include/CC/./iosfwd", line 51: Error: The name mbstate_t is ambiguous, std::mbstate_t and std::mbstate_t.
    "/opt/SUNWspro/SC5.0/include/CC/./iosfwd", line 78: Error: The name mbstate_t is ambiguous, std::mbstate_t and std::mbstate_t.
    "/opt/SUNWspro/SC5.0/include/CC/rw/iotraits", line 56: Error: The name mbstate_t is ambiguous, std::mbstate_t and std::mbstate_t.
    4 Error(s) and 1 Warning(s) detected.
    *** Error code 4

    Hi There,
    Is this problem occurs on solaris 8 with WorkShop 5.0?
    If it does then do you have patch 107311-11 installed?
    I see the same problem reported by other customer where
    this patch had fixed the problem. Please let me know.
    ...jagruti
    SUN - DTS

Maybe you are looking for

  • Windows vista ultimate itunes 7.1.1 VB script error

    I am trying to load i-tunes current version on my windows vista ultimate pc and I keep getting a message which says i-tunes cant install, windows visual basic is turned off, turn on and reinstall? Any one have any ideas. Thanks

  • Adding field to crmd_order

    Hello All, I want to add a Field in  table control in Crmd_order general tab. Please Let me know it is Possible to add, if Possible Let me know how to achieve this Functionality. Thanks, Feroz.

  • After update to 4 I can't login on some website (loop back) or missing web parts

    I have problem with filesonic website as it is not showing the access to the download time. I couldn't register on support.mozilla.com firefox did not submit my registration form. I can't login on some website even if I replace the login with new pas

  • Maintenance mode disapeared

    Hello, I am using SCOM 2012 R2 and the problem is that, if I put an agent in a maintenance mode for more than 24 hours using the specific end time duration. the maintenance mode will disapear automaticaly after some hours !!! How can I solve this pro

  • Sync different audio files from mics and cams

    Hey all, I recently recorded a performance using 2 cams and 2 microphones. Hence, I have 4 audio tracks of the same performance. Is there any function within Logic Pro X that allows me to quickly sync all these tracks, rather than moving them around