Avatar billede gg Praktikant
17. februar 2002 - 10:14 Der er 14 kommentarer og
1 løsning

Forte, opret JPS side

Er der nogen der kender Forte Enterprise edition. Har et problem. Jeg kan ikke oprette en almindelig JSP sider der laver en lookup på en Entity Bean. Desværrer understøtter den nuværende version af Forte ikke Rich Java klienter (øv, øv ). Hvad gør jeg ?


Avatar billede mel2000 Nybegynder
17. februar 2002 - 14:54 #1
I "Explorer"-vinduet højreklikker du på den package din jsp-side skal ligge i. fra popup-menuen vælger du "new" -> "JSP & Servlet" -> "JSP".

derefter kommer der en "wizard" op hvor du skal skrive navnet på siden og derefter trykke "finish"

..:: mel2000 ::..
Avatar billede gg Praktikant
18. februar 2002 - 09:29 #2
Det er altså en ganske almindelige JSP jeg kommer til at lave. Det er ikke noget problem. MEN når jeg laver min kode i JSP siden og vil lave lookup til en Enterprise Bean kommer problemet. Jeg kan nemlig ikke bare lave et ganske almindelig lookup. (se nedenstående) Det virker med J2EE deployment tool, men mit lookup virker IKKE i Forte, Får en fejl der siger at der ikke kan oprettes initialContex, JNDI fejl. Jeg håber seriøst du kan hjælpe mig.

try
        {
            Tester remote;
            TesterHome home;
            String test;
   
            System.out.println("laver lookup 1 ");
            javax.naming.InitialContext ic = new javax.naming.InitialContext();
            Object obj = ic.lookup("tester");
            home = (TesterHome) javax.rmi.PortableRemoteObject.narrow(obj,TesterHome.class);
            remote = home.create();
            test = test +remote.hello();
           
           
           
           
        } 
        catch(Exception e)
        {
            e.printStackTrace();
        }
Avatar billede mel2000 Nybegynder
18. februar 2002 - 10:20 #3
String persistenceManagerFactoryResourceName = "java:comp/env/jdo/hrdb";
PersistenceManagerFactory persistenceManagerFactory;

InitialContext initialContext = new InitialContext(); persistenceManagerFactory = (PersistenceManagerFactory)initialContext.lookup(persistenceManagerFactoryResourceName);

Dette fandt jeg i hjælpen til forte. Jeg ved ikke om det er det. Og jeg må desværre indrømme at jeg ikke havde læst spørgsmålet ordentligt. SORRY!!!

..:: mel2000 ::..
Avatar billede gg Praktikant
18. februar 2002 - 11:02 #4
virker ikke, får stadig væk en javax.naming.InitialContextException. ??
Hvis du finder ud af hvordan man går vil jeg være dig evigt taknemlig. Sidder og laver hovedopgave og skal bruge Forte. Men så længe vi ikke kan få en JSP side til at lave lookup på en bønde, ja så kan vi ikke komme videre
Avatar billede mel2000 Nybegynder
18. februar 2002 - 11:16 #5
javax.naming.InitialContextException ??

den kan jeg ikke engang finde i API'et??
Avatar billede gg Praktikant
18. februar 2002 - 11:20 #6
Her er den. Den er god nok.

