portlet (JSF) with ajax - Websphere Portal 7, RAD 8 - ajax

I want created a portlet (JSF) with ajax but doesn't render.
The example I tried this example of IBM http://www.ibm.com/developerworks/rational/library/06/1205_kats_rad2/, but not run in WebSphere Portal only in WAS. (New Dynamic Web Project)
I search in many forums, and solution is change "Classloader mode" from "PARENT_FIRST" to "PARENT_LAST", i cant find this Classloader in project file, I tried change in server but a wasn't work.
Please give me a simple example who I created a portlet JSF with AJAX or who change Classloader mode to resolve this problem.
Greetings, João Sousa

Joao,
in project/package explorer right click on J2EE and select Open WebSphere Application Server Deployment. Deployment settings editor will be opened. Now scroll down to Application section. Now you can switch between PARENT_LAST & PARENT_FIRST.
Bogdan.

Related

Cannot create a new Spring web app in spring tool suite

I trying to use spring mvc template, the wizard windows says 'requires downloading' but next button is disabled. I dont know what to do.
Just type in a project name in the field (on the top of the dialog). Then the Next button will be enabled.

Cannot find Spring MVC project when creating new web application project using STS?

I'm new to Spring MVC and trying to learn from the internet tutorial such as these good ones from journaldev, springsource, and codejava
All of those tell me use STS as the IDE and to go for New Project - Spring Template Project - Spring MVC Project.
Though in my case, using the version 3.6.1.RELEASE of STS, I can NOT find any Spring MVC Project options there.
Do you have the same issue using STS?
p.s.
I found the solution here for previous version of STS, though it not works for version 3.6.1.
Seeing no MVC template snapshot.
I've just solved the problem. These are my way:
- Go to New Project -> Spring Project. For first use, only show "Simple Project" folder.
- Select Configure templates.. (blue link).
- In Template Projects window, delete "spring-data-gemfire" and "spring-integration", and check "Show self-hosted templates ..." (at bottom), and then press Apply -> OK
- Just wait while refreshing process, and "Spring MVC Project" should be showed.
Step:1-Go to File->New
Step:2-Click on Spring Legacy Project
Step:3-see a Templates Box, scroll it down you will find Spring Mvc Project
Firstly File -> New Project -> Spring -> Spring Legacy project & finally select what you want. also refer attached images.
As user #AndrewEisenberg suggested here, viewing the Error Log gives me the errors as below
Connection to https://raw.github.com/SpringSource/spring-integration-templates/master/si-sts-templates/builds/descriptor.xml failed on Connection to https://raw.github.com refused. Retry attempt 0 started
Connection to https://raw.github.com/SpringSource/spring-data-gemfire-sts-templates/master/builds/descriptor.xml failed on Connection to https://raw.github.com refused. Retry attempt 0 started
So having a close look at the error in Error Log, by Windows - Show View - Other - Error Log, after calling File - New Project - Spring Project, I see the cause for this symptom.
It causes by the internet connection which cannot reach https://raw.github.com
Try this
New Project -> Spring Project -> Spring MVC Project
File->New-->Spring Legacy Project----> scroll down to Spring Mvc Project

GWT + Spring hosted mode not working

I have a following problem, probably somebody can help me?
I had an Spring MVC application, quite basic one, with a few simple jsp pages.
Also I had an Spring Security integrated with it.
Now I need to add some GWT widget to one page. No problem so far, I've added <div> to the page, added GWT module, all all needed GWT logic.
When I compile GWT and then deploy application to tomcat - everything works perfectly, I open app, login into it, open my page and see GWT UI components.
Now I want to open my application in hosted mode. There problems begin.
When I start hosted mode, Jetty starts, Spring framework initialize, and then my jsp (translated as .htm) open without hosted mode param ?gwt.codesvr=127.0.0.1:9997. After opening my page I see nothing if I delete compiled gwt code.
When I manually add "?gwt.codesvr=127.0.0.1:9997" hosted mode start and GWT module begin to load. This is when I get an error:
12:57:15.589 [ERROR] [rehabrental] Failed to load module 'testmodule'
from user agent 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru;
rv:1.9.2.23) Gecko/20110920 Firefox/3.6.23' at 127.0.0.1:63260
java.lang.NoSuchFieldError: warningThreshold at
com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:413)
at
com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.<init>(JdtCompiler.java:228)
at
com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:700)
at
com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:235)
at
com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:447)
at
com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:370)
at
com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:360)
at
com.google.gwt.dev.DevModeBase$UiBrowserWidgetHostImpl.createModuleSpaceHost(DevModeBase.java:110)
at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:197)
at java.lang.Thread.run(Unknown Source)
Do you use eclipse ?. If so you need rearrange your exported modules as JDT classes causes problems with the GWT compiler. See comment #7 in this GWT issue about pushing GWT dependencies above others, so that they are picked up first by the compiler.

