Embedding JBoss Naming In My Own Java Application

Hi all,
Thanks in advance for taking the time and effort to answer my question.
I'm trying to embed the JBoss naming server in my own Java application. I'm using the code from version 4.2.1.GA. I've thoroughly read the Java code, and found it a little confusing. Among other classes, I've read the code from org.jboss.naming.NamingService and org.jnp.server.Main. I've been trying for days with no luck. Here's a class from my simplest attempt:
// Server.java
package miaJs.server;
import org.apache.log4j.Logger;
import org.jboss.naming.NamingService;
import org.jnp.server.Main;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.impl.StdSchedulerFactory;
public class Server
* Logger for this class.
private static final Logger logger =
Logger.getLogger("miaJs.server.Server");
* Start the server.
public void start()
logger.debug("Server ClassLoader: " +
this.getClass().getClassLoader().getClass().getName());
try
logger.debug("Starting JBoss naming server...");
Main namingServer = new Main();
namingServer.start();
catch (Throwable t)
logger.error("Error starting Java Job Scheduler: " +
t.getMessage(),
t);
System.exit(1);
try
// Register a shutdown hook
ServerShutdownHook shutdownHook = new ServerShutdownHook();
Runtime.getRuntime().addShutdownHook(shutdownHook);
catch (Throwable t)
logger.error("Error adding server shutdown hook: " +
t.getMessage(),
t);
System.exit(1);
The above example gives me the following NullPointerException:
lljava.lang.NullPointerException
jvm 1 | at org.jnp.server.Main.getNamingInstance(Main.java:301)
wrapper | Pause reading child output to share cycles.
wrapperp | socket read failed. (An established connection was aborted by the software in your host machine. (0x2745
jvm 1 | at org.jnp.server.Main.initJnpInvoker(Main.java:354)
jvm 1 | at org.jnp.server.Main.start(Main.java:316)
jvm 1 | at miaJs.server.Server.start(Server.java:45)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
jvm 1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
jvm 1 | at java.lang.reflect.Method.invoke(Method.java:585)
wrapper | Pause reading child output to share cycles.
wrapperp | server listening on port 32000.
jvm 1 | at miaJs.server.Bootstrap.start(Bootstrap.java:135)
jvm 1 | at miaJs.server.Bootstrap.main(Bootstrap.java:76)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jvm 1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
jvm 1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
jvm 1 | at java.lang.reflect.Method.invoke(Method.java:585)
jvm 1 | at org.tanukisoftware.wrapper.WrapperStartStopApp.run(WrapperStartStopApp.java:238)
jvm 1 | at java.lang.Thread.run(Thread.java:595)
I've tried the JBoss forum but it didn't help.
What I really want is a simple in-memory JNDI server that doesn't have external dependencies. I really hope the JBoss naming service can achieve this.
Thanks again.

I'm sorry, we don't generally have that kind of information in this forum. I'd suggest asking the developer of the add-on. If you're using [https://addons.mozilla.org/en-us/firefox/addon/selenium-expert-selenium-ide/ Selenium Expert (Selenium IDE)], the support link listed is http://blog.reallysimplethoughts.com/

Similar Messages

  • How can i build RPMs file for my own Java Application?

    How can i build RPMs file for my own Java Application?....I have my own directory that contains all Java Source files and some files that my Application required....I want to build RPMs file like a install File to Linux System, Now my OS is Linux Fedora core 1.....How can i do this?

    I think that in order to create a RPM, you'd need to
    use some C.Nope - the RPM is all about packaging and the "magic" x.spec file. You can have anything you want in the RPM, but you have to use RPM tools to build the .rpm file. One of the features is that you can also indicate (via "install" scripts) modifications to other files or the filesystem to support the installation of whatever's in the RPM.

  • How can I manipulate Selenium IDE addon in my own java application..??

    How can I manipulate Selenium IDE addon using my own java application..??
    Is there any .jar file available for it..??
    Actually I'm working on a project of automation framework. For this I want to link the "Record" button and "Menu bar"(at the top of the IDE).
    I'm using Eclipse on Win7 Ultimate(x64).
    Please provide the required links or documentations.
    I would really appreciate your kind help..

    I'm sorry, we don't generally have that kind of information in this forum. I'd suggest asking the developer of the add-on. If you're using [https://addons.mozilla.org/en-us/firefox/addon/selenium-expert-selenium-ide/ Selenium Expert (Selenium IDE)], the support link listed is http://blog.reallysimplethoughts.com/

  • Licensing issues for selling our own java app.

    hi guys,
    I am just wondering whether it is legal to write our own java applications and sell them to the public. Do I need to obtain a license from SUN or other third parties that provide me the support libraries(for example apache xalan, etc...)? You know, we are just normal individuals, there is no way we can afford the license.

    If you have to include code that you didn't write (library or otherwise), ...Last time I checked the JRE could be distributed by a user. The JDK could not. If one uses only the the documented classes in the JDK/JRE then only the JRE is needed. If one is using any other products/api/undoc'd like javamail, j2ee, jmdk, etc then the license will have to be looked at.
    Stuff from free ware sources generally have varying restrictions. This can often include the demand that the product must be made available in source code form. There can be other variations, so the license for each download should be checked.

  • Looking up external JNDI (JBOSS Namely) from web applications.

    Hi,
    I am unable to look up names bound to JBOSS JNDI from external web apps.
    Dump of the JBOSS JNDI
    java: Namespace
    +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- DefaultDS (class: javax.sql.DataSource)
    +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
    +- ABTestDS (class: javax.sql.DataSource)
    +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
    +- comp (class: javax.naming.Context)
    +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
    +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- jaas (class: javax.naming.Context)
    | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
    | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
    | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
    +- timedCacheFactory (class: javax.naming.Context)
    Failed to lookup: timedCacheFactory, errmsg=null
    +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
    +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
    +- Mail (class: javax.mail.Session)
    +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
    +- TransactionManager (class: org.jboss.tm.TxManager)
    +- hibernate (class: org.jnp.interfaces.NamingContext)
    | +- SessionFactory (class: org.hibernate.impl.SessionFactoryImpl)
    Global JNDI Namespace
    +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
    +- UserTransactionSessionFactory (proxy: $Proxy11 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
    +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- console (class: org.jnp.interfaces.NamingContext)
    | +- PluginManager (proxy: $Proxy37 implements interface org.jboss.console.manager.PluginManagerMBean)
    +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
    +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
    +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- topic (class: org.jnp.interfaces.NamingContext)
    | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
    | +- testTopic (class: org.jboss.mq.SpyTopic)
    | +- securedTopic (class: org.jboss.mq.SpyTopic)
    +- queue (class: org.jnp.interfaces.NamingContext)
    | +- A (class: org.jboss.mq.SpyQueue)
    | +- testQueue (class: org.jboss.mq.SpyQueue)
    | +- ex (class: org.jboss.mq.SpyQueue)
    | +- DLQ (class: org.jboss.mq.SpyQueue)
    | +- D (class: org.jboss.mq.SpyQueue)
    | +- C (class: org.jboss.mq.SpyQueue)
    | +- B (class: org.jboss.mq.SpyQueue)
    +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
    +- jmx (class: org.jnp.interfaces.NamingContext)
    | +- invoker (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor (proxy: $Proxy36 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
    | +- rmi (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
    +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
    +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
    +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
    I have an external web application that has
    jndi.properties in the classpath -- JBOSS is running on localhost
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=jnp://localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    web.xml for my external webapp
    <resource-ref>
    <res-ref-name>jdbc/ABTestDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <resource-ref >
    <res-ref-name>hibernate/SessionFactory</res-ref-name>
    <res-type>net.sf.hibernate.SessionFacory</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    Mycode:
    try {
    Context ctx = new InitialContext();
    sessionFactory = (SessionFactory) ctx.lookup("java:comp/env/hibernate/SessionFactory");
    } catch (ClassCastException cce) {
    throw new ServiceLocatorException(cce);
    } catch (NamingException ne) {
    throw new ServiceLocatorException(ne);
    I get a NamingException.
    Any hints would be really appreciated.
    thanks
    MH

    I have hte same question
    Hey DID you figure it out?
    let me know please
    maybe by email:
    [email protected]
    THANKS A LOT

  • Embedding video in Java Application

    I'm a total newbie, trying to decide if Java is the way to go for our application.
    We want to be able to create an interactive application with buttons, drag & drop, data input fields, hot spots, etc
    AND also show video... windows format, apple format, flash format.
    We want our application to be deployable either as...
    1 - a standalone app... running on a system not on a network or the internet
    2 - a web app
    We want the video player to be embedded in the application and not launch a player in a seperate window... thus we want to maintain as much control within the confines of our application as possible.
    MY QUESTIONS:
    1 - Will the Java Media Framework allow us to embed movies in our application as described?
    2 - Is it fairly easy to code such in our Java application?
    3 - Any code snippets around?
    4 - Re: Standalone/CD distribution version: Can the JMF be installed along with the application so the client doesn't have to "go out and install more stuff" ??
    5 - Re: Web - must the user download and install more stuff... other than the Java Virtual Machine to have the JMF work on their system?
    6 - Is the JMF multi-platform... Windows, Apple, Unix/Linux, etc like the JVM ?
    thanks for any help on this. Will

    Yes all of what you require is doable in Java
    Try
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/index.html
    Check some of these samples
    Also for a web version check
    http://java.sun.com/dev/evangcentral/totallytech/jmf2.html
    (Haven't studied this myself - but should give you an idea or two)
    Platform-wise - check here
    http://java.sun.com/products/java-media/jmf/2.1.1/download.html
    In terms of CD distribution - you should be able to package most stuff into a Jar file
    Not completely sure as there are 'Windows Performance pack' downloads which I think toake advantage of native DLLs
    Have a read around the JMF Installation pages - should answer most of your questions

  • How can my java application get its own PID?

    My java application runs under AIX?
    The application needs to get its own PID.
    There is a possibility to get it by
    Runtime.exec("ps -ef | grep <user.name>");
    But is there any other alternate possibility?
    Any idea would be great appreciated
    kind regards

    Hello! I found several ways for this in a blog from someone called Igor Minar on
    http://net3x.blogspot.com/2007/03/how-java-application-can-discover-its.html
    He found several ways:
    * Use Java management and monitoring API
    ManagementFactory.getRuntimeMXBean().getName();returns something like
    1826@localhost
    where 1826 is the PID of the JVM process, i.e. my application's process. But this hack is JVM dependent and may not work on JVM's other than Sun's
    * Use a shell script to put a property in place that is set to the PID:
    exec java -Dpid=$$ -jar myapp.jar* Java Native Interface - cumbersome and platform dependent solution
    * Use procfs (Linux solution: read /proc/self, nifty nifty, posted in the comments of the resp. post!)
    int pid = Integer.parseInt( ( new File("/proc/self")).getCanonicalFile().getName() );* From another comment: Reflection will work (on Unix): The Process class has a field called pid which can be queried:
    static int getPID(Process process) throws IllegalAccessException, IllegalArgumentException,
                                                                      NoSuchFieldException, SecurityException
         Field field = process.getClass().getDeclaredField("pid");
         field.setAccessible(true);
         return field.getInt(process);
    }But this solution looks a bit of a kludge to me. I think the /proc/self solution is best - it definitely rox my sox!
    Hope this helps!

  • Embedded Tomcat Java Application

    Hi
    I am using an Embedded Tomcat Java Application.
    I am getting the following Exception when i run the program.
    java.lang.NullPointerException
         at org.apache.catalina.startup.DigesterFactory.register(DigesterFactory.java:174)
         at org.apache.catalina.startup.DigesterFactory.registerLocalSchema(DigesterFactory.java:130)
         at org.apache.catalina.startup.DigesterFactory.newDigester(DigesterFactory.java:92)
         at org.apache.catalina.startup.ContextConfig.createWebXmlDigester(ContextConfig.java:435)
         at org.apache.catalina.startup.ContextConfig.createWebDigester(ContextConfig.java:422)
         at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:499)
         at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:623)
         at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
         at org.apache.catalina.startup.Embedded.start(Embedded.java:846)
         at EmbeddedTomcat.startTomcat(EmbeddedTomcat.java:77)
         at EmbeddedTomcat.main(EmbeddedTomcat.java:135)
    could anyone tell me how to solve this problem
    Thanx & Regards
    Faisal

    Hi
    R u able to resolve the problems.... If yes please provide me the info... I'm also facing the same problem...
    REgards
    siddhu

  • Embedding a java application (servlets) in a portlet

    Hi all,
    We have an existing java application that we want to run as a portlet in our portal internet site. The application is a simple search form, which submits parameters (search criteria) and returns results, from there can click on a few other things and open some documents etc. We want all this to happen in the same portlet window, rather than opening out to a new window. Can someone please advise if this can be done? We are running release 1 of 9IAS (and we can't upgrade to rel 2 yet) with PDK March. We would preferably like to do this without touching/reprogramming the java code. I have seen a couple of conficting posts in this forum about this - some say can be done, some say can't be done. Please advise:
    1. Is there some kind of wrapper that can be applied to keep this app inside the portlet?
    2. What other alternatives are there to getting this java app inside?
    3. Are there any step by step guides to doing this?
    Any help would be much appreciated. Thanks heaps, Sarah

    I have tried the URL services, it displays the page fine within the portlet. Just one problem though. The links that are embedded in the HTML will open new windows when clicked. We want them to stay within the portlet. Does something need to be changed in my xml file? I have
    <renderer class="oracle.portal.provider.v1.RenderManager">^M
    <showPage class="oracle.portal.provider.v1.http.URLRenderer">^M
    <contentType>text/html</contentType>^M
    <pageExpires>60</pageExpires>^M
    <pageUrl>http://www.oracle.com</pageUrl>^M
    <filter class="oracle.portal.provider.v1.http.HtmlFilter">^M
    <headerTrimTag>&lt;center</headerTrimTag>^M
    <footerTrimTag>/center></footerTrimTag>^M
    <convertTarget>true</convertTarget>^M
    </filter>^M
    </showPage>^M
    </renderer>^M
    perhaps I need a different renderer? I saw another post had something in the xml :
    <inlineRendering>true</inlineRendering>
    that looks promising. Will that deliver the results I'm looking for? Where does it get added?
    Thanks for any replies. Sarah

  • Embedding Internet Explorer GUI in Java Application

    let me preface this post by saying that i have seen the javatip66 reference on javaworld.com and that has considerable merit. i may end up using that methodology.
    what i would like to be able to do, of course, is to embed JUST the "HTML pane" of IE/Netscape (excluding ToolBar and Address Bar, etc) inside a Java application. i am not an MFC developer, so i'm not sure where to begin looking or if JNI will allow me to hack that dll.--or even if that canvas/panel/whatever can be invoked independently to render a document.
    i have several complete, fully working GUI applications that use the javax.swing.JEditor interfaces to display various mime formatted documents (content types such as "text/html" and "text/plain"). unfortunately, the Java implementations of these Editors don't sync with what everyone is used to in IE/Netscape...to the degree that content is intractably mis-displayed (is that a word?)
    worst case scenario, i will invoke a new browser to display content, but i would prefer to frame those browsers in my applications. thoughts?
    note: one of the primary problems is the the JFC classes support only up to HTML 3.2 which is as good as archaic these days.

    i think you just nailed it. i do imagine that this is the correct forum for this, but i could cross-post to the Swing forum. certainly it is going to require switching on the version of Windows. perhaps we can find a general/create a discussion on integrating ActiveX controls in Java. [man, this is just the most bass ackwards thing ever. hate doing this kind of thing, but it's the "state of the world."] (at least until Sun/3rd party gets a reasonable HTML document renderer.)

  • Embedding Google earth in Java Application

    I have developed a java application with help of wings i wanna embed google earth can sum1 guide from were to proceed plz

    Hitish wrote:
    I have developed a java application with help of wings i wanna embed google earth can sum1 guide from were to proceed plzPlease don't use silly SMS speak.
    Embed Google Earth? Does it have any exposed APIs. If not then no.

  • Vst embedded in java application?

    hi
    I am writing here because I was redirected.
    I would like to know if it is possibile and where to find information and resources to do this:
    calling a vst virtual instrument from a java application displaying it in a frame and controlling it by calls.
    thanks

    vst is for "virtual instrument", a technology from steinberg.
    this kind of programs are dlls and are used in sequencer environments like cubase.
    a vst is a dll file that cubase or this sort of software can load and communicate with by function calls. it has a gui too to tweak its parameters.
    so, I ask someone who knows how all this work to please help with some information.
    thanks

  • Trying to do the simple HelloWorld java application for portal

    Hi:
    i've been trying to do the simple java application HelloWorld so that i can get a view of how will it be to integrate a pure java application that we have in a later step. The fact is that i've been following "how to build a java portlet" and "packaging and deploying your provider" documents.
    i've taken the code from that document:
    public class HelloWorldApp {
    public static void main (string[] args){
    //Display "Hello World!"
    System.out.println("Hello World!");
    That's my java code. (in fact i want to do this as a trial, 'cause later i will
    do the same with a java application of our own).
    So i compiled it, taken the .class, jar it and packaged it as told in the
    second document.
    I've deployed it in OC4J_portal and when i try to access the URL i get an
    error:
    500 Internal Server Error
    java.lang.NoSuchMethodException
         at java.lang.Class.getMethod0(Native Method)
         at java.lang.Class.getMethod(Class.java:888)
         at oracle.portal.provider.v2.render.http.JavaRenderer.postInitialize(Unknown Source)
         at oracle.portal.utils.xml.v2.DefaultNodeHandler.invokePostInitialize(Unknown Source)
         at oracle.portal.utils.xml.v2.DefaultNodeHandler.processNode(Unknown Source)
         at oracle.portal.utils.xml.v2.DefaultNodeHandler.processNode(Unknown Source)
         at oracle.portal.utils.xml.v2.DefaultNodeHandler.processNode(Unknown Source)
         at oracle.portal.provider.v2.http.DefaultProviderLoader.getProviderDefinition(Unknown Source)
         at oracle.portal.provider.v2.http.DefaultProviderLoader.init(Unknown Source)
         at oracle.webdb.provider.v2.adapter.soapV1.ProviderAdapter.init(Unknown Source)
         at oracle.webdb.provider.v2.utils.soap.SOAPProcessor.locateService(Unknown Source)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.doHTTPCall(Unknown Source)
         at oracle.webdb.provider.v2.adapter.SOAPServlet.service(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
         at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:59)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
         at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:523)
         at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:269)
         at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:735)
         at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].server.http.AJPRequestHandler.run(AJPRequestHandler.java:151)
         at com.evermind[Oracle9iAS (9.0.2.0.0) Containers for J2EE].util.ThreadPoolThread.run(ThreadPoolThread.java:64)
    does anybody know how to solve this problem?
    Thx.
    Regards. Urko.

    Hi Urko,
    Such an application as you have quoted will not have much luck as a Portlet - the code you supplied simply writes "Hello World" to standard out!
    Think of a portlet more like a servlet - you have an output stream to write to which, under the covers, is wired back up to the Portal Server which assembles the content into the page seen in the browser.
    Take a look at the extensive range of sample Java Portlets available with the PDK download.
    Anyway, from the stack trace it looks like you're using JavaRenderer. JavaRenderer invokes an arbitrarily named method on an arbitrary class **provided** that method takes a single argument of type PortletRenderRequest. So you would need something like:-
    public class MyApp
    // A bunch of app-specific code.
    public void renderPortlet(PortletRenderRequest pr)
    PrintWriter out = pr.getWriter();
    out.println("<b>Hello World</b>");
    Then, the relevant provider.xml section would look something like this....
    <showPage class="oracle.portal.provider.v2.render.http.JavaRenderer>
    <className>MyApp</className>
    <renderMethod>renderPortlet</renderMethod>
    </showPage>
    Hope this helps.....
    Regards,
    Gareth
    PDK-Java Development Team

  • Help please! Java application and web application...

    Hi,
    I have a problem with inserting a java application (Main.java) in a web application(index.jsp).
    I found a source demo of a drag and drop application on the Internet, but now I want to
    have the drag and drop application work in a Jpanel/JFrame in a webapplication.
    The drag and drop application code:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class Main {
        public static void main(final String[] args) {
            final ButtonGroup grp = new ButtonGroup();
            final JPanel palette = new JPanel(new FlowLayout(FlowLayout.LEFT));
            palette.setBorder(BorderFactory.createTitledBorder("Palette"));
            final MainPanel mainPanel = new MainPanel();
            mainPanel.setPalette(palette);
            for(int j=0; j<4; j++){
                final JToggleButton btn = new JToggleButton("Panel "+(j+1));
                palette.add(btn);
                grp.add(btn);
                btn.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        mainPanel.setAdding(btn.getText());
            final JFrame f = new JFrame("Drag and drop panels");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(palette, BorderLayout.WEST);
            f.getContentPane().add(mainPanel, BorderLayout.CENTER);
            f.setSize(800, 600);
            f.setVisible(true);
    class MainPanel extends JPanel implements MouseListener, MouseMotionListener {
        private JPanel palette;
        private String adding="";
        private SubPanel hitPanel;
        private int deltaX, deltaY, oldX, oldY;
        private final int TOL = 4;  //tolerance
        public MainPanel() {
            setLayout(null);
            addMouseListener(this);
            addMouseMotionListener(this);
        public void mousePressed(final MouseEvent e) {
            if( adding != "" ){
                setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                SubPanel sub = new SubPanel(adding);
                add(sub);
                sub.setSize(sub.getPreferredSize());
                sub.setLocation((int)e.getX(),(int)e.getY());
                revalidate();
                adding = "";
                return;
            Component c = getComponentAt(e.getPoint());
            if (c instanceof SubPanel) {
                hitPanel = (SubPanel) c;
                oldX = hitPanel.getX();
                oldY = hitPanel.getY();
                deltaX = e.getX() - oldX;
                deltaY = e.getY() - oldY;
                if( oldX < e.getX()-TOL ) oldX += hitPanel.getWidth();
                if( oldY < e.getY()-TOL ) oldY += hitPanel.getHeight();
        public void mouseDragged(final MouseEvent e) {
            if (hitPanel != null) {
                int xH = hitPanel.getX();
                int yH = hitPanel.getY();
                int xDiff = e.getX()-oldX;
                int yDiff = e.getY()-oldY;
                int cursorType = hitPanel.getCursor().getType();
                if( cursorType == Cursor.W_RESIZE_CURSOR){           //West resizing
                    hitPanel.setBounds( e.getX(), yH, hitPanel.getWidth() - xDiff, hitPanel.getHeight() );
                }else if( cursorType == Cursor.N_RESIZE_CURSOR){     //North resizing
                    hitPanel.setBounds( xH, e.getY(), hitPanel.getWidth(), hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.S_RESIZE_CURSOR){     //South resizing
                    hitPanel.setSize( hitPanel.getWidth(), hitPanel.getHeight() + yDiff );
                }else if( cursorType == Cursor.E_RESIZE_CURSOR){     //East resizing
                    hitPanel.setSize( hitPanel.getWidth() + xDiff, hitPanel.getHeight() );
                }else if( cursorType == Cursor.NW_RESIZE_CURSOR){     //NorthWest resizing
                    hitPanel.setBounds( e.getX(), e.getY(), hitPanel.getWidth() - xDiff, hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.NE_RESIZE_CURSOR){     //NorthEast resizing
                    hitPanel.setBounds( xH, e.getY(), hitPanel.getWidth() + xDiff, hitPanel.getHeight() - yDiff );
                }else if( cursorType == Cursor.SW_RESIZE_CURSOR){     //SouthWest resizing
                    hitPanel.setBounds( e.getX(), yH, hitPanel.getWidth() - xDiff, hitPanel.getHeight() + yDiff );
                }else if( cursorType == Cursor.SE_RESIZE_CURSOR){     //SouthEast resizing
                    hitPanel.setBounds( xH, yH, hitPanel.getWidth() + xDiff, hitPanel.getHeight() + yDiff );
                }else{      //moving subpanel
                    hitPanel.setLocation( e.getX()-deltaX, e.getY()-deltaY );
                oldX = e.getX();
                oldY = e.getY();
        public void mouseMoved(final MouseEvent e) {
            Component c = getComponentAt(e.getPoint());
            if (c instanceof SubPanel) {
                int x  = e.getX();
                int y  = e.getY();
                int xC = c.getX();
                int yC = c.getY();
                int w  = c.getWidth();
                int h  = c.getHeight();
                if(       y >= yC-TOL   && y <= yC+TOL && x >= xC-TOL   && x <= xC+TOL  ){
                    c.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
                }else if( y >= yC-TOL   && y <= yC+TOL && x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.NE_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h && x >= xC-TOL   && x <= xC+TOL ){
                    c.setCursor(new Cursor(Cursor.SW_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h && x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
                }else if( x >= xC-TOL   && x <= xC+TOL ){
                    c.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
                }else if( y >= yC-TOL   && y <= yC+TOL ){
                    c.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
                }else if( x >= xC-TOL+w && x <= xC+TOL+w ){
                    c.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
                }else if( y >= yC-TOL+h && y <= yC+TOL+h ){
                    c.setCursor(new Cursor(Cursor.S_RESIZE_CURSOR));
                }else{
                    c.setCursor(new Cursor(Cursor.MOVE_CURSOR));
        public void mouseReleased(final MouseEvent e) { hitPanel = null; }
        public void mouseClicked(final MouseEvent e) {}
        public void mouseEntered(final MouseEvent e) {}
        public void mouseExited(final MouseEvent e) {}
        public void setAdding(final String string) {
            adding = string;
            setCursor(new Cursor(Cursor.HAND_CURSOR));
        public void setPalette(final JPanel panel) { palette = panel; }
    class SubPanel extends JPanel {
        public SubPanel(final String name) {
            setPreferredSize(new Dimension(100, 100));
            setBorder(new TitledBorder(new LineBorder(Color.BLACK), name));
    }This application works with JFrame, but I want to display the JFrame in a webapplication (JSP Page).
    I'm using Netbeans 6.0 (GlassFish) to create webapplication using Visual Web JavaServer Faces.
    So in summary:
    How can i display the drag and drop application into a JFrame (better in a JPanel) in a webapplication (index.jsp)??
    Hope you can help...
    Thanks in advance...
    Greetings,
    Rajsh

    So have an applet that opens a JFrame... JSP or not has nothing to do with it, since it's nothing but HTML the client gets.
    You can't have a JFrame embedded in an HTML page. And if you could have an applet but don't know how to get that copied code to fit inside (I mean, content pane is content pane), you might want to consider learning how to do that.

  • Java application crashes due to some problem in native  code

    Hi All
    I have a Java application that calls APIs in a 3rd party DLL(I don't have access to its source code or logs) through my VC++ DLL(Win32) that acts as the wrapper DLL.
    The Application has many functionalities and is based on multithreading (both on Java layer as well as C++ layer). Most of the functionalities are working , but when I try to close the application, it crashes.
    Moreover the crashing occurs inconstently, sometimes it does not crash. Instead of showing any debug information , it simply creates a error file with disassembly code that I am not able to understand.
    Though the error seems like an java error, but actually it seems to be due to native code. I have try catch blocks in my code and also implemented settranslator functionality to get hold of structured/C exceptions. But still I am not able to catch any exceptions.
    I am pasting the the contents of the file here:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9111de, pid=488, tid=1848
    # Java VM: Java HotSpot(TM) Client VM (1.4.2_14-b05 mixed mode)
    # Problematic frame:
    # C [ntdll.dll+0x111de]
    --------------- T H R E A D ---------------
    Current thread (0x009d1790): JavaThread "CompilerThread0" daemon [_thread_in_native, id=1848]
    siginfo: ExceptionCode=0xc0000005, reading address 0x00000001
    Registers:
    EAX=0x00000001, EBX=0x00030000, ECX=0x02d17a18, EDX=0x00030278
    ESP=0x02c2f8e8, EBP=0x02c2fb08, ESI=0x02d17a10, EDI=0x00000001
    EIP=0x7c9111de, EFLAGS=0x00010202
    Top of Stack: (sp=0x02c2f8e8)
    0x02c2f8e8: 009fa9a0 000000c0 00000008 0811d3d8
    0x02c2f8f8: 0000000c 00a2c0e0 00000003 00000004
    0x02c2f908: 08018216 00000001 02c2fcc4 08018385
    0x02c2f918: 00000002 00000001 02c2f93c 02d06d0c
    0x02c2f928: 0802a50a 00000000 00000001 02c2f93c
    0x02c2f938: 04a3cb4c 02d01008 02c2f964 0802a850
    0x02c2f948: 02c2f96e 00000000 00000007 00000000
    0x02c2f958: 04a3cb38 00000004 08018216 00000001
    Instructions: (pc=0x7c9111de)
    0x7c9111ce: 39 89 bd 0c ff ff ff 8b 46 0c 89 85 68 ff ff ff
    0x7c9111de: 8b 10 3b 57 04 0f 85 8c 31 02 00 3b d1 0f 85 84
    Stack: [0x02bf0000,0x02c30000), sp=0x02c2f8e8, free space=254k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [ntdll.dll+0x111de]
    C [MSVCRT.dll+0x1c3c9]
    C [MSVCRT.dll+0x1c3e7]
    C [MSVCRT.dll+0x1c42e]
    V [jvm.dll+0xacda9]
    V [jvm.dll+0x17102]
    V [jvm.dll+0x16c8d]
    V [jvm.dll+0x16dca]
    V [jvm.dll+0x170a7]
    V [jvm.dll+0x172e8]
    V [jvm.dll+0x4dc65]
    V [jvm.dll+0x4d894]
    V [jvm.dll+0xd3a36]
    V [jvm.dll+0xd3a04]
    C [MSVCRT.dll+0x2a3b0]
    C [kernel32.dll+0xb683]
    Current CompileTask:
    HotSpot Client Compiler:423 b sun.awt.AWTAutoShutdown.isReadyToShutdown()Z (33 bytes)
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x049d6328 JavaThread "Thread-19" [_thread_blocked, id=1440]
    0x049d24d0 JavaThread "Thread-18" [_thread_blocked, id=3620]
    0x049d40c8 JavaThread "Thread-17" [_thread_blocked, id=2476]
    0x02df0538 JavaThread "TimerQueue" daemon [_thread_blocked, id=3876]
    0x00036a78 JavaThread "DestroyJavaVM" [_thread_blocked, id=2448]
    0x02e43768 JavaThread "Thread-6" [_thread_blocked, id=3664]
    0x02e23130 JavaThread "Thread-4" [_thread_blocked, id=2816]
    0x02e21d08 JavaThread "Thread-2" [_thread_blocked, id=3344]
    0x02da3f78 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2528]
    0x02da3268 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=4008]
    0x02d91f90 JavaThread "AWT-Windows" daemon [_thread_blocked, id=648]
    0x02d3a478 JavaThread "AWT-Shutdown" [_thread_blocked, id=2988]
    =>0x009d1790 JavaThread "CompilerThread0" daemon [_thread_in_native, id=1848]
    0x009d0a90 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3568]
    0x009ce128 JavaThread "Finalizer" daemon [_thread_blocked, id=1824]
    0x009ccda0 JavaThread "Reference Handler" daemon [_thread_blocked, id=3280]
    Other Threads:
    0x00a0b6e8 VMThread [id=608]
    0x00a0d620 WatcherThread [id=3012]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    def new generation total 640K, used 583K [0x10010000, 0x100c0000, 0x104f0000)
    eden space 576K, 90% used [0x10010000, 0x10091e40, 0x100a0000)
    from space 64K, 99% used [0x100b0000, 0x100bfff8, 0x100c0000)
    to space 64K, 0% used [0x100a0000, 0x100a0000, 0x100b0000)
    tenured generation total 7772K, used 5451K [0x104f0000, 0x10c87000, 0x14010000)
    the space 7772K, 70% used [0x104f0000, 0x10a42d80, 0x10a42e00, 0x10c87000)
    compacting perm gen total 8192K, used 8137K [0x14010000, 0x14810000, 0x18010000)
    the space 8192K, 99% used [0x14010000, 0x148024e8, 0x14802600, 0x14810000)
    Dynamic libraries:
    0x00400000 - 0x0040b000 c:\dcsthick\jre\bin\java.exe
    0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c8f5000 C:\WINDOWS\system32\kernel32.dll
    0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
    0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
    0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
    0x08000000 - 0x08143000 c:\dcsthick\jre\bin\client\jvm.dll
    0x7e410000 - 0x7e4a1000 C:\WINDOWS\system32\USER32.dll
    0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
    0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
    0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.DLL
    0x10000000 - 0x10007000 c:\dcsthick\jre\bin\hpi.dll
    0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
    0x00390000 - 0x0039e000 c:\dcsthick\jre\bin\verify.dll
    0x003b0000 - 0x003c9000 c:\dcsthick\jre\bin\java.dll
    0x003d0000 - 0x003de000 c:\dcsthick\jre\bin\zip.dll
    0x02e70000 - 0x02f84000 C:\dcsthick\jre\bin\awt.dll
    0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
    0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
    0x5ad70000 - 0x5ada8000 C:\WINDOWS\SYSTEM32\uxtheme.dll
    0x02fe0000 - 0x03031000 C:\dcsthick\jre\bin\fontmanager.dll
    0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
    0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
    0x73940000 - 0x73a10000 C:\WINDOWS\system32\D3DIM700.DLL
    0x74720000 - 0x7476b000 C:\WINDOWS\system32\MSCTF.dll
    0x755c0000 - 0x755ee000 C:\WINDOWS\system32\msctfime.ime
    0x03320000 - 0x0333c000 C:\dcsthick\lib\CrewsDmApiJniNt.dll
    0x031b0000 - 0x031bb000 c:\dcsthick\lib\CRWNT_DM.dll
    0x03240000 - 0x03249000 c:\dcsthick\lib\BAT_API.dll
    0x03340000 - 0x03352000 c:\dcsthick\lib\DC_DSM32.dll
    0x03360000 - 0x03369000 c:\dcsthick\lib\CRWTOOLS.dll
    0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
    0x03370000 - 0x0337a000 c:\dcsthick\lib\PMAPI.dll
    0x5d090000 - 0x5d12a000 C:\WINDOWS\system32\COMCTL32.dll
    0x03790000 - 0x037b2000 c:\dcsthick\ResaDLL\DC_DSMNB.dll
    0x5b860000 - 0x5b8b4000 C:\WINDOWS\system32\NETAPI32.dll
    0x038d0000 - 0x038f2000 c:\dcsthick\ResaDLL\DC_DSMIP.dll
    0x71ad0000 - 0x71ad9000 C:\WINDOWS\system32\WSOCK32.dll
    0x71ab0000 - 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll
    0x71aa0000 - 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll
    0x71a50000 - 0x71a8f000 C:\WINDOWS\system32\mswsock.dll
    0x662b0000 - 0x66308000 C:\WINDOWS\system32\hnetcfg.dll
    0x71a90000 - 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll
    0x76f20000 - 0x76f47000 C:\WINDOWS\system32\DNSAPI.dll
    0x76fb0000 - 0x76fb8000 C:\WINDOWS\System32\winrnr.dll
    0x76f60000 - 0x76f8c000 C:\WINDOWS\system32\WLDAP32.dll
    0x66580000 - 0x6658f000 C:\WINDOWS\system32\pnrpnsp.dll
    0x76fc0000 - 0x76fc6000 C:\WINDOWS\system32\rasadhlp.dll
    0x032e0000 - 0x0330a000 C:\dcsthick\lib\ResaHostConnection.dll
    0x03250000 - 0x03257000 c:\dcsthick\lib\CRWNT_GWALC.dll
    0x03310000 - 0x03319000 c:\dcsthick\lib\ALCAPI.dll
    0x763b0000 - 0x763f9000 C:\WINDOWS\system32\comdlg32.dll
    0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
    0x7c9c0000 - 0x7d1d7000 C:\WINDOWS\system32\SHELL32.dll
    0x773d0000 - 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
    VM Arguments:
    jvm_args: -Dcfdynaproppath=c:\dcsthick/config/ -Dcfdynapropxml=RESA_KCOdynamicproperties.xml -DConfigPath=c:\dcsthick/config/RESA_KCOConfig.xml -DResolution=High -DWorkstationID=GWGTE -DMode=GateBoarding -DlogPath=c:\temp\kcologs -DlogInformation=0 -DGateway=ALCSQ1 -DNetBiosPort=A
    java_command: com.singaporeair.dcs.standalone.application.model.ApplicationModel SQ/IGATEADXX
    Launcher Type: SUN_STANDARD
    Environment Variables:
    JAVA_HOME=c:\dcsthick\jre\bin
    PATH=c:\dcsthick\jre\bin;c:\dcsthick/lib;c:\dcsthick/ResaDLL
    USERNAME=USER
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 13, GenuineIntel
    --------------- S Y S T E M ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 2 family 6, cmov, cx8, fxsr, mmx, sse, sse2
    Memory: 4k page, physical 1039600k(565656k free), swap 2501208k(2091128k free)
    vm_info: Java HotSpot(TM) Client VM (1.4.2_14-b05) for windows-x86, built on Mar 14 2007 16:46:11 by "java_re" with MS VC++ 6.0
    The JAVA Application during initialisation establishes a connection with the host server for various devices. For each of the device it establishes a separate connection and keeps listening on these connections using multithreading.
    During App close, we need to close each of these connections one by one for each device.
    The opening /closing of connection is done by 3rd party DLL and call to there APIs is done through a C++ Wrapper DLL that I have built between the Java layer and their DLL.
    When we close the Application, I am always able to close the connections on the first 2 devices. Then all of a sudden it crashes either for the 3rd device conn. close or for the 4th one. The code is the same for all the devices . That too sometimes it just goes fine without crashing. If its a null pointer exception, why is it that it crashes on some occassions and not in other times. More importantly, why is it that it does not fail for the first 2 devices , but fails for the 3rd or 4th device connection close?
    Can please anyone help me. Please suggest me as to how I can determine the cause of the error.
    And is this error really coming in ntdll.dll or is it getting caused of my dll?

    The opening /closing of connection is done by 3rd party DLL and call to there APIs is done through a C++ Wrapper DLL that I have built between the Java layer and their DLL.The specific error indicates a pointer/memory problem.
    The first place that is likely is in your code.
    The second most likely place for the cause is because you are using the third party library incorrectly. For example before exiting you are supposed to clean up resources and you are not doing so.
    As a remote possibility, much less likely that either of the above, there is a bug in jnative or in the 3rd party library.

Maybe you are looking for

  • фф тормозит при выводе анимированных gif картинок (google.trnslt - FF inhibits the derivation of animated gif images)

    если выводить анимированные картинки одну за другой(примерно так - <a onclick="smiley(':yes:'); return false;" href="#"><img src="/engine/data/emoticons/yes.gif" alt="yes"></a> - и так повторить раз 100, с разными смайлами), то ФФ начинает дико лагат

  • I-tunes will not open/ window error message

    I along with several others seem to have gotten this message. I have tried to reinstall i-tunes, scanned my computer with spy bot and ewido, changed my fire wall settings in both windows xp and norton anti virus. None of these seem to work. I have tr

  • Start up pause/hang before loading A-Dock and Control Strip

    Ok, I know, running a sooped up 7200 PowerMac is not worth the time or money, but...I've got this hang that's become more pronounced lately. Everything seems to load fine. After about 3-5 minutes A-Dock and Control Strip come one. Already tried disab

  • Unity 7.0 Active x plugin issue

    I have Unity 7.0 installed. When I go to the subscriber page under Recorded voice I get a pop up to install Active X (Cisco Media Control). I install the plugin and still I see a RED "x" under recorded voice. I have tried it with IE 6.x and 7.x Pleas

  • Crash while cropping

    I used iPhoto 6 today, and did get one crash. I went to crop an image, and the app crashed. Luckily, when I re-opened it, my work was saved. No other problems as of yet. Bryan