C:\JDK13~1.1_0\jre\bin\java  -cp "D:\source-codes\EJB\sampledir\WEB-INF\classes;D:\source-codes\EJB\sampledir;D:\source-codes\EJB\sampledir\test01s\WEB-INF\classes;D:\source-codes\EJB\sampledir\test01s;C:\forte4j\beans\TimerBean.jar;C:\forte4j\lib\ext\j2ee.jar;C:\forte4j\lib\ext\jdbc20x.zip;C:\forte4j\lib\ext\parser.jar;C:\forte4j\lib\ext\servlet.jar;C:\forte4j\lib\ext\xerces.jar;C:\forte4j\modules\ext\AbsoluteLayout.jar;C:\forte4j\modules\ext\persistence-rt.jar;C:\forte4j\modules\ext\rowset.jar;C:\forte4j\modules\ext\sql.jar;C:\forte4j\modules\xmlservices.jar;C:\forte4j\system;D:\source-codes\EJB\jspwork\Tomcat+3.2\1f47ae59;D:\source-codes\EJB\jspwork\Tomcat+3.2\3b811ef4;D:\source-codes\EJB\jspwork\Tomcat+3.2\3c1fe5af;D:\source-codes\EJB\jspwork\Tomcat+3.2\5f92b992;D:\source-codes\EJB\jspwork\Tomcat+3.2\7ea3fa12;D:\source-codes\EJB\jspwork\Tomcat+3.2\ba691c7;D:\source-codes\EJB\sampledir\WEB-INF\classes;D:\source-codes\EJB\sampledir\lookup\lookupWebKlient\WEB-INF\classes;D:\source-codes\EJB\sampledir\test01s\WEB-INF\classes;D:\source-codes\EJB\system";C:\forte4j\lib\locale\core_f4j.jar;C:\forte4j\lib\locale\core_f4j_ee.jar;C:\forte4j\lib\locale\core_f4j_ee_ja.jar;C:\forte4j\lib\locale\core_f4j_ja.jar;C:\forte4j\lib\locale\core_ja.jar;C:\forte4j\lib\locale\openide_f4j.jar;C:\forte4j\lib\locale\openide_ja.jar;C:\forte4j\lib\locale\updater_ja.jar;C:\forte4j\lib\core.jar;C:\forte4j\lib\openide-fs.jar;C:\forte4j\lib\openide-nodes.jar;C:\forte4j\lib\openide-util.jar;C:\forte4j\lib\openide.jar;C:\forte4j\lib\ext\locale\ddl_ja.jar;C:\forte4j\lib\ext\locale\logger_ja.jar;C:\forte4j\lib\ext\locale\rmi-ext_ja.jar;C:\forte4j\lib\ext\bsh-1_0-fj.jar;C:\forte4j\lib\ext\cmd.jar;C:\forte4j\lib\ext\cosnaming.jar;C:\forte4j\lib\ext\ddl.jar;C:\forte4j\lib\ext\fjscript.jar;C:\forte4j\lib\ext\flute.jar;C:\forte4j\lib\ext\fscontext.jar;C:\forte4j\lib\ext\idlcompilers.jar;C:\forte4j\lib\ext\j2ee.jar;C:\forte4j\lib\ext\jaas.jar;C:\forte4j\lib\ext\jaxp.jar;C:\forte4j\lib\ext\jh.jar;C:\forte4j\lib\ext\jndi.jar;C:\forte4j\lib\ext\ldap.jar;C:\forte4j\lib\ext\ldapbp.jar;C:\forte4j\lib\ext\logger.jar;C:\forte4j\lib\ext\nis.jar;C:\forte4j\lib\ext\openorb-1.0.2.jar;C:\forte4j\lib\ext\parser.jar;C:\forte4j\lib\ext\pbclient.jar;C:\forte4j\lib\ext\providerutil.jar;C:\forte4j\lib\ext\regexp.jar;C:\forte4j\lib\ext\rmi-ext.jar;C:\forte4j\lib\ext\rmiregistry.jar;C:\forte4j\lib\ext\sac.jar;C:\forte4j\lib\ext\sax2.jar;C:\forte4j\lib\ext\servlet.jar;C:\forte4j\lib\ext\xerces.jar;C:\forte4j\lib\ext\jdbc20x.zip;C:\JDK13~1.1_0\lib\dt.jar;C:\JDK13~1.1_0\lib\tools.jar;C:\forte4j\modules\esp.jar;C:\forte4j\modules\registration.jar;C:\forte4j\modules\dd2beans.jar;C:\forte4j\modules\pointbase.jar;C:\forte4j\modules\webservices-util.jar;C:\forte4j\modules\ant.jar;C:\forte4j\modules\ext\ant.jar;C:\forte4j\modules\ext\ant-optional.jar;C:\forte4j\modules\docs\ant-manual.zip;C:\forte4j\modules\xalan.jar;C:\forte4j\modules\autoupdate.jar;C:\forte4j\modules\clazz.jar;C:\forte4j\modules\db.jar;C:\forte4j\modules\dbschema.jar;C:\forte4j\modules\debuggerCore.jar;C:\forte4j\modules\applet.jar;C:\forte4j\modules\toolsDebugger.jar;C:\forte4j\modules\jpdaDebugger.jar;C:\forte4j\modules\editor.jar;C:\forte4j\modules\ext\nb-editor.jar;C:\forte4j\modules\idl-syntax.jar;C:\forte4j\modules\filecopy.jar;C:\forte4j\modules\ext\ftpclient.jar;C:\forte4j\modules\html.jar;C:\forte4j\modules\httpserver.jar;C:\forte4j\modules\ext\webserver.jar;C:\forte4j\modules\extbrowser.jar;C:\forte4j\modules\image.jar;C:\forte4j\modules\jarpackager.jar;C:\forte4j\modules\java.jar;C:\forte4j\modules\ext\java-gj.jar;C:\forte4j\modules\ext\javac.jar;C:\forte4j\modules\persistence-ui.jar;C:\forte4j\modules\ext\persistence-rt.jar;C:\forte4j\modules\beans.jar;C:\forte4j\modules\corba.jar;C:\forte4j\modules\form.jar;C:\forte4j\modules\ext\AbsoluteLayout.jar;C:\forte4j\modules\javadoc.jar;C:\forte4j\modules\jndi.jar;C:\forte4j\modules\loggerModule.jar;C:\forte4j\modules\classfile.jar;C:\forte4j\modules\browser.jar;C:\forte4j\modules\ext\infobus.jar;C:\forte4j\modules\projects.jar;C:\forte4j\modules\properties.jar;C:\forte4j\modules\i18n.jar;C:\forte4j\modules\i18n-form.jar;C:\forte4j\modules\jdbc.jar;C:\forte4j\modules\ext\sql.jar;C:\forte4j\modules\ext\rowset.jar;C:\forte4j\modules\properties-syntax.jar;C:\forte4j\modules\text.jar;C:\forte4j\modules\usersguide.jar;C:\forte4j\modules\locale\usersguide_f4j_ee.jar;C:\forte4j\modules\xml.jar;C:\forte4j\modules\xml-syntax.jar;C:\forte4j\modules\openidex.jar;C:\forte4j\modules\j2eeserver.jar;C:\forte4j\modules\appsrvRI.jar;C:\forte4j\modules\utilities.jar;C:\forte4j\modules\locale\utilities_f4j.jar;C:\forte4j\modules\j2eelib.jar;C:\forte4j\modules\appasm.jar;C:\forte4j\modules\ejb.jar;C:\forte4j\modules\ejbmodule.jar;C:\forte4j\modules\apisupport-lite.jar;C:\forte4j\modules\rmi.jar;C:\forte4j\modules\vcscore.jar;C:\forte4j\modules\javacvs.jar;C:\forte4j\modules\ext\cvslib.jar;C:\forte4j\modules\vcsgen.jar;C:\forte4j\modules\cvs.jar;C:\forte4j\modules\jsp.jar;C:\forte4j\modules\ext\jasper.jar;C:\forte4j\modules\ejbtest.jar;C:\forte4j\modules\jsp-syntax.jar;C:\forte4j\modules\jspie.jar;C:\forte4j\modules\xmlservices.jar;C:\forte4j\modules\jsp-tomcat.jar;C:\forte4j\modules\ext\tomcat-monitor.jar;C:\forte4j\modules\teamwareim.jar;C:\forte4j\modules\.\ext\teamware.jar;C:\forte4j\modules\.\ext\shared\lib\locale;C:\forte4j\modules\tw-intel-win.jar org.netbeans.modules.web.tomcat.WebAppMain "D:\source-codes\EJB\system\tomcat\server.xml" "D:\source-codes\EJB\system\tomcat"
Starting tomcat. Check logs/tomcat.log for error messages
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:643)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
        at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:283)
        at javax.naming.InitialContext.lookup(InitialContext.java:350)
        at client1.lavLookup.test(lavLookup.java:52)
        at client_00031._0002fclient_00031_0002fJspKlient_0002ejspJspKlient_jsp_0._jspService(_0002fclient_00031_0002fJspKlient_0002ejspJspKlient_jsp_0.java:96)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
        at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
        at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)