Oracle ADF on JBoss: Wrapped Jdbc Connection problem

I'm trying to run an application using Oracle ADF Business Components on a JBoss Server. I've maneged to deploy it, but when I try to load the page I get below exception:
java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection
Is there a way solve this? Maybe configure JBoss to not use this wrapped connection or configure the ADF framework to unwrap it?
This is a while back, but I'll just follow up on my own question.
There is a guide on Oracle Metalink (Needs login) wich explains how to deploy ADF/BC on JBoss. I'm pretty sure this is what solved this for me (it's a while ago..)
Here is a copy of it:
Abstract
The purpose of this note is to show how you create an ADF BC Application Module and how you deploy it on a JBoss Application Server. It will also show you what configurations you need to perform on the JBoss side in order for the Application Module to work correctly.
Scope & Application
This note is intended for anyone who is about to deploy an ADF BC Module to a JBoss Application Server.
How To Deploy an ADF BC Module to a JBoss Application Server
The steps necessary for deploying an ADF BC Module to a JBoss Application Server are the following:
Setup the ADF Runtime Libraries on the JBoss Server
Setup data source(s) on the JBoss Server
Configure the ADF BC Module
Deploy the ADF BC Module
I will go through each of these steps more detailed. There is also a complete example attached for download here.
Setup the ADF Runtime Libraries on the JBoss Server
Shutdown the Application Server.
Invoke the ADF Runtime Installer wizard. Choose Tools | ADF Runtime Installer, and choose a server type from the submenu.
Proceed through the pages of the wizard. For detailed instructions for any page of the wizard, click Help.
On the Location page, select the home (or root) directory of the server on which the libraries are to be installed.
On the Installation Options page, you may choose the operation that you wish to perform.
* Install the ADF runtime libraries from your JDeveloper installation.
* Uninstall previously installed ADF runtime libraries.
* Restore an archived version of the ADF runtime libraries as the active version.
On the Summary page, click Migrate if you wish to prepare any existing UIX JSP projects for deployment.
On the Summary page, confirm the details of the installation, and click Finish.
Restart the application server.
Setup data source(s) on the JBoss Server
To create an Oracle data source in the JBoss server, you need to take the following steps:
Create a file called oracle-ds.xml. This file will contain your data source configuration. Below is an example on how such a file can look like.
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:oracle:thin:#mydbhost.com:1521:mysid</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>hr</user-name>
<password>******</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>
</datasources>
Copy the file to the /deploy. This will install it on the JBoss server.
Configure the ADF BC Module
There are a few steps that need to be taken upon the ADF BC Module in order for it to run on the JBoss server.
When creating an ADF BC Module that will be used on a JBoss application server, one needs to set the SQL Flavor to SQL92 and the Type Map to Java. This change is required when using JBoss as the Application Server.
****Package the ADF Business Components project as an EJB session bean.****
Right Click on the Application Module, select Business Components Deployment.
In the profiles Dialog, select EJB Session Beans.
In the EJB Session Beans dialog, select Deploy To: Other EJB Container
In the AppModules dialog, configure the Application Module as seen in the figure 1 below.
Figure 1. Configuration of the Application Module
Once done, your Project will look similar to the one shown in the figure 2 below.
Figure 2. The JDeveloper Project
The final step is to configure the Application Module to use the data source we created in the previous step. This is done as follows:
Edit the application module.
In the Navigator, right-click the Business Components application module icon and choose Configurations.
Select the appropriate configuration.
Select this configuration and click Edit.
In the Connection Type list, choose JDBC DataSource.
Enter a DataSource Name. For example: java:/OracleDS.
Deploy the ADF BC Module
If you have your JBoss server either locally or mapped on your local machine, you can deploy it directly from inside JDeveloper. If your JBoss server is remote, and not mapped to the local machine, or you have a JSP application that later will use this module, you cannot deploy it directly from within JDeveloper. Both methods are described below.
Deploying the Module from within JDeveloper
1. Create a connection to the target application server.
2. If you want to support JBoss-specific configuration options for the EJB, add a jboss.xml deployment descriptor file. For more information on this file, see http://www.jboss.org.
3. If your project is a Business Components UIX JSP project, add required Cabo resources to it.
4. Select the deployment profile in the Navigator, right-click, and choose Deploy to | < application server connection> to package the application as an archive file and deploy it via the selected application server connection.
Deploying the Module outside of JDeveloper
If your JBoss server is remote, and not mapped to the local machine, or you have a JSP application that later will use this module you will have to do as follows:
Choose Deploy to EAR file from the context menu to deploy it as an EAR file. You must deploy this application to an EAR file and not a WAR file, as JBoss will not add the EJB references under the java:comp/env/ JNDI namespace for a WAR file.
Copy this file manually to the /deploy directory.

