Web app path syntax

What is the syntax to get the path of a current web app in Java? So that no matter where my webapp is located it will generate the location and I can put images or files that I generate into this location.

What is the syntax to get the path of a current web
app in Java?There isn't one, generally. Suppose for example your web app is inside an EAR file. Then what would the "path" (as in, a directory path) be? It wouldn't be a "path" at all.
You're going about the design all backwards. If you want to have images available, put them in the app's classpath (in the web-inf/classes folder structure) and load them from it using Class.getResource("/some/classpath/based/path/here").
If you want to write files to some directory, make that a configurable entity. The configuration file would be in your classpath, so you can read that and extract the desired path.

Similar Messages

  • How to get the physical path of my web app root context ?

    Hi,
    I used this code to initialize my LOG4J logger.
            System.out.println(Version + "Servlet context path : " + sctx .getContextPath());
            String path = sctx .getRealPath("/");
            fullyqualifiedlog4jpath = path + "log4j.xml";
            File locallogxml = new File(fullyqualifiedlog4jpath);
            if (locallogxml.exists()) {
                initialized = true;
                DOMConfigurator.configure(fullyqualifiedlog4jpath);
                log = Logger.getLogger(Log4j.class.getName());
                log.info(Version + "Logger initialized");
            else {
                System.out.println(Version + "Unable to locate the log4j.xml file");
            }It works perfectly when running the application with the embedded Jdev11 WLS.
    When deploying the application on a standalone WLS server the path is not returned ;-( I get a null value.
    Does someone has three lines of code which get the physical path of my web app root context?
    Yves

    Changed the methiod used to access log4j.xml.
            FacesContext ctx = FacesContext.getCurrentInstance();
            ServletContext sctx = (ServletContext) ctx.getExternalContext().getContext();
            String contextPath = sctx.getContextPath();
            HttpServletRequest  hsr = (HttpServletRequest)ctx.getExternalContext().getRequest();
            String host = hsr.getServerName();
            int port = hsr.getServerPort();
            try
              String urlstring = "http://" + host + ":" + port + contextPath + "/faces/log4j.xml";
              DOMConfigurator.configure(new URL(urlstring));
              log = Logger.getLogger(Log4j.class.getName());
    .....using the URL s OK.

  • Imported web app image file path shows no picture

    I am trying to import a file path into the image (type) field of a web app, but the image does not appear on page. If I go into the web app item, do nothing but click 'update', the image will appear on page.
    I have tried importing using Auto-Detect, Comma delimited (CSV), and Tab delimited with the same result. I have exported the .CSV from Numbers (app), and tried copy/paste into TextEdit for Tab delimited. Text is UTF-8.
    Is there some trick to getting the import of a file path to work? Do I need to escape the "/" in the file path (ie.   /_assets/images/<filename>    to    \/_assets/images/<filename> )?

    As I am still testing this web app, I uploaded an image through dreamweaver, then went to the web app, clicked the 'select image' link next to the Image field, and continued to fill in the other info.
    Once that was done -- so I had one example web app item in the spreadsheet -- I exported the template, filled it in with additional data, and imported in the various ways described. I am only using the one image. http://mainedreamvacation.businesscatalyst.com/specials
    I get this image visible on page, I had to go in and update each web app item. Tedious for testing; impractical otherwise.
    Thanks for your help,
    Tim
    Graphics / Web Specialist
    Adventure Advertising
    29 Commercial Street
    Rockport, Maine 04856
    207-236-8049

  • Help using JMX to Get Context of Deployed Web Apps

    I think this question is more of a JMX question that anything else (like a JNDI question), so I am posting here. If anyone feels this should be posted elsewhere, please let me know.
    I want to be able to get a handle to each deployed web app's context, so that I may get a BasicDataSource from it, then look at the connection attributes inside of that BasicDataSource, i.e., Number of active connections, number of idle connections, etc. for each deployed web app.
    This is the path I am heading down (if there is another way, please let me know). The code below is inside of a JSP running inside of a web app within my Tomcat 5.0.16 server, running JDK 1.4.2.
    Here is the entire JSP...
    <%@ page import="org.apache.commons.dbcp.BasicDataSource,
                     javax.naming.InitialContext,
                     javax.naming.Context,
                     javax.management.ObjectName,
                     javax.management.MBeanServer,
                     java.util.Set,
                     org.apache.catalina.mbeans.MBeanUtils,
                     java.util.Iterator,
                     javax.management.ObjectInstance,
                     org.apache.catalina.core.StandardContext"%>
    <html>
        <head>
            <meta http-equiv="refresh" content="3"> <!-- refresh every 3 seconds -->
        </head>
        <body>
    <%
        //InitialContext ctx = new InitialContext();
        //Context envCtx = (Context) ctx.lookup("java:comp/env");
        String dsName = "";//"jdbc/raptor";
        String appName = "";//(String) envCtx.lookup("appName");
        BasicDataSource ds = null;//(BasicDataSource) envCtx.lookup(dsName);
        MBeanServer mBeanServer = MBeanUtils.createServer();
        ObjectName oname = new ObjectName("*:j2eeType=WebModule,*");
        Set contexts = mBeanServer.queryMBeans(oname, null);
        Iterator it = contexts.iterator();
        while(it.hasNext()) {
            ObjectInstance oi = (ObjectInstance)it.next();
            ObjectName cname = oi.getObjectName();
            System.out.println(">>> cname = " + cname.toString()); // this prints something like this: Catalina:j2eeType=WebModule,name=//localhost/accesstracker,J2EEApplication=none,J2EEServer=none
                Is this the right way to do this??? I seem to be getting the web app, I just want to be able to
                get a handle to that web app's context, get a BasicDataSource from it, then look at the connection
                attributes inside of that BasicDataSource, i.e., Number of active connections, number of idle
                connections, etc. for each deployed web app
            //javax.naming.Context iCtx = (javax.naming.Context) mBeanServer.invoke(cname, "findStaticResources", null, null); // will this do it???
            Object obj = new InitialContext().lookup("java:comp/env"); // this only gets the current context (the web app I'm currently in)
            if(obj != null){
                Context envCtx = (Context) obj;
                appName = (String) envCtx.lookup("appName");
                ds = (BasicDataSource) envCtx.lookup("jdbc/raptor");
            }else{
                System.out.println("obj is null");
    %>      <%=cname.toString()%><br/>
            Application name: <%=appName%><br/>
              Number of Active Connections = <%=ds.getNumActive()%>
            <br/>
              Number of Idle Connections = <%=ds.getNumIdle()%>
            <br/>
              Initial Size of Pool = <%=ds.getInitialSize()%>
            <br/>
              Maximum Number of Active Connections = <%=ds.getMaxActive()%>
            <br/>
    <%
    %>
        </body>
    </html>The above JSP will output all of the info for each deployed web app, however, when it gets to getting the Context of the web app, it simply outputs information repeatedly for the web app this JSP is in (which makes sense since I'm using InitialContext).
    I appreciate any help anyone could provide.
    Thank you

    If you want your application to work only with specific JRE version, you should use static versioning. I installed JRE 1.3.1_15 and JRE 5.0U5 , both of them works successfully. I used the below syntax to load applets:
    for 1.3.1_15:
    <object
        classid = "clsid:CAFEEFAC-0013-0001-0015-ABCDEFFEDCBA"
        codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_15-windows-i586.cab#Version=1,3,1,15"
        WIDTH = 150 HEIGHT = 25 >
        <PARAM NAME = CODE VALUE = "HelloWorld.class" >
        <param name = "type" value = "application/x-java-applet;jpi-version=1.3.1_15">
        <param name = "scriptable" value = "false">
        <comment>
         <embed
                type = "application/x-java-applet;jpi-version=1.3.1_15" \
                CODE = "HelloWorld.class" \
                WIDTH = 150 \
                HEIGHT = 25
             scriptable = false
             pluginspage = "http://java.sun.com/products/plugin/index.html#download">
             <noembed>
                </noembed>
         </embed>
        </comment>
    </object>for 5.0U5
    <object
        classid = "clsid:CAFEEFAC-0015-0000-0005-ABCDEFFEDCBA"
        codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,5"
        WIDTH = 150 HEIGHT = 25 >
        <PARAM NAME = CODE VALUE = "HelloWorld.class" >
        <param name = "type" value = "application/x-java-applet;jpi-version=1.5.0_05">
        <param name = "scriptable" value = "false">
        <comment>
         <embed
                type = "application/x-java-applet;jpi-version=1.5.0_05" \
                CODE = "HelloWorld.class" \
                WIDTH = 150 \
                HEIGHT = 25
             scriptable = false
             pluginspage = "http://java.sun.com/products/plugin/index.html#download">
             <noembed>
                </noembed>
         </embed>
        </comment>
    </object>- Mike

  • Possible to have two login configs in same web app?

    Sorry for not having tried this first, my server and webapp are in a state
    of flux at this moment, but I wanted to see what the consensus is out there,
    not just whether I can or cannot make something work quickly.
    If I have two types of things that might be called in my Web App (WAR) in
    different ways (eg, browser accessing via HTTP by users that want to login
    via pretty forms, and SOAP clients that may access functionality through the
    same servlets (but with alternate Servlet Path Info after the servlet name
    in the URL)), is there ANY way I can have multiple login configs, each tied
    to a different security constraint within that web app?
    In other words, with a servlet of /frazzleblitz and security constraints
    like:
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Foo</web-resource-name>
    <url-pattern>/frazzleblitz/doFooBar</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>FoobarBrowserUsers</role-name>
    </auth-constraint>
    </security-constraint>
    and the SOAP constraint (for all users of incoming SOAP requests):
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Foo</web-resource-name>
    <url-pattern>/frazzleblitz/doFooBar</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>FoobarBrowserUsers</role-name>
    </auth-constraint>
    </security-constraint>
    where my frazzleblitz controller knows whether the incoming request is
    browser vs SOAP based by the path info after the servlet name
    Can I associate the first security constraint with a FORM based login
    config, and the second security constraint with a BASIC AUTH login config
    since I could in theory require SOAP clients to send in credentials in a
    HTTP BasicAuth header, but I can't expect a SOAP client to be HTTP
    Redirected to a login form and then to enter the right credentials into a
    user type form and then be redirected back to an app...
    Seems to me the J2EE Security spec is really lacking in the area of
    programmatic authentication (allowing my SOAP code to get credentials out of
    the request envelope and call an API to login myself). Yeah, WebLogic has
    the ServletAuthentication weak() API, but these apps need to be J2EE
    compliant and work across J2EE servers... Anybody know of any improvements
    coming in the J2EE security space to address such functionality needs?
    Thanks in advance
    Mike

    Sorry, hit send accidentally before finishing the second security
    constraint - I've fixed it up below to reflect what I meant...
    "Mike" <[email protected]> wrote in message
    news:[email protected]...
    Sorry for not having tried this first, my server and webapp are in a state
    of flux at this moment, but I wanted to see what the consensus is outthere,
    not just whether I can or cannot make something work quickly.
    If I have two types of things that might be called in my Web App (WAR) in
    different ways (eg, browser accessing via HTTP by users that want to login
    via pretty forms, and SOAP clients that may access functionality throughthe
    same servlets (but with alternate Servlet Path Info after the servlet name
    in the URL)), is there ANY way I can have multiple login configs, eachtied
    to a different security constraint within that web app?
    In other words, with a servlet of /frazzleblitz and security constraints
    like:
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Foo</web-resource-name>
    <url-pattern>/frazzleblitz/doFooBar</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>FoobarBrowserUsers</role-name>
    </auth-constraint>
    </security-constraint>
    and the SOAP constraint (for all users of incoming SOAP requests):
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Bar</web-resource-name>
    <url-pattern>/frazzleblitz/doSOAPRequest</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>SOAPUsers</role-name>
    </auth-constraint>
    </security-constraint>
    where my frazzleblitz controller knows whether the incoming request is
    browser vs SOAP based by the path info after the servlet name
    Can I associate the first security constraint with a FORM based login
    config, and the second security constraint with a BASIC AUTH login config
    since I could in theory require SOAP clients to send in credentials in a
    HTTP BasicAuth header, but I can't expect a SOAP client to be HTTP
    Redirected to a login form and then to enter the right credentials into a
    user type form and then be redirected back to an app...
    Seems to me the J2EE Security spec is really lacking in the area of
    programmatic authentication (allowing my SOAP code to get credentials outof
    the request envelope and call an API to login myself). Yeah, WebLogic has
    the ServletAuthentication weak() API, but these apps need to be J2EE
    compliant and work across J2EE servers... Anybody know of anyimprovements
    coming in the J2EE security space to address such functionality needs?
    Thanks in advance
    Mike

  • Error while creating farm for Office web apps

    Hello.
    I have error while creating office web apps fars.
    when I enter this code to powershell : New-OfficeWebAppsFarm -InternalURL "http://servername" -AllowHttp -EditingEnabled
    It says this:
    New-OfficeWebAppsFarm : The term 'New-OfficeWebAppsFarm' is not recognized as the name of a cmdlet, function, script
    file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
    and try again.
    At line:1 char:1
    + New-OfficeWebAppsFarm -InternalURL "http://office" -AllowHttp -EditingEnabled
    + ~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (New-OfficeWebAppsFarm:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    so what's the problem?

    That is an error I would expect with the account running the cmdlet not having local administrator rights to the server.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Error auto-deploying a Web App (.WAR file)

    Hello,
    Weblogic 6.1 throws a FileNotFoundException about 10% of the time for me when
    auto-deploying a Web app. Has anyone else run into this? I searched the newsgroups
    but didn't come up with anything, so I thought I'd start here.
    My build/deploy cycle is managed by an Ant build file that creates a WAR file
    of my web application and then drops it into $WL_HOME/config/mydomain/applications.
    Occasionally when I do this, I get the error shown below. Originally I was building
    the WAR file right in the ../applications directory, so I thought that might be
    an issue. So, I started building the WAR file in a staging directory and copying
    it into ../applications. No luck. Next, I tried deleting the original WAR file
    from ../applications, and THEN copying the new one over from the staging directory.
    Still fails occasionally.
    Let's see. This is Weblogic 6.1 on Win2K. The only other thing is that my dev/build/staging
    environment is on a network share, and it's from there that I'm copying the WAR
    file to my local machine (where WL is running).
    If someone has seen and/or knows what is up with this, great. If not, it's not
    a show-stopper.
    Thanks!
    Cheers,
    David
    ========================================================
    <Apr 8, 2002 9:05:00 AM PDT> <Error> <Management> <IOException opening application
    mydomain:Name=private-banking,Type=Application, loading from path .\config\mydomain\applications\private-banking.war
    java.io.FileNotFoundException: error in opening zip file
         at weblogic.management.mbeans.custom.Application.findType(Application.java:1833)
         at weblogic.management.mbeans.custom.Application.adminLoad(Application.java:444)
         at weblogic.management.mbeans.custom.Application.load(Application.java:387)
         at java.lang.reflect.Method.invoke(Native Method)
         at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
         at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
         at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:359)
         at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
         at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
         at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
         at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
         at $Proxy8.load(Unknown Source)
         at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:840)
         at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:733)
         at weblogic.management.mbeans.custom.ApplicationManager.update(ApplicationManager.java:206)
         at weblogic.management.mbeans.custom.ApplicationManager$ApplicationPoller.run(ApplicationManager.java:1050)

    Michael,
    This is a problem with 6.1 SP2 also -- a very annoying error. Without auto deploy
    working properly, developers are spending alot of time waiting for WebLogic to restart.
    HELP!!! we need this fixed.
    I see the EXACT same stack trace (ERROR).
    Tom Markel
    Sr. Java Engineer
    Michael Young <[email protected]> wrote:
    Hi.
    This may be a known issue that was addressed in sp2. If you are not already
    at that sp level I suggest you upgrade.
    Regards,
    Michael
    David Ventimiglia wrote:
    Hello,
    Weblogic 6.1 throws a FileNotFoundException about 10% of the time forme when
    auto-deploying a Web app. Has anyone else run into this? I searchedthe newsgroups
    but didn't come up with anything, so I thought I'd start here.
    My build/deploy cycle is managed by an Ant build file that creates a WARfile
    of my web application and then drops it into $WL_HOME/config/mydomain/applications.
    Occasionally when I do this, I get the error shown below. OriginallyI was building
    the WAR file right in the ../applications directory, so I thought thatmight be
    an issue. So, I started building the WAR file in a staging directoryand copying
    it into ../applications. No luck. Next, I tried deleting the originalWAR file
    from ../applications, and THEN copying the new one over from the stagingdirectory.
    Still fails occasionally.
    Let's see. This is Weblogic 6.1 on Win2K. The only other thing is thatmy dev/build/staging
    environment is on a network share, and it's from there that I'm copyingthe WAR
    file to my local machine (where WL is running).
    If someone has seen and/or knows what is up with this, great. If not,it's not
    a show-stopper.
    Thanks!
    Cheers,
    David
    ========================================================
    <Apr 8, 2002 9:05:00 AM PDT> <Error> <Management> <IOException openingapplication
    mydomain:Name=private-banking,Type=Application, loading from path .\config\mydomain\applications\private-banking.war
    java.io.FileNotFoundException: error in opening zip file
    at weblogic.management.mbeans.custom.Application.findType(Application.java:1833)
    at weblogic.management.mbeans.custom.Application.adminLoad(Application.java:444)
    at weblogic.management.mbeans.custom.Application.load(Application.java:387)
    at java.lang.reflect.Method.invoke(Native Method)
    at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
    at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
    at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:359)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1555)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
    at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
    at $Proxy8.load(Unknown Source)
    at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:840)
    at weblogic.management.mbeans.custom.ApplicationManager.poll(ApplicationManager.java:733)
    at weblogic.management.mbeans.custom.ApplicationManager.update(ApplicationManager.java:206)
    at weblogic.management.mbeans.custom.ApplicationManager$ApplicationPoller.run(ApplicationManager.java:1050)--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Exchange Office Web Apps Preview Does not work in OWA (web)

    I have setup Exchange 2013, Lync 2013, SharePoint 2013, IIS as a Reverse Proxy Server, an Office Web Apps Server, etc, etc. Everything is setup to use SSl (https) and everything works great EXCEPT... Office Web Apps... and ONLY via Exchange and OWA (exchange
    browser-based access).
    I can login via the intranet or Internet for everything (SharePoint, Outlook, and Lync) and Office Web apps functionality works flawlessly for all... except for Exchange and OWA.
    If I login in to a web-based Exchange seeion, everything works right and I can see the various attachments.
    For all other scenarios, Office Web Apps works (SharePoint, Outlook, Lync, etc), but in owa (web version of Outlook) I see that Office Web Apps is triggered (I see the Office Web Apps text and the dots that indicate something is loading)... However, it just
    crashes and eventually times out (see image):
    If I look in the error logs for the Web Apps Server I see this:
    Essentially, it looks like that owa uses a distinctly different path to load the attachments into the Web Apps Server such that the file is not found!
    What is happening? Why does Exchange OWA (web version of Outlook) somehow use a different path that fails to locate  attachments in Office Web Apps, but Lync, Outlook, and SharePoint (both in Intranet and Internet) work perfectly?
    This is VERY frustrating. Can anyone help?
    Please?
    Clearly, the reverse proxy is working, the certificates are working, OAuth is working, etc. It seems there must be some variable/path that is only defined in Exchange for OWA that uses a different path for Office Web App attachments and that path is WRONG!
    Please, help!
    Thanks

    Hi,
    Thanks for sharing. It’s glad to hear the good news.
    Thanks,
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Simon Wu
    TechNet Community Support

  • Unable to deploy Web App using JPA TopLink Essentials in Tomcat5.5.17

    Hi All,
    I am trying to deploy a Web App ( used Top Link Essentials ) to Tomcat and i am getting the following Error..
    I am strating tomcat using -javaagent:/Path/To/spring-agaent.jar
    Dec 14, 2006 9:52:46 AM org.apache.catalina.loader.WebappClassLoader loadClass
    INFO: Illegal access: this web application instance has been stopped already.  Could not load oracle.toplink.essentials.internal.weaving.ClassDetails.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    java.lang.IllegalStateException
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1238)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at oracle.toplink.essentials.internal.weaving.TopLinkWeaver.transform(TopLinkWeaver.java:84)
            at org.springframework.orm.jpa.persistenceunit.ClassFileTransformerAdapter.transform(ClassFileTransformerAdapter.java:56)
            at sun.instrument.TransformerManager.transform(TransformerManager.java:122)
            at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:155)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812)
            at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
            at java.lang.Class.getConstructor0(Class.java:2671)
            at java.lang.Class.newInstance0(Class.java:321)
            at java.lang.Class.newInstance(Class.java:303)
            at org.apache.myfaces.application.ApplicationImpl.createComponent(ApplicationImpl.java:396)
            at com.sun.faces.config.ConfigureListener.verifyObjects(ConfigureListener.java:1438)
            at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:509)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
            at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
            at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535)
            at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
            at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
            at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
            at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
            at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
            at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
            at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
            at org.apache.catalina.core.StandardService.start(StandardService.java:450)
            at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
            at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
            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:585)
            at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432) Thanks
    Sateesh

    Spring 2.0 provides custom support for TopLink Essentials in Tomcat out-of-the-box. You should follow the instructions here: http://static.springframework.org/spring/docs/2.0.x/reference/orm.html#orm-jpa-setup-lcemfb-tomcat
    Essentially, Spring provides a custom class loader for Tomcat and doesn't use an agent.
    --Shaun                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Web link to pass the parameter to custom web app then update the field

    Hi,
    I have created the web link in service request object to refer Account Object. I want to let user able to select the account from web link then base on the current SR no and account that have created update the record in CRMOD. My question is how to pass the parameter out to my external web app so that they can update my SR correctly?
    Thank you

    Hi Messer,
    I have put in the syntax as below :-
    https://secure-ausomxega.crmondemand.com/OnDemand/user/AssocAccountPopup?mapBC=Service+Request&OACTRL=Account&ophi=PopupNewForm.Account+Id&pfid=PopupNewForm&OMTHD=AssocPopup&OMTGT=PopupSearchList&assocInit=Y&opht=4&OAOBJ=Service+Request&mapField=Account&ophd=PopupNewForm.Account&ophpd=3&disableclear=Y&ophr=AssocAccountPopup&assocval=&ParentType=Edit
    This pop up screen wil let the user to select the account then i will pass the account and the SR to external web app to update back the CRMOD. I am not too sure the above syntax is correct or maybe can you give some example.
    I am new in CRMOD, hope that you can advice on this.
    Thank you,
    SK

  • How do I define my web application path in Tomcat6

    Hi friends,
    Can anybody tell me how to define and where to define my web-application path in tomcat 6 server?
    I absolutely don't want to change any files inside tomcat6\conf\ folder (like its server.xml or context.xml)
    My problem comes in the following scenario:
    i) My Webapplication path is c:\tomcat6\webapps\test-servletii) I have one html form file registration.html in c:\tomcat6\webapps\test-servlet\registration.htmliii) I have a form processing servlet in path c:\tomcat6\webapps\test-servlet\WEB-INF\classes\pkg_register\Process_Registration.classiv) web.xml file inside WEB-INF\ has contents
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
       version="2.5">    
    <servlet>
         <servlet-name>Process_Registration</servlet-name>
         <servlet-class>pkg_register.Process_Registration</servlet-class>     
    </servlet>
    <servlet-mapping>
         <servlet-name>Process_Registration</servlet-name>
         <url-pattern>/Process_Registration</url-pattern>
    </servlet-mapping>
    </web-app>PROBLEM : In html <form action="/test-servlet/Process_Registration"> works fine.
    But every time I don't want to give my web application folder name in URLs( not in web.xml or in form action, it should be default relative path).
    I want to give just, <form action="/Process_Registration"> in registration.html file's form action.
    Any help is appreciated.
    Thanks.
    ---Sujoy

    Thanks...
    It solved the problem by putting <form action="Process_Registration"> instead of <form action="/Process_Registration">When I was using <form action="/Process_Registration"> it was directly taking me to
    http://localhost:8888/Process_Registration .
    But, now when i use <form action="Process_Registration"> it takes me to
    http://localhost:8888/test-servlet/Process_Registration which IS CORRECT.
    But, still i don't know why the <form action="/Process_Registration"> was taking me out of my current webapplication path. It should have given me ERROR.
    --Sujoy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How do I change the context-root of a web app with a deployment plan?

    I've been trying to figure this out for several hours.
    I'm deploying a .ear file which sets the context root for the single web application it deploys in its application.xml deployment descriptor:
    <application>
    <display-name>MyApp</display-name>
    <module>
    <web>
    <web-uri>MyAppViewControler.war</web-uri>
    <context-root>MyApp</context-root>
    </web>
    </module>
    </application>
    I want to change the context-root from /MyApp to something else when deploying the ear file. It seemed to me that using a deployment plan was the way to do this. But when I use this plan:
    <deployment-plan>
    <application-name>MyApp<application-name>
    <variable-definition>
    <variable>
    <name>NEWCONTEXTROOT</name>
    <value>foobar</value>
    </variable>
    </variable-definition>
    <module-override>
    <module-name>MyApp</module-name>
    <module-type>ear</module-type>
    <module-descriptor external="false">
    <root-element>application</root-element>
    <uri>META-INF/application.xml</uri>
    <variable-assignment>
    <name>NEWCONTEXTROOT</name>
    <xpath>/application/module/web/context-root</xpath>
    </variable-assignment>
    </module-descriptor>
    </module-override>
    </deployment-plan>
    I get an error:
    weblogic.descriptor.DescriptorException: VALIDATION PROBLEMS WERE FOUND
    /bea/user_projects/domains/devod1/nullplan.xml:0: problem: cvc-complex-type.2.4a: Expected element 'web-uri@http://java.sun.com/xml/ns/javaee' instead of 'context-root@http://java.sun.com/xml/ns/javaee' here in element web@http://java.sun.com/xml/ns/javaee:<nullplan.xml>
    I looked at http://e-docs.bea.com/wls/docs103/pdf/deployment.pdf which says:
    "You cannot use a deployment plan to change the context-root in an application.xml
    file. However, if an application is deployed as a library, you can either change the
    context-root through an weblogic-application.xml file or use the deployment plan
    to change the context-root in an weblogic-application.xml file."
    I don't understand what this means. I'm not deploying my application as a library.
    Does anyone know how to change the context-root for an application?
    Any help would be greatly appreciated!

    Hi James,
    I am quite new to Welogic if i am wrong please correct me.I have re-deployed my application (.war) with this Plan.xml
    &lt;?xml version='1.0' encoding='UTF-8'?&gt;
    &lt;deployment-plan xmlns="http://www.bea.com/ns/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/deployment-plan http://www.bea.com/ns/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false"&gt;
    &lt;application-name&gt;BrowserR08.003&lt;/application-name&gt;
    *&lt;variable-definition&gt;*
    * &lt;variable&gt;*
    * &lt;name&gt;CONTEXTROOT&lt;/name&gt;*
    * &lt;value&gt;BrowserWeb/servlet/BrowserServlet&lt;/value&gt;*
    * &lt;/variable&gt;*
    * &lt;/variable-definition&gt;*
    &lt;module-override&gt;
    &lt;module-name&gt;BrowserWeb.war&lt;/module-name&gt;
    &lt;module-type&gt;war&lt;/module-type&gt;
    &lt;module-descriptor external="true"&gt;
    &lt;root-element&gt;weblogic-web-app&lt;/root-element&gt;
    &lt;uri&gt;WEB-INF/weblogic.xml&lt;/uri&gt;
    &lt;hash-code&gt;1231953167814&lt;/hash-code&gt;
    *&lt;variable-assignment&gt;*
    * &lt;name&gt;CONTEXTROOT&lt;/name&gt;*
    * &lt;xpath&gt;/weblogic-web-app/context-root&lt;/xpath&gt;*
    * &lt;operation&gt;add&lt;/operation&gt;*
    * &lt;/variable-assignment&gt;*
    &lt;/module-descriptor&gt;
    &lt;module-descriptor external="false"&gt;
    &lt;root-element&gt;web-app&lt;/root-element&gt;
    &lt;uri&gt;WEB-INF/web.xml&lt;/uri&gt;
    &lt;/module-descriptor&gt;
    &lt;module-descriptor external="true"&gt;
    &lt;root-element&gt;wldf-resource&lt;/root-element&gt;
    &lt;uri&gt;META-INF/weblogic-diagnostics.xml&lt;/uri&gt;
    &lt;/module-descriptor&gt;
    &lt;/module-override&gt;
    &lt;config-root&gt;/export/home1/tecapp/BrowserR08.003/plan&lt;/config-root&gt;
    &lt;/deployment-plan&gt;
    I do not know wether i will require the other module descriptor definition in this Plzn.xml. Now when I go to following link.
    Deployments --&gt; MyApp --&gt; Testing
    It gives me following url as a test page:
    http://localhost:7001/BrowserWeb/servlet/BrowserServlet
    as soon as i click on to the above link it redirects me to following.
    http://localhost:7001/BrowserWeb/servlet/BrowserServlet/servlet/BrowserServlet
    Same if i remove these context-root part my normal Testing menu shows me following link as my webapp access path
    http://localhost:7001/BrowserWeb &lt;-- My war file name is BrowserWeb.war so it is default name of my deployed application if i am not wrong
    and as soon as i click on above link it redirects me to the following one.
    http://localhost:7001/BrowserWeb/servlet/BrowserServlet
    It means application server know that my full web access page is with '*servlet/BrowserServlet*' because its adding it in both the cases.
    What I want is a constant URL whcih does not change?
    Hope this helps :)

  • Web Apps FAQ

    Hello,
    I am working on knowledge base entries for developing Web Applications with Sun ONE Studio. I would be interested in whether any of the following are helpful.
    Also, are there other entries you think should be added? Other comments? Corrections?
    Thanks
    Web Apps FAQ
    Creating a Web Application
    Q: Where do I put my JSP files in my web module.
    A: JSP files can go into the web module's document base directory or any
    of its subdirectories except for the subdirectories under WEB-INF. For example,
    the following is correct:
    correctWebModStructure
    + login.jsp
    ++ JSP_files
    +++ shop.jsp
    + WEB-INF
    ++ Classes
    ++ lib
    ++ web.xml
    The following is incorrect:
    incorrectWebModStructure
    + WEB-INF
    ++ login.jsp     
    ++ JSP_files
    +++ shop.jsp     
    ++ Classes
    ++ lib
    ++ web.xml
    Note that with the incorrect structure, the JSP files will compile but
    they will not run on a server.
    Q: Where should I put my servlet source and binary files when I create
    and execute a web module from the IDE?
    A: Your compiled classes must go in the appropriate package directory
    under <web mod document root>/WEB-INF/Classes. The easiest place to
    put the source code is in the same directory as the compiled class. To
    put your source code in a different directory, see "Can I put my source code in
    a different directory from WEB-INF/classes?"
    Note that when a class is imported by another class or by a JSP file, the
    class MUST be in a named namespace (package).
    Q: Where do I put my libraries (JAR files) in a web module?
    A: You can put the libraries in one of several places:
    o If the JAR file will be used only by the module, put it in the
    WEB-INF/lib directory.
    o If the JAR file will be shared by multiple web modules look at the server's
    documentation to find out how to make the library available across web
    modules.
    - If you are using the Sun One Application server, you can either copy
    the JAR into the <instance_dir>/lib directory (such as
         <AppServerInstallDir>\domains\domain1\server1\lib) or edit the
         classpath-suffix attribute of the java-config element in the
         server.xml file. For details about server.xml, see the Sun ONE Application
         Server Administrator�s Configuration File Reference. You must
         restart the server.
    - If you are using the internal Tomcat server, put the JAR file into one of
    the following directories:
    <ide-install-dir>/jwsdp/lib/
    <ide-install-dir>/jwsdp/common/classes
    <ide-install-dir>/jwsdp/common/lib/
    <ide-install-dir>jwsdp/shared/classes
    <ide-install-dir>/jwsdp/shared/lib/
    Note that for compilation, a JAR file must either be mounted as as an
              archive file or the JAR file must be put into <ide-install-dir>\lib\ext.
    When you add a JAR file to WEB-INF/lib directory tree, the IDE mounts
              the JAR file for you automatically.
    Q: Can I put my source code in a different directory from WEB-INF/classes?
    A: Yes. For example, say you have a directory structure as follows:
    myWebApp
    + WEB-INF
    ++ Classes
    +++ myPkg
    + src
    ++ myPkg
    1. In the Filesystems tab, mount myWebApp and separately mount src.
    The Explorer should look like this:
    <path>/myWebApp
    <path>/myWebApp: /WEB-INF/classes <-IDE automatically mounts this
    <path>/src
    2. Open Tools > Options > Building > External Compilation and select this Target:
    <path>/myWebApp: /WEB-INF/classes
    (By default, this setting is project wide, if you click the >> column, you
    can set it at the user or default level.)
    3. Whenever you create a Java file under /WEB-INF/classes, the IDE automatically
    adds a servlet entry and a mapping in the web.xml. Because you are putting
    your source elsewhere, you will have to enter these entries manually, or do
    the following.
    1. Right-click the web.xml node, and choose Properties.
    2. In the Deployment panel of the web.xml properties window,
    click the ellipses (...) in the Servlets value field to display
    the Servlets Property editor.
    In Servlets Property editor, click Add to display the Add Servlet dialog box.
    In the Add Servlet dialog box, type, or browse for, the servlet class name.
    Type in the name by which you want to identify the servlet.
    3. Click the Edit button for Mappings and add the mapping for the servlet.
    4. Click OK to close the Add Servlet dialog box, then click OK to close
    the Servlets property editor.
    Note: If you don't add the web.xml entries, you might get an error like the
    following:
    "The requested object does not exist on this server.
    The link you followed is either outdated, inaccurate,
    or the server has been instructed not to let you have it.
    Please inform the site administrator of the referring page."
    Q: Why do I get invalid package name when I try to add a package to my
    web module.
    You have two options for creating packages in a web module.
    1. Create a package in a subdirectory of WEB-INF/classes.
    2. Create a package in a directory that is not in the WEB-INF tree and
    put the compiled class in the WEB-INF tree. For example, if you have the
    following directory structure, set the compilation target to WEB-INF/classes.
    myWebMod
    + src
    ++ pkg1
    + WEB-INF
    ++ classes
    +++ pkg1
    ++ lib
    In either case, the WEB-INF/classes directory must be mounted. The IDE
    does this automatically when you create a web module or turn a directory
    into a web module.
    To set the compilation target, choose Tools > Options > Building >
    External Compilation and select the target. In this example, you would
    select:
    <path>/myWebMod: /WEB-INF/classes
    Do not use a directory structure like this:
    myWebMod
    + WEB-INF
    ++ src << wrong
    ++ classes
    You can alternatively keep your source code in the appropriate package
    directory under WEB-INF/classes.
    Editing JSP Files
    Q: JSP code completion does not work now that I use the Jakarta recommended
    directory structure and use Ant to build and deploy my web applications? Can
    I fix this?
    To make code completion work, you must mount the following libraries and
    directories in the Filesystems tab of the Explorer window. Mounting a parent
    directory does not work.
    * <working-directory>/src
    * <working-directory>/build
    * Every .jar file that is copied by the build script to
              <working-directory>/build/WEB-INF/lib. (The IDE automatically mounts
                   all the jar files in WEB-INF/lib when you mount working-directory/build.)
    * Any other libraries that are used by the web application, such as
              libraries that have been deployed to the server.
    Deploying a Web Application
    Q: Can I change the URL that is used to execute a JSP page? For example,
    instead of http://localhost/welcome.jsp, can I have the URL be
    http://localhost/shopping/welcome.jsp?
    A: Yes, right-click on the WEB-INF and choose Properties from the contextual
    menu. In the Properties window, type /<name>. For example, type
    /shopping
    Note that youu can use servlet mappings in the web.xml file to control the
    mappings of URLs to servlets.
    Q: Is there a way to copy the compiled code to the server for testing
    without having to create a WAR file?
    A: Yes, this is the default action when you right-click the WEB-INF
    node and choose Deploy from the contextual menu.
    With Internal and External Tomcat installations, the deploy action causes
    the IDE to change the server's configuration file to add a context entry,
    which points to the document root of your working version of the web
    application. For example
    /myApp -> C:\My Working Directory\myApp
    When you deploy to the Sun ONE application server using the IDE's Deploy
    action, the IDE copies the web application's directory structure to
    the server's <instance>/applications/j2ee-modules directory.
    Q: How do I create a WAR file and deploy the WAR file onto different servers.
    A: To create a WAR file, right click the WEB-INF node and choose Export WAR
    file. See the online help for details about adding and filtering out
    components.
    Look at the server's documentation to find out how to deploy the WAR file
    to the server. Here is an example of deploying a WAR file to the Sun ONE
    Application Server 7:
    asadmin deploy user myusername password mypassword \
    -host localhost port 4848 type web contextroot /myApp instance server1 \
    c:\apps\myapp.war
    Note that when you deploy to a server that is registered with the IDE,
    you do not need to create a WAR file. Instead, you can right-click on the
    WEB-INF node and choose Deploy.
    Compiling a Web Application
    Q: Why do I get compiler errors when I compile from the IDE even though
    I don't get errors when I compile from the command line?
    As the IDE's classpath is derived from the mounted filesystems, the problem
    is most likely caused by not mounting the necessary filesystems. For the
    following web app, you must mount in the Explorer AWebApp, WEB-INF/classes
    (this directory is mounted automatically when you create a web app or
    turn a directory into a web app), and every JAR file in the WEB-INF/lib
    directory (which is also done automatically). Note that all classes and
    JAR files that the application needs must be in AWebApp/WEB-INF or
    AWebApp/lib or the server's location for shared libraries and classes.
    Otherwise, the module may compile but it won't run in the server.
    AllMyWebApps
    + AWebApp
    ++ WEB-INF
    +++ classes
    +++ lib
    ++++ a.jar
    ++++ b.jar
    Q: Why do I get a "cannot resolve symbol" compiler error message for my JSP.
    A: Check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class), and the
    class must be in a namespace. The namespace restriction is because the Javac
    bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification,
    and thus rejects import statements that import a type from an unnamed namespace.
    Valid import statement:
    <%@page import="org.alpha.beta.MyBean" %>
    Also, make sure your compiled classes are in a subfolder of
    <web-module>/WEB-INF/classes, such as, for the above bean,
    <web-module>/WEB-INF/classes/org/alpha/beta/MyBean.class.
    Note that you will also get this error if you have created a link under
    WEB-INF/classes to a package in another directory. Your package must
    physically exist in the WEB-INF/classes directory.          
    Q: Why do I get " '.' expected" when my JSP is compiled.
    The Javac bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification, and
    thus rejects import statements that import a type from an unnamed namespace.
    For example, if you have an import statement like the following, the compiler
    expects the imported class to be in a package. Therefore, the compiler
    assumes that MyBean is a package and expects the package name to be followed
    by a period (.) and either a subpackage or a class. To resolve the problem,
    put the bean in a package.
    INVALID IMPORT STATEMENT:
    <%@page import="MyBean" %>
    VALID IMPORT STATEMENT
    <%@page import="MyPackage.MyBean" %>
    Q: Why do I get a package does not exist error message when the package exists?
    A: The problem might be that you have not mounted the web module at the
    correct point. You must mount the directory that is directly above the WEB-INF
    directory. For example, if you have the following directory structure
    you must mount the webApp1 filesystem. When you specifically mount
    webApp1, the IDE recognizes the filesystem as a web module. The IDE
    automatically mounts WEB-INF/classes, so that it is in the IDE's classpath,
    and provides the execute and deploy actions when you right-click on the
    WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    You can also get this error message when you do not put your Classes directory
    under WEB-INF. For example, if you put the Classes directory in web-info, you
    will get this error message.
    You will get this error if you have created a link under WEB-INF/classes
    to a package in another directory. Your package must physically exist in
    the WEB-INF/classes directory.                    
    Running Web Applications
    Q: Why do I get the 404 error message "The requested resource is not available"?
    Why do I get the error message "The requested object does not exist on
    this server"?
    A: If you get either of these errors on a servlet, check the servlet's entry
    in the web.xml. The entry should be similar to the following:
    <servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>org.alpha.beta.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/MyServlet</url-pattern>
    </servlet-mapping>
    The name can be any name as long as it is the same in both mappings.
    The class must be the fully qualified class name. The pattern
    must be a pattern that matches the URI that invokes the servlet. In
    this case, the pattern matches the URI http://localhost:8081/MyServlet.
    Q: Why do I get a Generated Servlet error "Class not found."
    A: This error can occur if the class is not in a package. To resolve the
    problem, put the class in a package.
    If the class is in a package and you still get this message,
    check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class).
    For example:
    <%@page "org.alpha.beta.CustomerBean" %>
    Q: Why do I get the error message "Unable to load class" when my JSP calls
    a class from a library?
    This message usually appears because the library's JAR file is not in the
    WEB-INF/lib directory. The server expects all of the web app's JAR files
    to either be in the WEB-INF/lib directory or in the server's
    shared library directory.
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    Q: Why do I get an error message during JSP compilation that a tld file is not
    found when the file is there?
    A: The problem might be that you have not put the tld file in the correct
    place. It should go in the WEB-INF directory.
    This problem also happens if have not mounted the web module at the
    correct point.
    You must mount the directory that is directly above the WEB-INF directory. For
    example, if you have the following directory structure you must mount the
    myWebApp1 filesystem. When you specifically mount webApp1, the IDE recognizes
    the filesystem as a web module. The IDE automatically mounts WEB-INF/classes,
    which in turn adds the path to the IDE's classpath and provides the execute
    and deploy actions when you right-click on the WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    Another cause of the problem could be that the uri in your taglib statement
    is incorrect. For example, this statement is wrong:
                        <%@ taglib uri="struts-html.tld" prefix="html" %> <- Incorrect
    Instead, it should be:
                        <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %> <- Correct
    Q: Why do I get a java.lang.ClassNotFoundException when I run my JSP file?
    Everything compiles successfully and the source editor does JSP code completion
    for the class. However, when I execute, the runtime system can't find the new
    classes.
    A: There are several causes of this error. Here are some things to check.
    1. If the class is in a library, make sure the JAR file is in the
    WEB-INF/lib directory or the server's directory for shared libraries.
    Otherwise, make sure the class is in a package under the WEB-INF/Classes
    directory.
    When compiling, the IDE builds the classpath from the mounted filesystems.
    However, when you use the deploy action, the IDE only deploys the classes,
    libraries, and files that are stored in the mounted web module.
    2. Make sure all usebean statements use a fully qualified name for
    the class name.
    WRONG:
    <jsp:useBean id="myBean" class="MyBean" scope="request" />
    CORRECT:
    <jsp:useBean id="myBean" class="org.alpha.beta.MyBean" scope="request" />
    Q. Why am I getting a 500 Internal Server Error? My application compiled but
    when I try to run it, I get an Internal Server Error.
    A: There are several reasons for internal server errors. The "root cause" or
    the "Exception" information can help to narrow in on the problem. Here are
    some common causes:
    a) One common reason is that the compiled classes are not in the right directory
    or a required library (JAR file) is not in the WEB-INF/lib directory.
    When you compile, the IDE uses the classpath to find the resources. However,
    when you deploy an application, the application must strictly follow the
    web module directory structure:
    <document root directory>
    + JSP, HTML and other public files
    + WEB-INF
    ++ web.xml
    ++ <tld files>
    ++ classes
    +++ <pkg 1>
    +++ <pkg 2>
    ++ lib
    +++ <.jar>
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    b) If you are connecting to a database, make sure the driver is put in the
    server's shared library directory or common library directory.
    c) An error occurs when the server compiles the JSP into a servlet. For example,
    the import or usebean statement is not using the fully qualified class
    name for the bean. The following statements show an incorrect and a correct
    import statement.
    import="MyBean" << wrong
    import="com.myCompany.MyBean" << correct
    In this case, the "Exception" or "Root Cause" might be "Class <bean name> not
    found in import."
    Note that a bean must always be in a package. A bean cannot be put into the
    WEB-INF/classes directory. Instead, it must be in a WEB-INF/classes
    subdirectory.
    Accessing Databases from Web Applications
    Q: I put my database driver in WEB-INF/lib but I still can't access the
    database. What do I do?
    A: If your application performs queries or run statements through JDBC, then
    putting the driver in WEB-INF is sufficient. However, if you are connecting to
    the database through the server, you need to put the driver in the
    server's shared library directory or the server's common library directory.
    You must also set up a connection pool in the server.xml file. See the
    documentation for your server on the specifics, as the details vary for
    each server.

    Hello,
    I am working on knowledge base entries for developing Web Applications with Sun ONE Studio. I would be interested in whether any of the following are helpful.
    Also, are there other entries you think should be added? Other comments? Corrections?
    Thanks
    Web Apps FAQ
    Creating a Web Application
    Q: Where do I put my JSP files in my web module.
    A: JSP files can go into the web module's document base directory or any
    of its subdirectories except for the subdirectories under WEB-INF. For example,
    the following is correct:
    correctWebModStructure
    + login.jsp
    ++ JSP_files
    +++ shop.jsp
    + WEB-INF
    ++ Classes
    ++ lib
    ++ web.xml
    The following is incorrect:
    incorrectWebModStructure
    + WEB-INF
    ++ login.jsp     
    ++ JSP_files
    +++ shop.jsp     
    ++ Classes
    ++ lib
    ++ web.xml
    Note that with the incorrect structure, the JSP files will compile but
    they will not run on a server.
    Q: Where should I put my servlet source and binary files when I create
    and execute a web module from the IDE?
    A: Your compiled classes must go in the appropriate package directory
    under <web mod document root>/WEB-INF/Classes. The easiest place to
    put the source code is in the same directory as the compiled class. To
    put your source code in a different directory, see "Can I put my source code in
    a different directory from WEB-INF/classes?"
    Note that when a class is imported by another class or by a JSP file, the
    class MUST be in a named namespace (package).
    Q: Where do I put my libraries (JAR files) in a web module?
    A: You can put the libraries in one of several places:
    o If the JAR file will be used only by the module, put it in the
    WEB-INF/lib directory.
    o If the JAR file will be shared by multiple web modules look at the server's
    documentation to find out how to make the library available across web
    modules.
    - If you are using the Sun One Application server, you can either copy
    the JAR into the <instance_dir>/lib directory (such as
         <AppServerInstallDir>\domains\domain1\server1\lib) or edit the
         classpath-suffix attribute of the java-config element in the
         server.xml file. For details about server.xml, see the Sun ONE Application
         Server Administrator�s Configuration File Reference. You must
         restart the server.
    - If you are using the internal Tomcat server, put the JAR file into one of
    the following directories:
    <ide-install-dir>/jwsdp/lib/
    <ide-install-dir>/jwsdp/common/classes
    <ide-install-dir>/jwsdp/common/lib/
    <ide-install-dir>jwsdp/shared/classes
    <ide-install-dir>/jwsdp/shared/lib/
    Note that for compilation, a JAR file must either be mounted as as an
              archive file or the JAR file must be put into <ide-install-dir>\lib\ext.
    When you add a JAR file to WEB-INF/lib directory tree, the IDE mounts
              the JAR file for you automatically.
    Q: Can I put my source code in a different directory from WEB-INF/classes?
    A: Yes. For example, say you have a directory structure as follows:
    myWebApp
    + WEB-INF
    ++ Classes
    +++ myPkg
    + src
    ++ myPkg
    1. In the Filesystems tab, mount myWebApp and separately mount src.
    The Explorer should look like this:
    <path>/myWebApp
    <path>/myWebApp: /WEB-INF/classes <-IDE automatically mounts this
    <path>/src
    2. Open Tools > Options > Building > External Compilation and select this Target:
    <path>/myWebApp: /WEB-INF/classes
    (By default, this setting is project wide, if you click the >> column, you
    can set it at the user or default level.)
    3. Whenever you create a Java file under /WEB-INF/classes, the IDE automatically
    adds a servlet entry and a mapping in the web.xml. Because you are putting
    your source elsewhere, you will have to enter these entries manually, or do
    the following.
    1. Right-click the web.xml node, and choose Properties.
    2. In the Deployment panel of the web.xml properties window,
    click the ellipses (...) in the Servlets value field to display
    the Servlets Property editor.
    In Servlets Property editor, click Add to display the Add Servlet dialog box.
    In the Add Servlet dialog box, type, or browse for, the servlet class name.
    Type in the name by which you want to identify the servlet.
    3. Click the Edit button for Mappings and add the mapping for the servlet.
    4. Click OK to close the Add Servlet dialog box, then click OK to close
    the Servlets property editor.
    Note: If you don't add the web.xml entries, you might get an error like the
    following:
    "The requested object does not exist on this server.
    The link you followed is either outdated, inaccurate,
    or the server has been instructed not to let you have it.
    Please inform the site administrator of the referring page."
    Q: Why do I get invalid package name when I try to add a package to my
    web module.
    You have two options for creating packages in a web module.
    1. Create a package in a subdirectory of WEB-INF/classes.
    2. Create a package in a directory that is not in the WEB-INF tree and
    put the compiled class in the WEB-INF tree. For example, if you have the
    following directory structure, set the compilation target to WEB-INF/classes.
    myWebMod
    + src
    ++ pkg1
    + WEB-INF
    ++ classes
    +++ pkg1
    ++ lib
    In either case, the WEB-INF/classes directory must be mounted. The IDE
    does this automatically when you create a web module or turn a directory
    into a web module.
    To set the compilation target, choose Tools > Options > Building >
    External Compilation and select the target. In this example, you would
    select:
    <path>/myWebMod: /WEB-INF/classes
    Do not use a directory structure like this:
    myWebMod
    + WEB-INF
    ++ src << wrong
    ++ classes
    You can alternatively keep your source code in the appropriate package
    directory under WEB-INF/classes.
    Editing JSP Files
    Q: JSP code completion does not work now that I use the Jakarta recommended
    directory structure and use Ant to build and deploy my web applications? Can
    I fix this?
    To make code completion work, you must mount the following libraries and
    directories in the Filesystems tab of the Explorer window. Mounting a parent
    directory does not work.
    * <working-directory>/src
    * <working-directory>/build
    * Every .jar file that is copied by the build script to
              <working-directory>/build/WEB-INF/lib. (The IDE automatically mounts
                   all the jar files in WEB-INF/lib when you mount working-directory/build.)
    * Any other libraries that are used by the web application, such as
              libraries that have been deployed to the server.
    Deploying a Web Application
    Q: Can I change the URL that is used to execute a JSP page? For example,
    instead of http://localhost/welcome.jsp, can I have the URL be
    http://localhost/shopping/welcome.jsp?
    A: Yes, right-click on the WEB-INF and choose Properties from the contextual
    menu. In the Properties window, type /<name>. For example, type
    /shopping
    Note that youu can use servlet mappings in the web.xml file to control the
    mappings of URLs to servlets.
    Q: Is there a way to copy the compiled code to the server for testing
    without having to create a WAR file?
    A: Yes, this is the default action when you right-click the WEB-INF
    node and choose Deploy from the contextual menu.
    With Internal and External Tomcat installations, the deploy action causes
    the IDE to change the server's configuration file to add a context entry,
    which points to the document root of your working version of the web
    application. For example
    /myApp -> C:\My Working Directory\myApp
    When you deploy to the Sun ONE application server using the IDE's Deploy
    action, the IDE copies the web application's directory structure to
    the server's <instance>/applications/j2ee-modules directory.
    Q: How do I create a WAR file and deploy the WAR file onto different servers.
    A: To create a WAR file, right click the WEB-INF node and choose Export WAR
    file. See the online help for details about adding and filtering out
    components.
    Look at the server's documentation to find out how to deploy the WAR file
    to the server. Here is an example of deploying a WAR file to the Sun ONE
    Application Server 7:
    asadmin deploy user myusername password mypassword \
    -host localhost port 4848 type web contextroot /myApp instance server1 \
    c:\apps\myapp.war
    Note that when you deploy to a server that is registered with the IDE,
    you do not need to create a WAR file. Instead, you can right-click on the
    WEB-INF node and choose Deploy.
    Compiling a Web Application
    Q: Why do I get compiler errors when I compile from the IDE even though
    I don't get errors when I compile from the command line?
    As the IDE's classpath is derived from the mounted filesystems, the problem
    is most likely caused by not mounting the necessary filesystems. For the
    following web app, you must mount in the Explorer AWebApp, WEB-INF/classes
    (this directory is mounted automatically when you create a web app or
    turn a directory into a web app), and every JAR file in the WEB-INF/lib
    directory (which is also done automatically). Note that all classes and
    JAR files that the application needs must be in AWebApp/WEB-INF or
    AWebApp/lib or the server's location for shared libraries and classes.
    Otherwise, the module may compile but it won't run in the server.
    AllMyWebApps
    + AWebApp
    ++ WEB-INF
    +++ classes
    +++ lib
    ++++ a.jar
    ++++ b.jar
    Q: Why do I get a "cannot resolve symbol" compiler error message for my JSP.
    A: Check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class), and the
    class must be in a namespace. The namespace restriction is because the Javac
    bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification,
    and thus rejects import statements that import a type from an unnamed namespace.
    Valid import statement:
    <%@page import="org.alpha.beta.MyBean" %>
    Also, make sure your compiled classes are in a subfolder of
    <web-module>/WEB-INF/classes, such as, for the above bean,
    <web-module>/WEB-INF/classes/org/alpha/beta/MyBean.class.
    Note that you will also get this error if you have created a link under
    WEB-INF/classes to a package in another directory. Your package must
    physically exist in the WEB-INF/classes directory.          
    Q: Why do I get " '.' expected" when my JSP is compiled.
    The Javac bytecode compiler in J2SE 1.4.0 is more strict than in previous
    versions in enforcing compliance with the Java Language Specification, and
    thus rejects import statements that import a type from an unnamed namespace.
    For example, if you have an import statement like the following, the compiler
    expects the imported class to be in a package. Therefore, the compiler
    assumes that MyBean is a package and expects the package name to be followed
    by a period (.) and either a subpackage or a class. To resolve the problem,
    put the bean in a package.
    INVALID IMPORT STATEMENT:
    <%@page import="MyBean" %>
    VALID IMPORT STATEMENT
    <%@page import="MyPackage.MyBean" %>
    Q: Why do I get a package does not exist error message when the package exists?
    A: The problem might be that you have not mounted the web module at the
    correct point. You must mount the directory that is directly above the WEB-INF
    directory. For example, if you have the following directory structure
    you must mount the webApp1 filesystem. When you specifically mount
    webApp1, the IDE recognizes the filesystem as a web module. The IDE
    automatically mounts WEB-INF/classes, so that it is in the IDE's classpath,
    and provides the execute and deploy actions when you right-click on the
    WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    You can also get this error message when you do not put your Classes directory
    under WEB-INF. For example, if you put the Classes directory in web-info, you
    will get this error message.
    You will get this error if you have created a link under WEB-INF/classes
    to a package in another directory. Your package must physically exist in
    the WEB-INF/classes directory.                    
    Running Web Applications
    Q: Why do I get the 404 error message "The requested resource is not available"?
    Why do I get the error message "The requested object does not exist on
    this server"?
    A: If you get either of these errors on a servlet, check the servlet's entry
    in the web.xml. The entry should be similar to the following:
    <servlet>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>org.alpha.beta.MyServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>myServlet</servlet-name>
    <url-pattern>/MyServlet</url-pattern>
    </servlet-mapping>
    The name can be any name as long as it is the same in both mappings.
    The class must be the fully qualified class name. The pattern
    must be a pattern that matches the URI that invokes the servlet. In
    this case, the pattern matches the URI http://localhost:8081/MyServlet.
    Q: Why do I get a Generated Servlet error "Class not found."
    A: This error can occur if the class is not in a package. To resolve the
    problem, put the class in a package.
    If the class is in a package and you still get this message,
    check the import statements in your JSP file. The import statement must
    specify the fully qualified class name (package name plus class).
    For example:
    <%@page "org.alpha.beta.CustomerBean" %>
    Q: Why do I get the error message "Unable to load class" when my JSP calls
    a class from a library?
    This message usually appears because the library's JAR file is not in the
    WEB-INF/lib directory. The server expects all of the web app's JAR files
    to either be in the WEB-INF/lib directory or in the server's
    shared library directory.
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    Q: Why do I get an error message during JSP compilation that a tld file is not
    found when the file is there?
    A: The problem might be that you have not put the tld file in the correct
    place. It should go in the WEB-INF directory.
    This problem also happens if have not mounted the web module at the
    correct point.
    You must mount the directory that is directly above the WEB-INF directory. For
    example, if you have the following directory structure you must mount the
    myWebApp1 filesystem. When you specifically mount webApp1, the IDE recognizes
    the filesystem as a web module. The IDE automatically mounts WEB-INF/classes,
    which in turn adds the path to the IDE's classpath and provides the execute
    and deploy actions when you right-click on the WEB-INF node:
    allMyWebApps
    + webApp1
    ++ WEB-INF
    +++ Classes
    ++++ myPkg
    Another cause of the problem could be that the uri in your taglib statement
    is incorrect. For example, this statement is wrong:
                        <%@ taglib uri="struts-html.tld" prefix="html" %> <- Incorrect
    Instead, it should be:
                        <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %> <- Correct
    Q: Why do I get a java.lang.ClassNotFoundException when I run my JSP file?
    Everything compiles successfully and the source editor does JSP code completion
    for the class. However, when I execute, the runtime system can't find the new
    classes.
    A: There are several causes of this error. Here are some things to check.
    1. If the class is in a library, make sure the JAR file is in the
    WEB-INF/lib directory or the server's directory for shared libraries.
    Otherwise, make sure the class is in a package under the WEB-INF/Classes
    directory.
    When compiling, the IDE builds the classpath from the mounted filesystems.
    However, when you use the deploy action, the IDE only deploys the classes,
    libraries, and files that are stored in the mounted web module.
    2. Make sure all usebean statements use a fully qualified name for
    the class name.
    WRONG:
    <jsp:useBean id="myBean" class="MyBean" scope="request" />
    CORRECT:
    <jsp:useBean id="myBean" class="org.alpha.beta.MyBean" scope="request" />
    Q. Why am I getting a 500 Internal Server Error? My application compiled but
    when I try to run it, I get an Internal Server Error.
    A: There are several reasons for internal server errors. The "root cause" or
    the "Exception" information can help to narrow in on the problem. Here are
    some common causes:
    a) One common reason is that the compiled classes are not in the right directory
    or a required library (JAR file) is not in the WEB-INF/lib directory.
    When you compile, the IDE uses the classpath to find the resources. However,
    when you deploy an application, the application must strictly follow the
    web module directory structure:
    <document root directory>
    + JSP, HTML and other public files
    + WEB-INF
    ++ web.xml
    ++ <tld files>
    ++ classes
    +++ <pkg 1>
    +++ <pkg 2>
    ++ lib
    +++ <.jar>
    For more information, search for the "File Location in a Web Module" topic
    in the online help.
    b) If you are connecting to a database, make sure the driver is put in the
    server's shared library directory or common library directory.
    c) An error occurs when the server compiles the JSP into a servlet. For example,
    the import or usebean statement is not using the fully qualified class
    name for the bean. The following statements show an incorrect and a correct
    import statement.
    import="MyBean" << wrong
    import="com.myCompany.MyBean" << correct
    In this case, the "Exception" or "Root Cause" might be "Class <bean name> not
    found in import."
    Note that a bean must always be in a package. A bean cannot be put into the
    WEB-INF/classes directory. Instead, it must be in a WEB-INF/classes
    subdirectory.
    Accessing Databases from Web Applications
    Q: I put my database driver in WEB-INF/lib but I still can't access the
    database. What do I do?
    A: If your application performs queries or run statements through JDBC, then
    putting the driver in WEB-INF is sufficient. However, if you are connecting to
    the database through the server, you need to put the driver in the
    server's shared library directory or the server's common library directory.
    You must also set up a connection pool in the server.xml file. See the
    documentation for your server on the specifics, as the details vary for
    each server.

  • Office Web Apps server security question

    Hello,
    According to this technet article Microsoft appears to recommend against allowing both external and internal users access to your OWA server.
    http://technet.microsoft.com/en-us/library/jj219435(v=office.15).aspx#viewers
    "Files that are intended to be viewed through a web browser by using Online Viewers must not require authentication. In other words, the files must be available publicly because Online Viewers can’t perform authentication when it is retrieving files.
    We strongly recommend that the Office Web Apps Server farm that you use for Online Viewers is only able to access either the intranet or the Internet, but not both. This is because Office Web Apps Server doesn’t differentiate between requests for intranet
    and Internet URLs. Somebody on the Internet could request an intranet URL, for example, causing a security leak if an internal document is viewed."
    Just trying to make sense of this.  I am building a new Lync 2013 environment and I definitely want my internal users to be able to leverage the OWA server.  So does that mean I should not publish that server to the internet?  And if I do
    not, does that mean my users will not be able to share a powerpoint presentation at all to external users?  If this is all true and I'm understanding this correctly, does this mean that most implementations choose one or the other? Or does Lync not
    use these "Online Viewers" so I can just disable them and users will still be able to share powerpoint presentations with external users?
    Thanks for any help you can provide for this confusion.

    No, you should publish to both internal and Internet on the same server, it's just how it's done with Lync.  You can't really have two with Lync for this purpose anyway.  Users will upload PowerPoint presentations to it when it's time to share,
    no editing is possible, and the risk is generally minimal.  You can shorten the cache time to help if you're concerned.
    Regardless, from the article:
    http://technet.microsoft.com/en-us/library/jj219442(v=office.15).aspx setting OpenFromUrlEnabled "Turns on or off the ability to use Online Viewers to view Officefiles from a URL or UNC path.".  This is set to false and turned off by default.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question please click "Mark As Answer".
    SWC Unified Communications

  • Office Web Apps server / Lync server 2013

    Hi I have installed a Lync 2013 Server and Office Web Apps Server. Configured Lync topology, Office Web Apps farm and certificates.
    However when i start the services i get this error message in the log saying Office Web Apps discovery failed.
    Event ID:      41033
    Description:
    Office Web Apps Server (WAC) discovery failed, PowerPoint content is disabled.
    Attempted Office Web Apps Server discovery Url:
    Received error message: Invalid Uri syntax for WAC configuration
    The number of retries: 1,
    Cause: Office Web Apps Server may be unavailable or network connectivity may have been compromised.
    Resolution:
    Check HTTPS connectivity from this box to the Office Web Apps Server deployment using the discovery Url.
    I can access the OWAS server Url from Lync Server
    Connecting to the HTTPS discovery URL is working fine, and brings up the XML-page (after i click "show all content").
    The two servers are located on the same internal network, DNS resolves fine both ways, and no firewall rules blocks any connections between the two. Can anyone please help me figure this out?
    Only identical problem found online is here (Invalid Uri syntax for WAC configuration):
    http://blogs.technet.com/b/dodeitte/archive/2012/09/10/office-web-apps-server-amp-lync-server-2013.aspx
    He resolved the problem by assigning a new OAuthTokenIssuer certificate. This however did not fix the problem in my case.
    Regards
    Sverre A. Veel

    Hi,
    In addition, please make sure you have restarted front end and office web apps server after reissuing the certificate.
    Kent Huang
    TechNet Community Support

Maybe you are looking for