Avatar billede mel2000 Nybegynder
18. februar 2002 - 11:29 #7
The initial context implementation is determined at runtime.
The default policy uses the environment property "java.naming.factory.initial",
which contains the class name of the initial context factory.
An exception to this policy is made when resolving URL strings, as described below.

When a URL string (a String of the form scheme_id:rest_of_name) is passed
as a name parameter to any method, a URL context factory for handling that
scheme is located and used to resolve the URL.
If no such factory is found, the initial context specified by "java.naming.factory.initial" is used.
Similarly, when a CompositeName object whose first component is a URL string is passed as a name
parameter to any method, a URL context factory is located and used to resolve the first name component.
See NamingManager.getURLContext() for a description of how URL context factories are located.
Avatar billede gg Praktikant
18. februar 2002 - 11:39 #8
ok men hvordan undgår jeg så dette problem. Har prøvet med din Persistence manager,
det virker ikke. Undrer mig, hvis jeg bruger almindelig deployment tool, kan jeg lave
en almindelig lookup(se min postet kode), men når jeg bruger Forte skal jeg gøre det
anderledes, på det punkt er Forte ikke særlig god :-(
Avatar billede mel2000 Nybegynder
18. februar 2002 - 11:53 #9
home = (TesterHome) javax.rmi.PortableRemoteObject.narrow(obj,TesterHome.class);

Prøv at ændre denne linie til:

home = (TesterHome) javax.rmi.PortableRemoteObject.narrow(obj, home.getClass().getName());

eller

home = (TesterHome) javax.rmi.PortableRemoteObject.narrow(obj, home.getClass());
Avatar billede mel2000 Nybegynder
18. februar 2002 - 12:22 #10
You get a NoInitialContextException

Cause

You did not specify which implementation to use for the initial context. Specifically the Context.INITIAL_CONTEXT_FACTORY environment property was not set to the class name of the factory that will create the initial context. Or, you did not make available to the program the classes of the service provider named by Context.INITIAL_CONTEXT_FACTORY.

SOLUTION

Set the Context.INITAL_CONTEXT_FACTORY environment property to the class name of the initial context implementation that you are using. If the property was set, then make sure that the class name was not mistyped, and that the class name is available to your program(either in the classpath or installed in the jre/lib/ext directory of the JRE).
The Java SDKv 1.3 includes service providers for LDAP, COS naming, and the RMI registry. All other service providers must be installed and added to the execution environment.
Avatar billede gg Praktikant
18. februar 2002 - 12:45 #11
ifølge sun kan man gøre følgende, men ak får en fejl:

import javax.naming.*;

Hashtable p = new Hashtable();
            p.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
            p.put("java.naming.provider.url", "iiop://localhost:1050"); // default RI port is 1050
            Context ctxt = new InitialContext(p);
            Object result = ctxt.lookup("ejb/tester");

javax.naming.NameNotFoundException.  Root exception is org.omg.CosNaming.NamingContextPackage.NotFound

naming contect package not found ??, hvor finder jeg den ?

        at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:34)
        at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.extract(NotFoundHelper.java:50)
        at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:161)
        at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:368)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:417)
        at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:395)
        at javax.naming.InitialContext.lookup(InitialContext.java:350)
        at client1.lavLookup.test(lavLookup.java:59)
        at client_00031._0002fclient_00031_0002fJspKlient_0002ejspJspKlient_jsp_0._jspService(_0002fclient_00031_0002fJspKlient_0002ejspJspKlient_jsp_0.java:96)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
        at org.netbeans.modules.web.tomcat.JspServlet.service(JspServlet.java:91)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
        at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
        at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)