JSP debugging in IntelliJ IDEA

Does anyone know how to debug JSP in IntelliJ IDEA?
When I set breakpoint in my JSP files, those breakpoints never seem to take effect. The debugger never hits them. IDEA seems to think that the breakpoints are valid. I do see a red dot placed to the left of the line where I place my breakpoint.
I read in IntelliJ forum in this post that JSP files need to be under web-inf for debugging to work.
But then I also read that JSP files placed under web-inf won't be directly accessible by the user.
I am not sure who's really right.
For JSP debugging in Intellij there are some configurations that must be in order. The fact that Intellij always allows you to add a breakpoint on a JSP line does not necessarily imply that you’ve configured JSP debugging. In the following I refer to Intellij 8 configuration, w.r.t. previous versions you will need to do similar operations as the concepts are the same.
In order to enable JSP debugging you must do two steps: set a web application configuration in your project and add a web application server configuration.
Web application Configuration: in order to have JSP debugging, you must have a “web” facet in your project structure, pointing to the correct web.xml file. Depending on the kind of web application structure you are using, the facet may be detected automatically by Intellij (go anyway to check what it has done) or you may have to add it manually. Remember in the “Java EE build settings” tab to set as anable “Create web facet exploded directory”; if you don’t want duplications, a trick is just to enable it and point to your already existing directory.
(Web) Application server: Go to “edit configurations”, there you have to add to configurations an application server, not launch the web server as an application like any other. In this way Intellij will be able to intercept JSP calls. In the list of application servers, you should have the default one, Tomcat. Be sure to have a local Tomcat installation before you do this, and point to that when adding the web application server. The last trick is going to the “Deployment” tab and selecting as “Deployment source” the same facet that you configured in the previous step.
The same configuration works if you want to use another web application server, I tested it with the latest Caucho Resin releases and debugging works fine (it didn’t with the previous Intellij and Resin combinations).
If you don’t see Tomcat in the list of available application servers to add, check the plugins in the general Intellij settings pane: in the latest releases, more and more functionality has become “pluggable”, and even very basic functions may be disabled; this plugin is called “Tomcat integration”.
Finally, it is surely not true that JSP files need to be under WEB-INF to be under debugging.
For remote JSP debugging (which also applies to localhost) you'll need to install the JSR45 support plugin. Please note this feature is only supported in the Ultimate edition of IntelliJ, not the community edition.
Go to Preferences > Plugins, search for the JSR45 plugin, and
enable it.
Create a run configuration: Run > Run Configuration > click the + button, and pick JSR45 Compatible Server, and then in the dialog that opens, select Remote, and set server host and port. Setting Application Server: Generic should work fine.
Make sure you set the correct port in Startup/Configuration > Debug.
Open the module settings (F3 on the project folder), and add a Web Facet under Facets, and under Web Resource Directories specify your JSP root folder.
Click the Configuration... button, and select the folders with the beans, classes and libraries that your JSPs depend on.
Now JSP breakpoints should work, provided that you started your server with the proper debug arguments.
If you have a maven project with auto-import enabled then you might want to disable auto-import because every time the auto-import is triggered your library settings will be reset.
Also see:
https://www.jetbrains.com/help/idea/run-debug-configuration-jsr45-compatible-server.html
Anyway, you need to launch the Tomcat in IDEA, not from a remote Tomcat.
Please make sure, that in you tomcat's conf/web.xml suppressSmap is not enabled as support of JSR45 is required by IntelliJ's debugger.
It should look like this:
<init-param>
<param-name>suppressSmap</param-name>
<param-value>false</param-value>
</init-param>
From https://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html
suppressSmap - Should the generation of SMAP info for JSR45 debugging be suppressed? true or false, default false.
If you are using the Intellij debugger you can get the value of an individual attribute by putting a breakpoint inside JSP and evaluating the expression this.jspContext.request.getAttribute("attributeName").
Note that this may return a Java Object type, and you may have to cast it to the correct type. Also if you launch a remote Tomcat the IDEA won't hit any breakpoints, so you need to launch the Tomcat in debug mode from inside the IDEA.
For the second part of your question ("jsp files placed under web-inf won't be directly accessible by user") that is correct. To allow users to access JSP files in the WEB-INF folder servlet and servlet-mapping entries need to be made in the web.xml file for each JSP page.

Resources