J2EE & Tomcat

I have an EJB deployed to the J2EE server and I'm trying to access this EJB from a servlet in a standalone tomcat container. I'm aware of the J2EE server having a servlet container but I want to have servlets and jsp's running in its own container.
How do I get the InitialContext to the J2EE server? What are the values for the following properties? Do I need other properties that I haven't listed?
Hashtable env =new Hashtable()
env.put.(Context.PROVIDER_URL, "myserver:9191"); // should the port be were ejb is listening?
env.put(Context.INITIAL_CONTEXT_FACTORY, "????????????");
Context ctx = new InitialContext(env);

You might try asking this question on the Tomcat user mailing list. There's been some recent discussion about Tomcat and J2EE integration.
(One of the) searchable archives is at http://marc.theaimsgroup.com/?l=tomcat-user&r=1&w=2.
Main mailing list subscribe/unsubscribe page is http://jakarta.apache.org/site/mail2.html.

Similar Messages

  • J2EE Tomcat vs. Tomcat

    I need some information regarding the integrated Tomcat.
    Does it have all features of the full Tomcat ? And can you update it normally from Apache or do you need a special J2EE Tomcat update ?
    In short, I need to know if there is any downside to using J2EE Tomcat compared to Full Tomcat.

    The J2EE Tomcat is the same as the regular Tomcat. However, keep in mind that Tomcat comes out with patches fairly often, whereas the J2EE reference implementation is pretty stable and no updates are issued unless there is a critical issue. If I'm not mistaken, the integrated Tomcat in the J2EE 1.3 reference implementation is version 4.0 beta 7. If you go to Jakarta's website, you will notice that Tomcat 4.0 is already past beta and at version 4.0.4.

  • Structuring a JSP/J2EE (Tomcat) application

    If anyone can give some direction on this, then I'd be very happy.
    I am trying to rewrite an application I previously developed in PHP using JSP/J2EE in a Tomcat enviroment. I am rather unsure about how the application and related files should be organised. For instance, should my "own" application-related configuration files (whatever.xml) be stored in the WEB-INF directory? Also, should application-specific log files be stored somewhere in the application structure, or would those typically be located where the server logs are? For application-specific logging, should I use java.util.Logging or something like log4j?
    I will be using three different environments (dev, staging and production) for this, and would ideally like to make the application easily configurable to move it between these environments.
    Sincerely,
    Nils Hagner

    hagner wrote:
    If anyone can give some direction on this, then I'd be very happy.
    I am trying to rewrite an application I previously developed in PHP using JSP/J2EE in a Tomcat enviroment. I am rather unsure about how the application and related files should be organised. For instance, should my "own" application-related configuration files (whatever.xml) be stored in the WEB-INF directory? Also, should application-specific log files be stored somewhere in the application structure, or would those typically be located where the server logs are? For application-specific logging, should I use java.util.Logging or something like log4j?
    I will be using three different environments (dev, staging and production) for this, and would ideally like to make the application easily configurable to move it between these environments.Usually you put your own configuration files in the /WEB-INF/classes directory because then they will be in the classloader's classpath.
    Log files go in the same log directory as the server logs (in tomcat this is just ${CATALINA_HOME}/logs/)
    You can use either the java logging or log4j that is up to you (I think log4j is better personally because it has more features)

  • Flash Builder J2EE Tomcat question

    I've been looking around the documentations on how to configure Flash Builder to work with Tomcat using BlazeDS and have gotten different answers from different places. A few places have mentioned to used the LifeCycle Data Service option, while a few others have mentioned using the BlazeDS option. I am running Flash Builder 4 stand-alone with TomCat6 and BlazeDS 4. Any input on this would be a great help. Thanks in advance.

    Hi Chris,
    The Burrito Preview installs to a different directory than your existing FB4 installation, by default, so there should be no conflict there. Also, it accepts the same Serial Number you have for FB4 if you purchased FB4 as an individual product.
    If you purchased FB4 as part of a CS5 Suite, there will be a site available you can use to obtain a Preview SN for Burrito, but you can still use Burrito in Trial mode until that is available.
    -Chris

  • Crystal Report problem with J2EE - OutOfMemory

    Dear All,
    I am having a problem about generating PDF from J2EE (Tomcat, Java 1.4)  WebApplication by Crystal report.
    When generating a PDF it sometimes got an out of memory error.
    However the Web Application is still working fine, just when regenerate the same crystal report the out of memory error occur again. when i generate the other report it works fine.
    Please help .
    Many Thanks

    Hi,
    It's a good idea to set the minimum and maximum heap size to the same value. In any case, don't let the minimum heap size exceed the maximum.
    Stop Tomcat server, set environment variable CATALINA_OPTS, and then restart Tomcat.
    Look at the file tomcat-install/bin/catalina.sh or catalina.bat for how this variable is used.
    For example,
    set CATALINA_OPTS="-Xms512m -Xmx512m"  (Windows)
    export CATALINA_OPTS="-Xms512m -Xmx512m" (ksh/bash)
    setenv CATALINA_OPTS "-Xms512m -Xmx512m"  (tcsh/csh)
    In catalina.bat or catallina.sh, you may have noticed CATALINA_OPTS, JAVA_OPTS,
    or both can be used to specify Tomcat JVM options.
    What is the difference between CATALINA_OPTS and JAVA_OPTS?
    The name CATALINA_OPTS is specific for Tomcat servlet container,
    whereas JAVA_OPTS may be used by other java applications (e.g., JBoss).
    Since environment variables are shared by all applications, we don't want Tomcat to inadvertently pick up the JVM options intended for other apps. I prefer to use CATALINA_OPTS.
    You have specified size by a capiital "M" ?(3072M) use "m".
    Please let me know the results.
    Regards,
    Neeraj

  • Web.xml file problem in tomcat

    Hi i need help in this... its urgent
    currently i just subscribe to a web hosting site and i need to start the private tomcat in the web server..
    The followings are the instructions and i have follow them but i do not know how to create a web.xml file to store in the folder indicated for example a HelloServlet that im testing :
    To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in /var/www/html/WEB-INF directory.
    www root directory or webapps:/var/www/htm
    Classes directory located in: /var/www/html/WEB-INF/Classes/
    There you will need to upload your Java class file.
    Our default url-mapping for servlet is: /servlet/*
    To check servlet in your browser: www.mydomain.net/servlet/HelloWorld
    Jsp Files - Upload anywhere in /var/www/html
    all the above steps are follow except the web.xml file which i suppose to write and store in the folder... but i actually try to write one but i still cannot load my servlet on the webpage... test on standalone tomcat works.
    pls help its urgent!!!

    first sorry about cross posting the subject. i didnt know i am not suppose to do that. i post in a few forums that are related to my topic. sorry
    The tomcat on the web server is of version Private J2EE / Tomcat 4.1.29 and the standalone tomcat i am using is also tomcat 4.1
    the web.xml in my standalone server in root/web-inf/ is as follows and it is configure for authentication purposes. It works together with the tomcat-users.xml located on conf directory
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>
    Restricted Area
    </web-resource-name>
    <url-pattern>/secure/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>manager</role-name>
    <role-name>tomcat</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/Login.html</form-login-page>
    <form-error-page>/Error.html</form-error-page>
    </form-login-config>
    </login-config>
         <security-role>
         <description>The Secure ROLE</description>
         <role-name>manager</role-name>
              <role-name>tomcat</role-name>
         </security-role>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>
    Restricted Area
    </web-resource-name>
    <url-pattern>/Customer/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>customer</role-name>
    <role-name>tomcat</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/Login.html</form-login-page>
    <form-error-page>/Error.html</form-error-page>
    </form-login-config>
    </login-config>
         <security-role>
         <description>The Secure ROLE</description>
         <role-name>customer</role-name>
              <role-name>tomcat</role-name>
         </security-role>
    </web-app>
    using this web.xml, my stanalone web pages works fine for all servlets and jsp. however if i copy this over to the web server, i still cannot load my servlets and jsp. moreover it doesnt work for authentication purpose anymore. i don't know why too
    i have try the codes you write before and it also doesnt work
    the problem is i cannot get the support form the web hosting site. This is the link that suppose to teach me but it doesn not tell me how to configure my web.xml
    https://www.eroute.net/JSPSupport.htm

  • Moving from J2EE to OC4J

    Hi All,
    Right now I am using J2EE as application server.
    Mine is a web application and it runs on J2EE-Tomcat Technology.
    Now I want to shift to OC4J (i.e. componenet of Oracle
    Application Server).
    Can any one suggest me how whould i deploy my all ejbs to OC4j.
    I have right now jar files prepared by deployment tool of J2EE.
    Going from OC4J documents I tried to make .EAR file with the
    existing jar file and and application.xml .
    Now I changed the server.xml and specified the path of .EAR file
    there.
    Whenever the server starts,It first shows me that it found
    the .ear file but then it shows error like this
    "Error in application BTSEmp: Error loading package at
    file:/D:/Oracle9iAS/j2ee/home/applications/Bts/BTS_M_Emp/BTS_M_Em
    pClient.jar,
    Unable to find/read assembly info for
    D:\Oracle9iAS\j2ee\home\applications\Bts\BTS_M_Emp/BTS_M_EmpClien
    t.jar
    (META-INF/ejb-jar.xml)"
    as my jar file is prepared from j2ee so it does not have ejb-
    jar.xml instead it has sun-j2ee-ri.xml file.
    So what do i do to make my ejb get deployed on OC4J.
    Thanks in advance.
    Taral Shah

    Ah, fair enough- I figured it would be something like that.
    From what I've been told and shown (don't know for sure until I start I suppose) there's no struts work, but there is work with entity beans, session beans, etc... There's also JSP and servlets- now these, I guess, would have their own specific resources. XML/XSLT is also used internally, but that said I'm more familiar with those.
    So your advice would pretty much to be to focus on the technologies in use themselves, as opposed to the concept of beans, sessions and states, and whatnot? (That said, the internal architecture I use at my current work is pretty much just our own bean anyway, so I'm not completely clueless to "beans" anyway.)

  • Initialising class when J2EE server starts

    Hi,
    I am facing a problem. I wish to instantiate a class when the J2EE/ tomcat server starts. This is similar to the property set in weblogic as
    weblogic.system.startupClass.startup = <name of ur startup class>
    Here we can specifiy the class to be instantiated during startup of server.
    Can i do something similar in tomcat/ j2ee server?
    I do not wish to use a servlet since my webapplication contains jsps and other supporting classes and my own apis.
    Thank you in adv.
    ...supriya.

    if you use ServletContext Listeners you should be ready as far as web app is concerned. Most servers I believe offer JMX integration so that you can listen for server startups. : )

  • Error when compiling the J2ee tutorial source files

    HI,
    I have installed ant, j2ee tomcat-3.2.2 and jdk1.3 and when i tried to compile the source file downloaded from java.sun by
    ant converter, it prompted
    "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/main"
    I am running it on win98 with the autoexec.bat containing the followings:
    set J2EE_HOME=c:\j2sdkee1.3
    set JAVA_HOME=c:\jdk1.3.1
    set ANT_HOME=c:\jakarta-ant-1.3
    set TOMCAT_HOME=c:\tomcat\jakarta-tomcat-3.2.2
    set classpath=;.;c:\jdk1.3.1\jre\lib\rt.jar;c:\j2sdkee1.3\lib\j2ee.jar;c:\jaxp\xalan.jar;c:\jaxp\crimson.jar;c:\jaxp\jaxp.jar;c:\C:\jakarta-ant-1.3\lib\ant.jar;C:\jakarta-ant-1.3\lib\jaxp.jar;C:\jakarta-ant-1.3\lib\parser.jar
    PATH=%PATH%;"C:\Program Files\Mts";C:\PROGRA~1\ULTRAE~1;c:\jdk1.3.1\bin;c:\j2sdkee1.3\bin;c:\jakarta-ant-1.3\bin;C:\PROGRA~1\MICROS~4\80\TOOLS\BINN
    Really thx for help !!!!

    Hi.
    I am compiling the sample converter.ear downloaded from
    the j2ee tutorial bundle form java.sun. I am using jakarta-ant-1.4alpha-bin.zip downloaded from jakarta
    oh..yes it should be org.apache.tools.ant.Main ....sorryfor typo.....
    look forward to any helpful reply

  • Why database related code not wriiten in jsp's

    hi all
    what all resons are there for which database related code
    is not written in jsp's
    one thing that i know is
    it's not a j2ee architecture to do so
    so is it the thing that doing so hits the performance issue
    thanx

    Me, I'm still trying to get my head around Java 1.5, J2EE, Tomcat, JBoss, and Oracle RAC (both programming and DBAing)... My head hurts... Badly...
    Back to the topic, though... I also agree with the previous posters...
    I agree there are exceptions to the "no JDBC in JSP rule of thumb"- I have a JSP-based generic table browser as a tool for emergency maintenance from a (presumably) hostile network, it provides read-only access and automatic password rotation. The flexibility of having it in the JSP has saved my bacon in a crisis; when travelling, I had to talk a non-programmer through applying a code fix (damn developers, using reserved words as column name...)( I had the source on my laptop...). To get a class file fixed, I would have had to get a programmer on the phone, and get the server to reload the class which in our environment at the time required an application restart... The project I work on is about 70 man-years of work, mostly Java, and we have maybe 6 or 8 JSPs that access the DB directly...
    Most of the time though, good design says that you access a particular "type" of data (table or group of tables) in the same "chunk" of code, jsp or class file. It's a lot harder to share a jsp among different invokers than it is a class file. It's also better to isolate presentation from data access.
    Imagine that you have a "USER" table, with first name, last name, username, and password. You program a "login" jsp, a user "edit" jsp and an administrator "edit" jsp. Then a security audit declares that saving an unexcrypted password in the database is insecure; you now have to change evey place that can access the password. If the user object was accessed through a single Java class file, then there would be only one place to fix. Of course, it's possible to use jsp includes to simulate class files, but that's just about as much work as creating the class file to begin with, with more problems.
    Another big advantage of keeping your data access out of JSPs is that you can write unit tests much more easily for the Java classes, using something like JUnit. You can have a set of tests for all your persisted data, which can be run anytime your data model changes. This makes it a lot harder for "side effect" bugs to creep into your code.

  • InDesign Plugin question

    Hi All,
    I was wondering if you or someone is currently looking for a new project. I am looking for a Adobe InDesign Plugin Developer who knows how to write extensions for the desktop publishing applications; Adobe InDesign and Quark.
    Familiarity with scripting languages such as JavaScript, AppleScript, or VB Script.
    Good problem solving abilities and strong programming skills.
    Excellent communication skills and ability to work in a collaborative manner.
    Experience on Macintosh and Windows systems.
    Experience in XML.
    Experience with server-side technologies such as J2EE, Tomcat, or other application servers helpful
    Please feel free to call me or email me.
    Thanks,
    Crystal
    949-202-5814 office
    [email protected]

    Hi Folks,
    I am also after an Indesign Plugin developer.
    I currently have a project I am developing - it is listed at getafreelancer.
    https://www.getafreelancer.com/projects/Javascript/Adobe-Indesign-Index-Plugin-required.ht ml
    Please bid, or contact me at the project for further clarification/information.
    I am looking to get started straight away.
    Leigh.

  • Enterprise monitoring using JMX

    Hello,
    So, my company has a lot of J2EE/Tomcat servers running on java 1.6. I'm trying to find a way to monitor them all via JMX from a centralized system, which would be accessible to multiple users (web based, ideally).
    Based on my understanding of JMX, it should be possible to extract the data we need from each JVM. I have been using JConsole to do this on an ad-hoc basis when we have problems with a particular JVM and it's great.
    But I can't seem to find any good software for doing enterprise-wide monitoring and long-term data collection... can anyone suggest a good package, either free/open-source (ideally) or commercial?
    Basically, I want to be able to:
    * collect CPU, memory, DB (hibernate), HTTP request stats, etc. via JMX and archive it
    * view graphs of the above
    * ideally, we could also receive email alerts if certain conditions were met, e.g. memory almost full.
    As a side note:
    We're already using Zenoss (http://www.zenoss.com) to monitor the OS-level stuff and we really like it, but we need more visibility into each JVM (we have multiple JVMs per physical server). As far as I can tell, Zenoss doesn't support JMX monitoring... but has anyone found a way to make this work? If so, I'd love to hear about it, since this would be ideal for me.

    You may want to have a look at Glassbox, an open source troubleshooting agent for pinpointing problems in Enterprise Java applications.
    http://www.glassbox.com
    It offers both JMX and web-based access to the collected data but I'm not sure the web-based console allows you to present the collected data graphically. But still you could write your own JConsole plugins and display the collected
    data coming from Glassbox and your own custom MBeans in a graphical way but of course JConsole is Swing-based.
    Have a look at the JavaOne 2007 Hands-On Lab 1420 to get more detailed info about using Glassbox/JMX/JConsole together.
    http://blogs.sun.com/lmalventosa/entry/j1_07_hol_1420
    Regards,
    Luis-Miguel Alventosa
    Java SE JMX/JConsole development team
    Sun Microsystems, Inc.
    http://blogs.sun.com/lmalventosa/

  • How to Authenticate a J2EE application running on Tomcat & Apache with OAM

    Hi All,
    Can somebody point me to docs which states how to integrate a J2EE software deployed on Tomcat(AppServer) & Apache(WebServer).
    I have Oracle Access Manager installed I need to enable SSO for that software.
    Thanks,
    RK

    HI ,
    Apart from the installation webgate and protection of the resource through OAM policies, you also need to modify your Java based application.
    As a part of integration what OAM do is, it weill pass the user information(eg user id etc) to the Java application as the header variables. And now you have to modify this application so that it will accept the user information send by OAM, also login page if any of the application is disabled.
    Also if you are going for cookie based approach, your landing jsp of java application should be capable of reading and validating obssocookie set by OAM.
    Hope this will help you.
    Thanks,
    Ankit

  • How do I use the J2EE EJB container with the FULL version of Tomcat

    The version of Tomcat integrated in J2EE is really cut-down. I want to be able to run the standard Tomcat 4.0.1 to give the full JSP facilities, but I also want to be able to use EJBs from the J2EE.
    If I copy the j2ee.jar, j2ee-ri-svc.jar and home interface to the "lib" directory they do not appear to be loaded, as I cannot resolve the javax.ejb.EJBHome.class.
    If I copy the same library into the application's WEB-INF/lib directory then the naming jaxax.naming.InitialContext gives a context without the java:/comp/env entries.
    I do not want to use another EJB contrainer after having got used to deploying apps with J2EE.
    If anyone can help I would be greatful, and post a thanks message with duke dollars!
    Chris
    10 Duke Dollars available

    I have done it before and basically it is not that difficult, but in practice not that easy ;-)
    All you need to do is see Tomcat as a client to the EJBs. This means deploying the application in two parts: the webapp as a WAR to Tomcat 4.0.1, and the EJBs to J2EE. Both running and started independantly.
    This ofcourse means that the WAR file must have the stubs of the EJBs to be able to communicate and access to j2ee.jar to get the InitialContext.
    So:
    - compile the EJBs
    - create the EAR (containing only EJBs)
    - deploy the EAR
    - copy the stubs to the libs directory of the webapp
    - compile the webapp
    - create the WAR
    - deploy the WAR
    Off you go.
    Tom

  • What is the best way to SSO custom Tomcat J2EE, Sharepoint and Portal?

    We are implementing EP7.0 and I believe we can use logon tickets and SAPSECULIB to integrate all our infrastructure which is Sharepoint (Runs on IIS), our custom J2EE applications (run on Apache webserver and Tomcat).
    Is using of logon tickets and SAPSECULIB the recommended way to accomplish SSO or is there a better way?
    Thanks in advance

    Hi Victoria,
    I would put the html file that you generated on the file system
    let say the Apache/Apache/htdocs
    Then I'd put an HTML portlet on the page and show the HTML file using an iframe
    <iframe src="name of your file"
                height="600"
                width="800"
                frameborder="0"
                scrolling="no"
    </iframe>Hope this helps.
    Cheers
    Diego

Maybe you are looking for

  • Error calling Java in Oracle Stored Procedure

    I can call a java function inside my Oracle Stored Procedure, but if I reference a class that uses JNI, I get problems. I don't know what forum to post this under. This seems the closest match. Here is my error: java.lang.NoClassDefFoundError at Acme

  • Getting Dump while using PYXX_READ_PAYROLL_RESULT FM

    I m trying to get the gross salary and ESI contribution amount for an indian based employee. While using the FM 'PYXX_READ_PAYROLL_RESULT' i m getting the following dump. *******************************************************************************

  • Localization/Indian languages

    Hello Friends, I am trying to localize my application for Indian languages. I have a few road blocks to discuss. 1. My changes in properties files does not reflect immediately. 2. Can anyone please tell me how I will get the locales corresponding to

  • PI sheet

    I would like to know which function module i should use to record usage decision from the PI sheet. My business would like to have a button on PI sheet which they would use to record usage decision. So i need a function module which can be  called in

  • How to call a javascript function from XSL

    I'd a requirement to take an action each time a page loads I called the javascript function from addLoadEvent() available in javascript. But my reviewer commented that it should be called using XSL as we are using XSLT, What is preferred? To pass fun