SOLUTION: J2EE Packaging

I've attached a JAR file that contains the code I used to learn how to
package a J2EE application into Weblogic 6.1 SP2. It makes use of the
Class-Path: keyword and shows how to lauch EJB clients via Weblogic's client
container. The code has no comments and you won't find any documentation
other than this message but it did show me how to package up my EJB
components without having to put anything in the global classpath. What
you'll find are 2 EJBs, 1 servlet and 2 EJB client programs. The goal of
the excercise was to simulate seperately developed components being packaged
together into a final J2EE application and show it could be done without
messing with the classpath settings in the startWeblogic.cmd file. The two
EJBs have identical names to verify that name collisions could be avoided.
The com.granite.core.EchoBean accepts a string and simply returns the same
string to the caller, after echoing what it heard to the screen. The
com.granite.service.EchoBean also accepts a string but forwards the string
to the core EchoBean. This was done to set up a dependency between the two
seperately packaged EJBs. Finally, a servlet, packaged up as a WAR file,
calles the service EJB, which then calls the core EJB. Again, this was done
just to set up dependencies. You'll notice that each component makes use of
log4j to log messages. This was done to set up a dependency on a 3rd party
library. I was pleased to find that each component could see all the classes
it needed and only one set of JARs existed in the application. No need to
copy jars into both the EJB jars and the WAR file. I used ANT as my build
tool and did not include weblogic.jar or log4j-1.1.3.jar. You'll need to
acquire those yourself and drop them into the lib directory. Typing ant
will build the entire EAR file and attempt to drop it into the specified
applications directory. You can invoke the servlet via the
http://localhost:7001/granite/HelloWorld URL. Finally, running ant
run-client-launcher will launch Weblogic's client container which invokes
the core EchoBean. It isn't fancy but should help answer some of the
questions I've seen posted to weblogic news groups.
Enjoy,
Ron Kurr
[j2ee-packaging-example.jar]

* You can place it wherever you want.
* That being said, the wherever should be specified as a value relative to the EJB-jar file.
For eg., given the following directory structure:
App-Directory/
|____________Ejb.jar
|____________Web.war
|____________/library/my-utilities.jar
The "Class-Path:" entry value should be "library/my-utilities.jar". Created Ear File but failes to validate through dcmctl validateEarFile -f myapp.ear
Thanks for your prompt reply
Ritesh