Avatar billede mel2000 Nybegynder
18. februar 2002 - 12:57 #12
To set the Persistence Manager Factory as a Resource Reference:
1. Right-click the EJB node in the Explorer window.
2. Click on the value for Resource Factry References, then click on the elipsis (...) button. A property editor opens.
3. Click on the Add button. The Add Resource Reference window opens.
4. Add the name of the Persistence Manager Factory.
5. Select com.sun.forte4j.persistence.PersistenceManagerFactory from the Type dropdown menu.
6. If you plan to deploy the application into the J2EE RI server, select the J2EE RI tab and enter the JNDI name exactly as in Step 4.
7. Click OK to finish.

Jeg ved ikke om det kan være det?
Avatar billede gg Praktikant
18. februar 2002 - 15:23 #13
Virker ikke kan ikke deploye, får følgende fejl:

Sender object Deploytool (Main) : RemoteException occurred in server thread; nested exception is:
        java.rmi.RemoteException: Error while loading JAR C:\j2sdkee1.2.2\repository\baerebarPC\applications\TestApp1014041785754Server.jar; nested exception is:
        javax.naming.InvalidNameException: JNDI name 'ejb/tester' for resource reference 'ejb/tester' is not valid

hvor ejb/tester er det navn jeg laver lookup på, men det vil den ikke godtage :-(
Avatar billede gg Praktikant
05. marts 2002 - 16:23 #14
Fik det aldrig til at virke. Du får pointene mel2000, fordi prøvede at hjælpe. Resulatatet blev at
mit team nu bruger JBuilder, idet den er nemmere og hurtigere
Avatar billede mel2000 Nybegynder
06. marts 2002 - 12:44 #15
Mange tak.. og jeg er ked af at jeg ikke kunne hjælpe...

mel2000
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester



Seneste spørgsmål Seneste aktivitet
I dag 14:04 Pixeline cd’er til PC Af Mathilde i Windows
I dag 01:14 Windows 10 - IIS 10 Af bsn i Windows
I går 20:39 Boot fra USB Af poulmadsen i Windows
I går 11:43 Gmail-ikon på skrivebordet Win 10 Af ErikHg i Fri debat
I går 09:22 Lopslag Af Luffe i Excel