tomcat7 jdbc issues - oracle11g

I have a problem in my application post moving to tomcat7. I am seeing the below issue when my app tries to connect to the "Oracle 11.2 DB".
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-12541: TNS:no listener
)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:466)
The connection details in the server.xml and context.xml looks like below.
context.xml
ResourceLink global="jdbc/ctb" name="jdbc/ctb" type="oracle.jdbc.pool.OracleDataSource"/>
server.xml
<Resource name="jdbc/XXXX"
auth="Container"
scope="Shareable"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:oci8:#database"
username="username" password="pwd"
maxActive="30" maxIdle="3"
removeAbandoned="true" removeAbandonedTimeout="60"
testOnBorrow="true"
validationQuery="select 1 from dual"
logAbandoned="true" />
One observation i see is below:
The tomcat7 comes with a default jdbc driver in the "lib" folder called "tomcat-jdbc.jar". But in my app we are using spring-jdbc.jar from quite long.
Tried to remove each of them to make sure there wont be any conflict in the classes, but it never helped me.
tomcat6 workes fine with the same "context.xml" and "server.xml" and spring-jdbc.jar.
your help will be highly appreciated as this has become a blocker for our tomcat7 migration. Let me know if you need any further details.
==Benki

Oh Ghosh, pinned down the issue.
The setenv.sh script created never had the "ORACLE_HOME" path set for it which created in the above error. Also as i was using the init script was starting and stopping the tomcat, which loaded only the basic ENV variable required and set by setenv.sh script.
Everything is working fine now.

Related

Open files in PHPStorm with Vagrant+Symfony application