Similar Messages

  • Problem to use J2EE Packages in Forte 3.0 CE IDE

    I've got problems in using J2EE Packages in Forte for Java CE 3.0.
    I can't use these Packages with the Forte IDE!
    Example: import javax.jms.*;
    The Error: Can't find javax.jms.* Package
    What can I do to use the J2EE Package in the J2EE.jar?

    I post it so often, with a little bit different titles, cause the chance anybody helps looks better. Many People gave me so much help - but in so many different ways. So I changed the title of my Problem!
    I thank you for your support and help
    Bye

  • J2EE Packaging and manifest Class-Path:

    Does anyone know if Weblogic 6.0 supports the redefined deployment extension mechanism
    that makes use of the 'Class-Path:' entry in the manifest files?
    In our project we have one single .ear file containing a couple of EJB's (.jar
    files) and a Web Application (.war file).
    We are using log4j as logging mechanism and we would like to keep everything in
    the .ear file so that we can make hot-deploys. So we are trying not to make use
    of the classpath in startWebLogic.sh. All of our EJB's and the Web Application
    makes use of log4j.jar. My question is; can I do the following and make it work
    in Weblogic 6.0?
    1. In every EJB .jar file I add the follwing to the manifest file - "Class-Path:
    log4j.jar"
    2. I place the log4j.jar in the root directory of the .ear file.
    By doing this I expect that the ear classloader loads the log4j.jar classes. Am
    I right or do I do something wrong. At least it does not seem to work.
    Using Weblogic 6.0 without service pack.
    Thanks,
    Steen

    This does not work in WebLogic 6.0. It's supposed to be supported in 6.1
    Daniel
    -----Original Message-----
    From: Steen Laursen [mailto:[email protected]]
    Posted At: Wednesday, August 08, 2001 1:32 PM
    Posted To: environment
    Conversation: J2EE Packaging and manifest Class-Path:
    Subject: J2EE Packaging and manifest Class-Path:
    Does anyone know if Weblogic 6.0 supports the redefined
    deployment extension mechanism
    that makes use of the 'Class-Path:' entry in the manifest files?
    In our project we have one single .ear file containing a
    couple of EJB's (.jar
    files) and a Web Application (.war file).
    We are using log4j as logging mechanism and we would like to
    keep everything in
    the .ear file so that we can make hot-deploys. So we are
    trying not to make use
    of the classpath in startWebLogic.sh. All of our EJB's and
    the Web Application
    makes use of log4j.jar. My question is; can I do the
    following and make it work
    in Weblogic 6.0?
    1. In every EJB .jar file I add the follwing to the manifest
    file - "Class-Path:
    log4j.jar"
    2. I place the log4j.jar in the root directory of the .ear file.
    By doing this I expect that the ear classloader loads the
    log4j.jar classes. Am
    I right or do I do something wrong. At least it does not seem
    to work.
    Using Weblogic 6.0 without service pack.
    Thanks,
    Steen

  • J2EE Packaging - Error Loading WebAppClassLoader

    I have seen variations of this theme in the forum, but I am not quite sure if the solutions apply to my situation.
    I have a Java Web Start app deployed and sort of running on JBoss A/S.
    I have treated the Web Start app as a web app and the following is my ear file layout: (I will eventually have MDBs)
    META-INF\application.xml
    META-INF\MANIFEST.MF
    mysql-connector-java-3.1.12-bin.jar
    qsender.jar (just a standalone test app)
    totalvu-servlet.jar - database access servlet
    totalvu.war (the web start app's jar is in here)
    The war file layout:
    META-INF\MANIFEST.MF
    WEB-INF\lib\jardiff.jar
    WEB-INF\lib\jnlp-servlet.jar
    WEB-INF\lib\jnlp.jar
    WEB-INF\jboss-web.xml (inconsequential at this point)
    WEB-INF\web.xml
    totalvu.jar (the web start app's main, etc)
    totalvu.jnlp
    index.html
    shared.jar
    common.jar (servlets wants some of these classes)
    utilities.jar
    moreshared.jars (you get the idea)
    The problem is that inside totalv-servlet.jar there is a servlet that my web start app uses to access a database. This servlet needs to know about some shared classes, so I wanted to keep the servlet jar in the ear file as shown above. Seems like all the docs say that servlets have to go in the WEB-INF\classes folder as loose classes. This seems to be ok if the servlet is to support your canonical web app, but that isn't what I have.
    I have the proper entries in application.xml and web.xml. I actually had this working long enough to fully test the servlet for 3 days and then I started getting "Error Loading WebAppClassLoader" errors during deployment. The class loader for the web app cannot find the servlet that I have defined in the web.xml file even though the app server found it and deployed it along with every other module I had defined in the application.xml file. The app server marked the serlet as unavailable. huh? I am going to guess that the fact that it was working for a while was an anomoly and probably caused by the app server or web start caching something that I didn't realize.
    There must be someone else who has solved this problem before. Where should this database access servlet go, which is used by classes in totalvu.jar?
    Is this totalvu-servlet.jar considered an "Optional Package"? I hope not.
    Thanks in advance, and by the way, I am the only developer on a rather large (humungous) J2EE application so I am basically working in a vaccum here. :)
    Thanks in advance for any help.

    I have seen variations of this theme in the forum, but I am not quite sure if the solutions apply to my situation.
    I have a Java Web Start app deployed and sort of running on JBoss A/S.
    I have treated the Web Start app as a web app and the following is my ear file layout: (I will eventually have MDBs)
    META-INF\application.xml
    META-INF\MANIFEST.MF
    mysql-connector-java-3.1.12-bin.jar
    qsender.jar (just a standalone test app)
    totalvu-servlet.jar - database access servlet
    totalvu.war (the web start app's jar is in here)
    The war file layout:
    META-INF\MANIFEST.MF
    WEB-INF\lib\jardiff.jar
    WEB-INF\lib\jnlp-servlet.jar
    WEB-INF\lib\jnlp.jar
    WEB-INF\jboss-web.xml (inconsequential at this point)
    WEB-INF\web.xml
    totalvu.jar (the web start app's main, etc)
    totalvu.jnlp
    index.html
    shared.jar
    common.jar (servlets wants some of these classes)
    utilities.jar
    moreshared.jars (you get the idea)
    The problem is that inside totalv-servlet.jar there is a servlet that my web start app uses to access a database. This servlet needs to know about some shared classes, so I wanted to keep the servlet jar in the ear file as shown above. Seems like all the docs say that servlets have to go in the WEB-INF\classes folder as loose classes. This seems to be ok if the servlet is to support your canonical web app, but that isn't what I have.
    I have the proper entries in application.xml and web.xml. I actually had this working long enough to fully test the servlet for 3 days and then I started getting "Error Loading WebAppClassLoader" errors during deployment. The class loader for the web app cannot find the servlet that I have defined in the web.xml file even though the app server found it and deployed it along with every other module I had defined in the application.xml file. The app server marked the serlet as unavailable. huh? I am going to guess that the fact that it was working for a while was an anomoly and probably caused by the app server or web start caching something that I didn't realize.
    There must be someone else who has solved this problem before. Where should this database access servlet go, which is used by classes in totalvu.jar?
    Is this totalvu-servlet.jar considered an "Optional Package"? I hope not.
    Thanks in advance, and by the way, I am the only developer on a rather large (humungous) J2EE application so I am basically working in a vaccum here. :)
    Thanks in advance for any help.

  • [原创]在WLS9中使用J2EE Libraries 和 Optional Packages

    J2EE Libraries 和 Optional Packages
    概述
         J2EE Shared Libraries是Diablo的一个新特性。可以将一个J2EE模块共享给其他EAR类型的J2EE模块。你不能从非EAR访问J2EE Shared Library。J2EE Shared Library可以是任何类型的J2EE模块,但推荐打包成EAR。此外还有一种J2EE 1.4的标准共享库方式,称为 Optional Packages。区别在于 Optional Packages是基于标准的,而且不被当作J2EE模块使用。 Optional Packages提供和J2EE Libraries类似的方式将一个JAR文件被多个应用分享。optional packages必须通过部署对应的JAR文件方式先被注册到WLS。注册好后可以部署J2EE模块,通过manifest files来引用这些包。Optional packages和J2EE libraries的区别在于optional packages可以被任何J2EE模块(EAR, JAR, WAR, or RAR 文档)或扩展的目录结构引用。而J2EE libraries只能被EAR引用。
         本文附件exercise包括J2EE Libraries 和 Optional Packages的练习代码,可解压到任意位置。配置一个WLS Domain,记得用户名和密码要都设为weblogic,端口为7001。启动该Domain,并启动相应的Console。使用Domain/bin/setDomainEnv.cmd打开一个Prompt窗口。并把目录切换到你解压的文件的位置。然后就可以按照第五节和六节所述完成练习。如果想快速看一下练习结果,在solution中有已经配置好的两个练习的代码,部署后就可以测试。
    一。将一个应用作为J2EE Libraries或Optional Packages。
         你可以在该应用的META-INF目录下创建一个MANIFEST.MF文件,指定自己的版本。
         Extension-Name:可选。表示该库或包的名字。主调应用调用这个应用时需要匹配这个值。如果你不设置这个值,系统将自动使用部署名。
         Specification-Version:可选。定义这个库或包的规格版本。主调应用可以为共享模块随便指定一个规格版本。如果这个规格版本不可用,则主调应用不能被部署。规格参数可以有两种格式。第一种使用主从版本格式,大小版本号用点分割,如"9.0.1.1"。第二种使用文本格式,如 "9011Beta"。如果使用主从版本号格式,主调应用可以配置为共享的模块吻合一个特定版本,或者一个最小版本,或者一个最新的版本额。如果使用文本格式,主调应用必须和共享模块的版本号严格吻合。
         Implementation-Version:可选。定义这个库或包代码的执行版本号。必须在已经定义了规格版本的情况下才能定义执行版本。执行版本使用和规格版本相同的格式。
         如果你不使用MANIFEST.MF文件或者有些条目没有指定,可以在命令行中通过weblogic.Deploy进行部署的时候由参数来设置。
    二。J2EE Libraries and Optional Packages比较:
         Optional packages和J2EE Libraries有如下共同点:
         1。在部署的时候都注册到WLS上。
         2。都支持可选执行版本和特定版本字符串。
         3。引用J2EE libraries and optional packages的应用可以指定共享文件的版本。
         Optional packages和J2EE Libraries有如下区别:
         1。Optional package是普通的JAR文件,而 J2EE libraries可以是普通JAR文件,或J2EE应用,或独立的J2EE模块。J2EE libraries可以包括有效地J2EE或WLS部署描述符,而optional package JAR中的任何部署描述符都被忽略了。
         2。任何J2EE应用或模块可以通过META-INF/MANIFEST.MF引用 optional package。而只有企业应用可以通过weblogic-application.xml引用J2EE library 。
         3。Optional packages可以引用其他Optional packages,而J2EE libraries不能引用其他J2EE libraries。
    三。最佳实践:
         1。如果需要共享J2EE模块给多个企业应用。使用J2EE Libraries。
         2。如果要部署独立的J2EE模块作为共享库,应该把模块打包到企业应用中。这样可以防止潜在的URI冲突。因为独立模块库的URI来源于不署名。所以在部署时指定一个部署名,当其他应用引用它时作为URI。
         3。如果多个J2EE压缩文件需要共享一些JAVA类,则应该用optional packages。
         4。如果有一些类在本Domain中需要被其他应用调用,而你又不经常省级这些类(比如第三方类),则最好把它们放在Domain的 /lib目录下,而不是使用J2EE libraries或optional packages机制。在/lib子目录下的类会在Server启动时候自动装载到系统环境变量中。
         5。通常指定一个规范版本和一个执行版本。即使你不打算使用版本需要功能。为库指定版本可以在做测试时为共享的文件部署多个版本。
         6。通常为每个库指定一个扩展名,如果你不指定扩展名那系统会自动使用库的部署名作为扩展名。
         7。当开发了一个Web应用要部署成J2EE应用,应该使用唯一的上下文目录。如果它的上下文目录和他依赖的应用的上下文目录冲突,应该使用EAR的weblogic-application.xml中context-root元素来覆盖库的上下文目录。
    四。组装共享的J2EE Library 文件:
         几乎所有独立的J2EE模块或EA可以被部署成shareable J2EE library,但有如下限制:
         1。不能在一个J2EE library中引用另一个J2EE library.
         2。共享库不能嵌套。如果你不属一个EAR作为共享库,那整个这个EAR必须被作为一个库,而不能指定这个EAR中的某个独立J2EE模块为一个独立的库。
         3。像其他J2EE模块和企业应用一样,J2EE library必须被部署到目标Server或Cluster上去。这意味着库需要一个有效的J2EE部署描述符和WLS指定的部署描述符。
         4。推荐把J2EE libraries打包成企业应用,而不是独立的J2EE模块。因为独立模块的URI来自于部署名。默认WLS使用部署压缩文件的文件名或展开的目录名作为部署名。
         5。如果你选择把库部署成独立的J2EE模块,通常应该指定一个部署名并把这个名字作为被应用引用的URI。
    五。练习开发和部署Shared J2EE Library
         本练习在J2EEShared目录下。可以看到有两个目录,其中SharedLibraryEAR是被调用的shareable J2EE library,CallingLibraryEAR是调用该库的企业应用。通过把SharedLibraryEAR配置成共享库,CallingLibraryEAR可以访问LoanEJB就像打包在自己的EAR中。
         1.我们先来开发一个库应用。观察一下SharedLibraryEAR下面的目录结构和文件。
         目录LoanEJB是一个EJB结构。包括一个空的目录META-INF和一个包含一个JAVA文件Simple.java的目录data。LoanEJB\data目录是放EJB的源代码,Simple.java是我手写的。在LoanEJB下执行java com.bea.wls.ejbgen.EJBGen -descriptorDir META-INF data\Simple.java就会在生成SimpleHome.java,SimpleRemote.java,ejb-jar.xml,weblogic-ejb-jar.xml和ejbgen-build.xml。然后到LoanEJB编译这几个CLASS:javac data\*.java,生成根和桩文件。最后执行jar cvf ..\LoanEJB.jar *,打包我们需要的EJB LoanEJB.jar到SharedLibraryEAR目录。
         目录APP-INF是一个空的目录,可以放入当前这个应用需要的第三方包。
         目录META-INF下包括application.xml和weblogic-application.xml。application.xml指定了这个应用所包含的只有一个EAR模块:LoanEJB.jar,以及这个应用的部署名。为了把这个应用做成共享库,现在我们创建一个MANIFEST.MF文件,并在里面写入如下信息:
              Extension-Name: myLib
              Specification-Version: 1.0
              Implementation-Version: 1.0
         然后在J2EEShared下执行java weblogic.appc SharedLibraryEAR,生成可部署的企业应用。
         2.配置 CallingLibraryEAR来引用SharedLibraryEAR模块。观察一下CallingLibraryEAR下面的目录结构和文件。
         目录APP-INF是放EAR内部公用的类和库的目录。在这个练习中不需要使用。
         目录LoanApproval是一个Web应用。index.jsp用于调用EJB LoanEJB的getString方法,而没有指定这个EJB是来自本企业应用还是其他库。如果调用成功,则把在LoanEJB中设置的一个字符串显示在浏览器上。
         目录META-INF中包括application.xml和weblogic-application.xml。application.xml指定了这个应用所包含的只有一个Web模块LoanApproval。在weblogic-application.xml中除了编码方式,我们还要指定使用的共享库的名称。能看到在library-ref中我们指向了SharedLibraryEAR这个库myLib。同时在这个文件中我们还能指定库的规格版本和执行版本,以及是否需要严格匹配等。
         在J2EEShared目录下执行 java weblogic.appc -library SharedLibraryEAR CallingLibraryEAR来预编译JSP。执行后会看到在LoanApproval\WEB-INF\classes下面会生成一个目录jsp_servlet包含JSP被编译成的Servlet__index.class和__error.class。由于在weblogic-application.xml中指定了使用的共享库,所以appc在调用jspc来编译JSP的时候能找到调用的EJB LoanEJB的命名空间以及对应类。
         3。部署共享库和前端企业应用并测试。
         确保你的Server运行的情况下,在J2EEShared下执行下面两个命令来部署SharedLibraryEAR和CallingLibraryEAR。注意执行以前Console不能使被Look状态的。
              java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password weblogic -deploy -library SharedLibraryEAR
         执行之后在Console的Deployments部分能看到新添加了一个名为myLib(1.0)的库,状态为Installed。
              java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password weblogic -deploy CallingLibraryEAR
         执行之后在Console的Deployments部分能看到新添加了一个名为CallingLibraryEAR的应用,状态为Active。
         如果部署成功,在Console和Prompt都不会有报错。打开一个浏览器测试一下:http://localhost:7001/LoanApproval。如果一切正常,会显示在EJB中设置的那行字符串。
         注意,当需要卸载库的时候,必须先卸载引用这个包的所有应用,然后Activate Change,然后再Look,并且卸载库。
    六。练习开发和部署optional packages
         本练习在OptionalPackages目录下。可以看到两个目录,其中SimpappOptionalPackage是被调用的Optional Packages,SimpappEAR是调用该包的企业应用。通过把SimpappEAR配制成共享包,SimpappOptionalPackage可以访问Simpapp类就像打包在自己的EAR中。
         1。我们先来开发一个Optional Packages。观察一下SimpappOptionalPackage下面的目录结构和文件。
         目录META-INF中现在是空的。需要创建一个MANIFEST.MF文件,包括如下内容:
              Extension-Name: myOptionalPackage
              Specification-Version: 0.9
              Implementation-Version: 1
         目录simp下面包含一个源代码文件Simpapp.java。在OptionalPackages\SimpappOptionalPackage\下执行javac simp/Simple.java,会在simp目录下编译出Simple.class。然后执行 jar cvfm simpapp.jar META-INF/MANIFEST.MF *,把这个类打成一个名为simpapp.jar的JAR包。
         2。配置SimpappEAR来引用SimpappOptionalPackage模块。观察一下SimpappEAR下面的目录结构和文件。
         目录APP-INF和我们前面说的一样,就不赘述。
         目录META-INF下包括application.xml和weblogic-application.xml。application.xml指定了这个应用所包含的只有一个Web模块SimpappWebAp。为了把这个应用做成Optional Packages,现在我们创建一个MANIFEST.MF文件,并在里面写入如下信息:
              Extension-List: simpapp
              simpapp-Extension-Name: myOptionalPackage
              simpapp-Extension-Specification-Version: 0.9
         然后在OptionalPackages下执行java weblogic.appc -classpath SimpappOptionalPackage/simpapp.jar SimpappEAR, 生成可部署的企业应用。注意这次我们没在appc中使用-library,因为使用 optional packages的时候不需要获得它的部署描述符。但我们需要指定optional packages模块的位置放到classpath里编译JSP。
         3。部署OptionalPackages和前端企业应用并测试。
         确保你的Server运行的情况下,在OptionalPackages下执行下面两个命令来部署SimpappOptionalPackage和SimpappEAR。注意执行以前Console不能使被Look状态的。
              java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password weblogic -deploy -library SimpappOptionalPackage\simpapp.jar
              java weblogic.Deployer -adminurl t3://localhost:7001 -user weblogic -password weblogic -deploy SimpappEAR
         如果部署成功,在Console和Prompt都不会有报错。打开一个浏览器测试一下:http://localhost:7001/SimpappWebApp/。如果一切正常,会显示在Simple.java中设置的那行字符串。
    七。相关资源。
         http://e-docs.bea.com/wls/docs90/notes/new.html
    该帖由 goblinize 在 Nov 4, 2005 5:43 PM 编辑过

    另外谢谢支持征文活动,让大家先看一下,然后再考虑奖励的事情。希望大家积极参与。
    有什么问题在此积极留言,希望作者给以解答。

  • Solution Packager- Error in the process  (ODBC -2035)

    Dear Expert,
    I got below as error
    Solution SBO Packager 8.81 PL08 - There was an error during the creation of society,
    This entry already exists in the following tables (ODBC -2035)
    Thanks
    Kevin

    Hey,
    Did you get ny solution, because am facing same error.
    Please reply me
    Thanks
    Kevin

  • Solution Packager- Error in the process

    Solution SBO Packager 8.81 PL02 - There was an error during the creation of society,
    This entry already exists in the following tables (ODBC -2035)
    I was using the Packager of SBO and get this error when I load the package file to create a new base.
    I hope someone can help, because this version is released in May and we pass our version 8.8 to this new but before it goes live.
    Regards,
    Erika

    Hey,
    Did you get ny solution, because am facing same error.
    Please reply me
    Thanks
    Kevin

  • Business Package for Learning solutions

    Hi All,
    Can somebody help me on learning solution business package. I have downloaded the package from content portfolio and I am aware there are other related components like LSOCP, LSOAE, LSOOP..
    Can somebody provide me document for complete implementation of LSO. My mail is id [email protected] Any kind of help is greatly appriciated.
    Best Regards,
    Vaishali

    Vaishali,
    Here are some links that may help you.
    [SAP Learning Solution System Landscape|http://help.sap.com/saphelp_erp2005vp/helpdata/en/eb/b3b341800e3231e10000000a155106/frameset.htm]
    [Learning Solution|https://websmp206.sap-ag.de/learningsolution]
    [Setting up SAP LSO on ECC6 with EP|Help on setting up SAP LSO on ECC6 with EP;
    [Business Package for Learning (SAP ERP) 1.0|http://help.sap.com/erp2005_ehp_02/helpdata/en/65/a3a73b6594fc26e10000000a11402f/content.htm]
    Chintan

  • J2EE vs. J2SDK packages

    This is a dumb question, but I'm going to ask it anyhow.
    If my system has neither the J2EE packages or the J2SDK packages on it, will downloading J2EE 1.4 give me all the packages from both J2EE and the J2SDK?
    Charlie

    No, J2EE is built on top of and uses J2SE. You need both.
    %

  • Split Directory Packaging and Deployment Question

    Hello Rob Woollen and All,
    I have a question about packaging and deployment with the "split directory structure"
    in WebLogic Server 8.1.
    Specifically, how does one go about deciding which classes to put in myEnterpriseApp/myWebApp/WEB-INF/classes,
    versus myEnterpriseApp/myEjbModule, versus myEnterpriseApp/APP-INF/classes?
    I think the answer to the first part is easy enough: if there are classes depended
    on by, say, the servlets in a web app, but not depended on anywhere else in the
    enterprise app, then those classes should go in WEB-INF/classes.
    It's the other part of the question that gives me trouble. I use local interfaces
    on my session beans. Let's say I have a domain object class returned from a session
    bean method and depended on by the web app. If I put that domain object class
    under myEnterpriseApp/myEjbModule, then the web app can see it by virtue of the
    classloader arrangement.
    But the wlcompile Ant target supposedly compiles stuff to build/APP-INF/classes.
    What stuff? How does it decide? I haven't experimented and empirically observed
    yet, but I couldn't find the answer in the documentation and tutorials. Is it
    looking for java source files under src/myEnterpriseApp but not under myWebApp
    or myEjbModule? In general, does BEA have any recommendations in this area?
    Thanks,
    Randy

    "Randy Stafford" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi Mark,
    Thanks for the reply. I don't have 8.1 installed yet, so I can'tempirically
    observe the example's behavior. But I downloaded the example andinspected the
    code. It answers some, but not all, of my questions.Where to start.
    In 8.1 we have made optimizations to J2EE packaging. Mostly this is about
    not having to use manifest classpath's to do sharing of of common classes.
    MF Cp's are a pain to configure. You put your classes in one location in
    the ear and then EVERY module has to have a MF CP entry pointing to that
    location, and then you actually have N number of classes loaded per module.
    The mechanism to share classes across all modules is APP-INF/lib and
    APP-INF/classes. The benefit is that APP-INF is shared across all modules.
    So to your question below you could just put it in the EJB module, BUT if
    you have mutliple EJBs that you split into seperate modules your back tot
    the same issue. So APP-INF is just the simplist solution over-all.
    Split-dir is a specified way to lay out disk your src files
    Split-dir
    From code inspection, it looks like the JSP and EJB (therefore the web appmodule
    and EJB module) both depend on the AppUtils class, which is not inAPP-INF, but
    rather in a directory under the enterprise app directory that does notrepresent
    a web app module or EJB module. In the build file's compile target, is itthe
    wlcompile task invocation that causes compilation of AppUtils.java? Or isit
    the ant task invocation (with "build.appStartup" as the value of thetarget attribute)
    that causes compilation of AppUtils.java due to the dependency ofApplicationStartup
    on AppUtils? And what subdirectory of the build directory doesAppUtils.class
    end up in?
    Why not just put AppUtils.java in the EJB module? Both dependent moduleswould
    still be able to see it by virtue of the classloader arrangement. Doesputting
    it in outside of all dependent modules represent a convention that BEArecommends?
    >
    Finally, why not put applicationresource.properties in the same place asits user
    AppUtils.java?
    Thanks,
    Randy
    "Mark Griffith" <[email protected]> wrote:
    Randy:
    (Rob may post later, but here is my take)
    "Randy Stafford" <[email protected]> wrote in message
    news:[email protected]...
    Hello Rob Woollen and All,
    I have a question about packaging and deployment with the "split
    directory
    structure"
    in WebLogic Server 8.1.
    Specifically, how does one go about deciding which classes to put inmyEnterpriseApp/myWebApp/WEB-INF/classes,
    versus myEnterpriseApp/myEjbModule, versusmyEnterpriseApp/APP-INF/classes?
    I think the answer to the first part is easy enough: if there are
    classes
    depended
    on by, say, the servlets in a web app, but not depended on anywhereelse
    in the
    enterprise app, then those classes should go in WEB-INF/classes.
    It's the other part of the question that gives me trouble. I use localinterfaces
    on my session beans. Let's say I have a domain object class returnedfrom
    a session
    bean method and depended on by the web app. If I put that domain
    object
    class
    under myEnterpriseApp/myEjbModule, then the web app can see it by
    virtue
    of the
    classloader arrangement.
    But the wlcompile Ant target supposedly compiles stuff tobuild/APP-INF/classes.
    What stuff? How does it decide?wlcompile has a module factory. If a directory is claimed by a module
    factory then it is compiled by that specific module compiler. The rules
    for
    module definition follow the same J2EE formatting rules.
    So:
    /myejb/
    would be identified as a ebj module by:
    */myejb/meta-inf/ejb-jar.xml
    */myejb/myejb.ejb (EJBGen file)
    then src files (*.java) will be compiled to
    $BUILD_DIR/myejb/
    /myweb/
    would be identifid as a web module by:
    */myweb/WEB-INF/web.xml
    Also for webapps
    /myweb/WEB-INF/src/*.java
    will be compiled ot
    $BUILD_DIR/myweb/WEB-INF/classes
    We choose WEB-INF/src following the struts precedence.
    So a plain old module that has noting but .java files in it will go to
    $BUILD_DIR/APP-INF/classes
    If you have a jar of classes that you need to share across the entire
    ear,
    you would check it into your src tree at:
    $SRC_DIR/APP-INF/lib/mycommon.jar
    You can check out an example at:
    $BEA_HOME/weblogic81/samples/server/examples/src/examples/splitdir/helloWorl
    dEar
    Hope this helps.
    cheers
    mbg
    I haven't experimented and empirically observed
    yet, but I couldn't find the answer in the documentation and tutorials.Is it
    looking for java source files under src/myEnterpriseApp but not undermyWebApp
    or myEjbModule? In general, does BEA have any recommendations in thisarea?
    Thanks,
    Randy

  • Packages, import and Inheriting with static

    Hello.
    I am programming a program, in which the main class (file: Main.java) uses objects declared in Components.java.
    The problem is, the import of the components only works if I explicitly make the main class inherit from the components class with whose objects being declared as 'static'. A simple import instruction, the way I learned it, in the main class such as 'import <project>.components;' does not work.
    Sample code:
    Current state; working
    Main.java:
    package <project>;
    public class Main extends Components {  
        public static void main(String[] args) {
            start();
    }Components.java:
    package <project>
    public class Components {
        public static void start() {
            // code
    }Desired:
    Main.java
    package <project>;
    import <project>.components;
    public class Main {  
        public static void main(String[] args) {
            start();
    }Components.java:
    package <project>
    public class Components {
        public void start() {
            // code
    }How to realize this idea into a working program?
    Thanks in advance!

    I apologize for not conveying my problem proberly, but you have to know I did not learn Java with reference material in the English language, therefore it might happen that some terms are not translated correctly (by me) and thus not equaling the standardised terms.
    Anyway, let me try to rephrase my problem.
    I want to use the object declared in Components.java in the main class/main methode of the file Main.java. In order to achieve this goal I used inheriting, concretely the main class inherits from the components class, as a makeshift to use Components.java's objects in the main class. However this is not the way I want to accomplish my objective with.
    To make a long story short I just want to utilise Components.java's object in Main.java's main method. The manner to achieve this does not matter, though I want to do it preferably with 'import'.
    Hope this clears things up. Thank you anyway.
    Edited by: Ikaragua on May 31, 2008 6:00 AM
    Solution found.
    package project;
    public class Main {  
        public static void main(String[] args) {
            Components.start();
    }

  • IViews/Business Packages  for News and/or Unit Converter

    Hallo,
    are there any iViews or Business Packages available for the following tasks?
    1. News iView with the possibility to refer to documents, have user (role) specific buttons (Create New, Edit, delete...) and Subscription Services using the cm-functionality
    2. An Unit Converter, to convert some specific items like length, weights...?
    Please let me know.
    Sebastian Traeder

    Hi Sebastian,
    for the first request, easyWCM seems to be quite close. It's a business package which closes some gaps in the standard, for example that there is no connection between the PCD and the KM structure; that there is no internationlization feature in KM; that there is no dynamic switch so that users with the corresponding permissions are confronted with extra possibilities (like create/edit...) whereas endusers only see the content - and all this by using just one PCD structure.
    See http://www.easyWCM.com
    For the second request, I don't expect that there is a special portal solution / business package. But for sure you will find java libs / example implementations on the internet, which easily could be build into some iView implementation.
    Hope it helps
    Detlev

  • Error:System.Web.HttpUnhandledException in Custom Web part for Sandbox solution

    Please Help...
    I have a sandbox solution for Custom Web part which has a 'Visual Web Part(sandbox)'.
    The solution builds, Packages & deploys successfully.
    But when adding this custom web part on a Sharepoint 'Web Part Page' it throws up the below Error:
    Same code when deployed as a Farm Solution works all well.
    Only difference between the two solutions being Farm solution has  'Visual web part'
    and Sandbox solution has 'Visual web part(sandbox)'
    ERROR:
    ======================================================
    [SPUserCodeSolutionExecutionFailedException: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.]
     Server stack trace:
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeAppDomain.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcessProxyForShim.ExecuteInternal(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcessProxy.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
     Exception rethrown at [0]:
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.ExecuteDelegate.EndInvoke(IAsyncResult result)
      at Microsoft.SharePoint.UserCode.SPUserCodeWorkerProcess.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, SPUserToken userToken, String currentAffinity, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodePoolableProcessConnection.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeExecutionHost.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinity, SPUserCodeExecutionContext executionContext)
      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
      at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
     Exception rethrown at [1]:
      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
      at Microsoft.SharePoint.Administration.ISPUserCodeExecutionHostProxy.Execute(Type userCodeWrapperType, Guid siteCollectionId, SPUserToken userToken, String affinityBucketName, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeExecutionManager.Execute(Type userCodeWrapperType, SPSite site, SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.<>c__DisplayClassa.b__9()
      at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartRemoteExecutionHelper.ExecuteRequestInSandBox(HttpContext context, SPWeb web, SPWebPartManager manager, SPUserCodeWebPart userCodeWebPart)
    [HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.]
     Server stack trace:
      at System.Web.UI.Page.HandleError(Exception e)
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      at System.Web.UI.Page.ProcessRequest()
      at System.Web.UI.Page.ProcessRequest(HttpContext context)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.ExecuteHttpRequest(SPUserCodeWebPartHttpRequestContext webPartExecutionContext, SPUserCodeWebPartHttpResponse httpRequestResponse)
      at Microsoft.SharePoint.UserCode.SPUserCodeWebPartWrapper.Execute(SPUserCodeExecutionContext executionContext)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.ExecuteWrapper(SPUserCodeWrapper wrapper, SPUserCodeExecutionContext executionContext)
      at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
      at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
     Exception rethrown at [0]:
      at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
      at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.CodeToExecuteWrapper.EndInvoke(IAsyncResult result)
      at Microsoft.SharePoint.UserCode.SPUserCodeApplicationHostAppDomainRef.Execute(Type userCodeWrapperType, SPUserCodeCachedAssemblyGroup userAssemblyGroup, Guid siteCollectionId, Byte[] binaryUserCodeToken, Byte[] proxyOperationToken, SPUserCodeExecutionContext
    executionContext)
    [InvalidOperationException: Using Menu.DynamicHoverStyle requires Page.Header to be non-null (e.g. <head runat="server" />).]
      at System.Web.UI.WebControls.Menu.EnsureRenderSettings()
      at System.Web.UI.WebControls.Menu.OnPreRender(EventArgs e, Boolean registerScript)
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Control.PreRenderRecursiveInternal()
      at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Hi!!
    Sure, Please find .cs and .ascx script below
    ==========.ascx===========================
    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
    <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
    <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DynamicMenuWP.ascx.cs" Inherits="MenuWebPartProject.DynamicMenuWP.DynamicMenuWP" %>
    <asp:Menu ID="siteStructure" runat="server" Orientation="Horizontal"  StaticPopOutImageTextFormatString="" DynamicHoverStyle-BackColor="#CBE3F0" SkipLinkText=""
                                            StaticSubMenuIndent="10px"
    BackColor="#000000" CssClass="BIMenu" Font-Names="Verdana" Font-Size="1em"  DynamicHorizontalOffset="2" onmenuitemclick="siteStructure_MenuItemClick" Target="_blank">
                                            <StaticSelectedStyle
    BackColor="#507CD1" />
              <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" CssClass="BIMenuStaticformenu" />
              <DynamicHoverStyle BackColor="#CBE3F0" />
              <DynamicMenuStyle BackColor="#F2F3F4" BorderColor="#A7B4CE" ForeColor="Black" />
              <DynamicSelectedStyle BackColor="#507CD1" />
              <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" CssClass="BIMenuDynamicForMenu" />
            <StaticHoverStyle BackColor="#284E98" ForeColor="White" />
    </asp:Menu>
    ==========.cs===========================
    using System;
    using System.ComponentModel;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    namespace MenuWebPartProject.DynamicMenuWP
        [ToolboxItem(false)]
        public partial class DynamicMenuWP : System.Web.UI.WebControls.WebParts.WebPart
            protected override void OnInit(EventArgs e)
                base.OnInit(e);
                InitializeControl();
            protected void Page_Load(object sender, EventArgs e)
                if (!IsPostBack)
                    ScorecardStructure ss;
                    List<ScorecardStructure> listSS = new List<ScorecardStructure>();
                        using (SPWeb web = SPContext.Current.Web)
                            SPList lists = web.Lists["MenuItems"];
                            if (lists.ItemCount > 0)
                                foreach (SPListItem item in lists.Items)
                                    ss = new ScorecardStructure();
                                    ss.title = Convert.ToString(item["Title"]);
                                    ss.ParentID = Convert.ToInt32(Convert.ToString(item["Parent ID"]));
                                    ss.ParentName = Convert.ToString(item["Parent Name"]);
                                    ss.MenuID = Convert.ToInt32(Convert.ToString(item["Menu ID"]));
                                    ss.menuName = Convert.ToString(item["Menu Name"]);
                                    ss.url = Convert.ToString(item["URL"]);
                                    ss.friendlyName = Convert.ToString(item["Friendly Name"]);
                                    listSS.Add(ss);
                    if (listSS.Count > 0)
                        List<ScorecardStructure> y = listSS.Where(s => s.ParentID == 0).ToList<ScorecardStructure>();
                        foreach (var x in y)
                            MenuItem newMenuItem = new MenuItem(x.menuName.ToString(), x.MenuID.ToString());
                            siteStructure.Items.Add(newMenuItem);
                            AddChildMenuItems(listSS, newMenuItem);
            private void AddChildMenuItems(List<ScorecardStructure> menuData, MenuItem parentMenuItem)
                if (menuData.Count > 0)
                    List<ScorecardStructure> childItems = menuData.Where(s => s.ParentID == Convert.ToInt32(parentMenuItem.Value)).ToList<ScorecardStructure>();
                    foreach (var v in childItems)
                        MenuItem newMenuItem = new MenuItem(v.menuName.ToString(), v.MenuID.ToString());
                        newMenuItem.NavigateUrl = v.url.ToString();
                        parentMenuItem.ChildItems.Add(newMenuItem);
                        // This code is used to recursively add child menu items filtering by ParentID
                        AddChildMenuItems(menuData, newMenuItem);
            protected void siteStructure_MenuItemClick(object sender, MenuEventArgs e)
                string st = e.Item.NavigateUrl;
                if (!(st.Equals(string.Empty)))
                    HttpContext.Current.Response.Redirect(st);
            class ScorecardStructure
                public string title { get; set; }
                public int ParentID { get; set; }
                public string ParentName { get; set; }
                public int MenuID { get; set; }
                public string menuName { get; set; }
                public string url { get; set; }
                public string friendlyName { get; set; }
            public bool IsPostBack { get; set; }

  • Question about JMS package

    Dear all,
    I installed J2EE package, and I thought it will include javax.jms.*. However, the netbean still tell me that the package is not installed. Could you please tell me what should I install to include javax.jms ??
    thanks

    use this
    http://www.alphaworks.ibm.com/tech/jarclassfinder

  • Where to package my interfaces

    It seems that the general rule to making a GUI application is to seperate the "Business Logic" from the "Presentation Logic". From this, I'm guessing I'll need to package all my GUI stuff together, and all the business logic layer stuff together.
    The GUI will then talk to the Biz lay through an interface right?
    This is not a single file right? Would this would be a set of interfaces all packaged together? If so, where is the most common place to package it?
    Or perhaps I'm completely wrong... any suggestions appreciated, thanks!!!

    It seems that the general rule to making a GUI
    application is to seperate the "Business Logic" from
    the "Presentation Logic". This is absolutely true.
    From this, I'm guessing I'll
    need to package all my GUI stuff together, and all the
    business logic layer stuff together.If you mean the package names and structure then I would had adapted this structure:
    1. I will have a package under which I will put the application common classes and interfaces.
    com.myapp.common.eventhandler.EventHandler (interface)
    com.myapp.common.eventhandler.AbstractEventHandler (default implementation)
    com.myapp.common.form.Form (interface)
    com.myapp.common.form.AbstractForm (default implementation)2. Create for each subject area its own package:
    com.myapp.product.AddNewProductForm
    com.myapp.product.AddNewProdcutEventHandler
    com.myapp.sales.PriceListEeventHandler
    com.myapp.sales.PriceListEeventHandler
    The GUI will then talk to the Biz lay through an
    interface right?As I illustrated through my previous example, you should have common interfaces and you might need to create Abstract classes that encapsulates the common implementation for these interfaces, then for each GUI Form or Web Page you will create its specific implementation class which inherits from the abstract class.
    Finally if you were asking about the deployment packaging:
    1. Create for each EJB its own jar file then bundle these Jar files under one module jar file, which represents the EJB module.
    2.Package the web application (JSP, Servlets, HTML, Images, CSS, and Java script) in one Web module WAR file.
    3. Package your client application module in its own jar file.
    4. Assemble the EJB module Jar, Web module War, and Client module Jar in one J2EE package which will be an EAR file so that your whole package will be assembled in one EAR file at the end.
    Try the "Application Assembly Tool" which comes with WebSphere. It will organize your application and facilitate this kind of integration.
    - Sherif.

Maybe you are looking for