I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
However as I'm using vagrant, the file path of the server doesn't match my host.
I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.
Any ideas?
Thanks
When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:
// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'
Symfony FrameworkBundle Configuration - IDE
The answer given by Jeffry no longer works unfortunately :(. When In configure that with my paths the profiler throws:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
I have configured the path according to this line in the SF docs: This map should be specified at the end of the URL template, which results in this:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
However, it does open PHPStorm, but phpstorm does not open the file, so i'm a bit stuck here now.
This solves the issue with the file not opening in PhpStorm from a Vagrant:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/
Source: https://youtrack.jetbrains.com/issue/IDEA-65879

How to remove this error?

There has been an error processing your request
Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Magento_CustomWidget schema: current version - none, required version - 2.0.0
Magento_CustomWidget data: current version - none, required version - 2.0.0
Error log record number: 1078485663282
my code is module.xml
<?xml version="1.0"?>
`<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_CustomWidget" setup_version="2.0.0"/>
</config>
I had the similar issue and it's likely to be caused by renaming your module(ie: when you try to make a backup copy and leave it in the same directory, ideally we should first disable the module then make a copy), and you must have run bin/magento setup:upgrade - not knowing that you're registering two identical module into database.
How I did to fix the issue was to go to database table: setup_module and find the entry in your case is: Magento_CustomWidget, then update the schema and data both to 2.0.0. It's an easy fix if you have phpmyadmin, see if it helps.

Alfresco Share - Unable to change the default port number

I am trying to configure Alfresco Community 3.3 on a port other than its default port of 8080. I need it to run on 8989. I think I have change all instances of 8080 (where it is mentioned in configuration files) to 8989, and I am able to access Alfresco Explorer okay. So far so good.
But, when I try to access http://localhost:8989/share I get the following error
java.io.IOException: Unable to test document path:
alfresco/site-data/configurations/slingshot.site.configuration.xml in
remote store: alfresco due to error: 404
The files I have changed are as follows:
tomcat/conf/server.xml
tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/file-severs.xml
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/repository.properties
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystem/sysAdmin/default/sysadmin-parameter.properties
tomcat/webapps/alfresco/wsdl/access-control-service.wsdl
tomcat/webapps/alfresco/wsdl/administration-service.wsdl
tomcat/webapps/alfresco/wsdl/action-service.wsdl
tomcat/webapps/alfresco/wsdl/authentication-service.wsdl
tomcat/webapps/alfresco/wsdl/authoring-service.wsdl
tomcat/webapps/alfresco/wsdl/classification-service.wsdl
tomcat/webapps/alfresco/wsdl/content-service.wsdl
tomcat/webapps/alfresco/wsdl/dictionary-service.wsdl
tomcat/webapps/alfresco/wsdl/repository-service.wsdl
virtual-tomcat/conf/server-minimal.xml
virtual-tomcat/conf/server.xml
Have I missed something obvious?
(Please make no suggestions about upgrading......)
I think you have overdone it.
According to
http://wiki.alfresco.com/wiki/Changing_Default_Port_Configuration
you should only change it in share-config-custom.xml
Change all the files back but share-config-custom.xml
Four are the files to be changed in Alfresco 5.2 in order to set the various ports:
[alfresco-community_instDir]\properties.ini
[alfresco-community_instDir]\tomcat\conf\server.xml
[alfresco-community_instDir]\tomcat\shared\classes\alfresco-global.properties
[alfresco-community_instDir]\tomcat\webapps\share\WEB-INF\classes\alfresco\share-cmis-config.xml

Spring Boot app deployed to Glassfish is giving strange results

As mentioned here, I am having a heck of a time getting my small Spring-Boot project to deploy "correctly" to Glassfish. It runs fine using the embedded Tomcat, but once I try and move it into my organization's environment (Glassfish 3.1.2) I get some strange behavior.
Thinking it was my code, I reverted to the time-tested "Hello World"-approach and built a super-basic app following this tutorial on Spring's blog.
I did make a few very minor deviations as I went along but nothing that should have affected the app like this at all.
The only major deviation I made was that I found I could not exclude "spring-boot-starter-tomcat" from "spring-boot-starter-web" -- when I tried to that, I got 2 errors in the STS "Markers"-tab:
The project was not built since its build path is incomplete. Cannot find the class file for javax.servlet.ServletContext. Fix the build path then try building this project
The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required .class files Application.java
If I cleaned the STS project, then ran Maven Clean, Update, Install the Install goal gave the following error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Compilation failure [ERROR] /Users/brandon_utah/Utah Development/sts_workspaces/NidTools Rebooted/test/src/main/java/test/Application.java:[13,8] cannot access javax.servlet.ServletException [ERROR] class file for javax.servlet.ServletException not found
So what I did instead was include this dependency (which I found mentioned in several other SpringBoot resources):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
In this deployed fine to the embedded Tomcat and it did deploy to my Glassfish (local install) -- but with a whole bunch (about a half-dozen) errors similar to this one:
2014-04-03T16:23:48.156-0600|SEVERE: Class [ Lorg/springframework/jdbc/datasource/embedded/EmbeddedDatabase; ] not found. Error while loading [ class org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration ]
Most of them are SEVERE, but I am also getting a few with a WARNING:
2014-04-04T06:57:35.921-0600|WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: org/springframework/batch/core/configuration/annotation/BatchConfigurer
Except that I'm not referencing any of these missing classes anywhere in my project (other than what might be referenced by Spring Boot itself).
Also, the app doesn't quite work as expected. If I hit the RestController, I do get my page rendered as I expect -- but if I put any sort of System.out or Logger.log statement in the controller's method, that line of code seemingly never gets executed; by all appearances, it just gets skipped.
To demonstrate this problem, in my sample app's RestController I created a static counter. Then in the GET-/ method I increment that counter and System.out.println it's value. I also return the value as part of the Response.
And again, from a user's perspective, it seems to be working: the screen renders "Hello World" and in parentheses it shows the counter's value. I refresh the window, the counter increments. But nothing in the STS Console. And if I navigate to the Glassfish log for the app, nothing there either. Nothing. Nada. Zip. From what I can tell, something is mysteriously eating any attempt to log anything.
To add to the mystery, if I add a System.out to the SpringBootServletInitializer#configure(), that does make it to the Console. But if I declare a constructor in my RestController and include a System.out there, that one does not make it to the Console. For good measure, I even tried including a System.err in the constructor and a Logger.getAnonymousLogger.severe in the method; neither of those result in anything.
I should note that this also deploys and runs as expected using an external Tomcat.
I would very much appreciate any input, as it's not likely that I can convince my organization to deploy this to Tomcat nor use the embedded-Tomcat approach (due to politics and an overwhelming existing Glassfish environment).
My test project on Github is here.
This has been answered here: https://stackoverflow.com/a/29438821/508247
There is a bug in Glassfish 3.1.X. You need to include metadata-complete="true" in your web.xml root element.
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1"
metadata-complete="true"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
</web-app>
I had this problem with Payara 5, I understand the problem became from Glassfish.
Versions:
Payara 5.192
Spring Boot 2.1.6
The solution worked for me:
I added this dependency in the pom.xml.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
<version>2.1.4.RELEASE</version>
</dependency>
My glassfish-web configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC ...>
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
<!-- set a friendly context root -->
<context-root>/micuenta-api</context-root>
<!-- Change the default character encoding from ISO-8859-1 to UTF-8 -->
<parameter-encoding default-charset="UTF-8"/>
</glassfish-web-app>

Opencms webdav not working

With OpenCms 7.5.3 fresh install:
I create an index.htm page, then export it via webdav to disk. It
creates index.html.xml and __properties/index.html.xml.properties.
Thats ok.
Delete index.html from OpenCms and publish.
Try to import previously exported files via webdav and...
Error 409 conflict when importing __properties/index.html.xml
I tried with 3 different webdav clients, including the Eclipse plugin for webdav.
Also tried with OpenCms 7.5.4 and 8.5.0
Any ideas? Thanks.
It seems to be a known problem by Alkacon (OpenCms developer):
Here is a possible cause:
https://github.com/alkacon/opencms-core/issues/73
("pbeltran" is me there.)
If it helps we did the following on OpenCms 8.5 in order to avoid the error, but sacrificing properties files :(
Just edit WEB-INF/config/opencms-importexport.xml and replace with this:
<repository name="standard" class="org.opencms.repository.CmsRepository">
<params>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperJsp</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperXmlContent</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceExtensionWrapperXmlPage</param>
<param name="wrapper">org.opencms.file.wrapper.CmsResourceWrapperSystemFolder</param>
<!--param name="wrapper">org.opencms.file.wrapper.CmsResourceWrapperPropertyFile</param-->
</params>
<filter type="include">
<regex>/</regex>
<!--regex>/__properties/.*</regex-->
<regex>/sites/.*</regex>
<regex>/system/</regex>
<!--regex>/system/__properties/.*</regex-->
<regex>/system/galleries/.*</regex>
<regex>/system/modules/.*</regex>
<!--regex>/system/workplace/.*</regex-->
</filter>
</repository>
Afer that restart your server.
We do regular exports from OpenCms of the modules to keep the whole package (files and properties) in order to keep the solution under control version (SVN). You can create a module with a resource pointing to sites/default to do that. But it's critical to select root site before doing any import/export of that module (if you dont you can break your ocms installation).
Since some months, I'm using the Linux FUSE driver (gentoo's davfs 1.4.7) to mount OpenCms resources. I was quite irritated with the lot of LOG CmsVfsResourceNotFoundException errors, so I ended up removing the __properties dirs from the exported Repository.
If you don't need these __properties files, I'll recommend you to ignore that error and remove the files from the repository as per the instructions in the link.
The corresponding fstab entry:
# WebDAV (opencms)
# http://myserver:8080/opencms/webdav /home/alberto/mnt/myserver-opencms-dav davfs rw,user,noauto 0 0
I have never had Eclipse with webdav up and running, but I successfully use OpenCms 7.5 and 8 daily with webdav:// and webdavs:// from KDE's Kate editor. Maybe give it a try.
In case you want to try, here the URL you need to use to browse the VFS:
webdav(s)://server(:port)/webdav

Resources