Tag: openshift

如何在OpenShift上启动与JDBC的连接?

当我在localhost上工作时,为了启动与JDBC的连接,我这样做: String USERNAME = “…”; String PASSWORD = “…”; String DB_NAME = “…”; String FORNAME_URL = “com.mysql.jdbc.Driver”; String URL = “jdbc:mysql://localhost”; Connection m_connection = DriverManager.getConnection(URL , USERNAME , PASSWORD); 但是这对OpenShift不起作用,没有建立连接。 当我在OpenShift上运行它时,我看不到我得到的exception,但我validation了(我检查了OpenShift上的数据库,它没有更新我的查询)连接未建立 知道怎么解决吗?

OpenShift,Log4j2和Maven – 无法解决项目的依赖关系

我创建并运行了一个独立的Java程序,使用Slf4j通过Log4j2进行日志记录。 日志记录按预期工作。 然后,我将此function添加到我在Eclipse IDE中开发的现有(和工作) OpenShift Java Web应用程序中。 我将以下依赖项添加到pom.xml org.slf4j slf4j-api 1.7.21 org.apache.logging.log4j log4j-core 2.7 org.apache.logging.log4j log4j-api 2.7 org.apache.logging.log4j log4j-slf4j-impl 2.7 我使用了一个简单的log4j2.xml配置文件,并在Java类中添加了一些日志代码。 我在本地运行Web应用程序,日志工作正常。 然后我将pom.xml和log4j2.xml移动到Git Staging Area并执行Commit和Push 。 这通常很好,没有问题。 这次我在对话框控制台窗口中收到以下错误消息: [ERROR] Failed to execute goal on project testdb: Could not resolve dependencies for project testdb:testdb:war:1.0: Failure to find org.apache.logging.log4j:log4j-api:jar:2.7 in http://maven.repository.redhat.com/techpreview/all was cached in the local repository, […]

通过openshift中的javabridge端口连接php和java

在我的locahost上,我能够通过javabridge导入的类将我的php服务器代码连接到运行在我的netbeans上的java基本代码。 java的代码如下 public class Listener { public static final String JAVABRIDGE_PORT = “xxxx”;//8080 static final php.java.bridge.JavaBridgeRunner runner = php.java.bridge.JavaBridgeRunner.getInstance(JAVABRIDGE_PORT); /** * @param args the command line arguments * @throws java.lang.InterruptedException */ public static void main(String[] args) throws InterruptedException { // TODO code application logic here runner.waitFor(); System.exit(0); } } 但现在我正在转向这个很酷的托管网站openshift进行制作,我需要做同样的事情。 我的困惑是我在openshift中使用什么应用程序来运行我的java代码。 我看到的几个选项是JBOSS和TOMCAT但不知道如何解决这个问题并且很少研究我知道这两个应用程序都是用于在Web应用程序中运行java的java EE,但对我来说它是正确的工具还是还有别的东西。

将照片上传到OpenShift。 Spring MVC

我在OpenShift服务器上部署了我的Spring MVC应用程序的.war文件。 每个用户都可以更改照片。 它适用于我的localhost,但我需要在OpenShift服务器上传照片并将每张照片的路径放到数据库中。 这是我上传文件的方法 @RequestMapping(value = “/user/updateinfo”, method = RequestMethod.POST) public String postAvatar(@RequestParam(“file”) MultipartFile file, Principal principal) { if (file.isEmpty()) { return “redirect:/user”; } if (!file.isEmpty()) { try { String relativeWebPath = “/resources/avatars/”; String absoluteFilePath = context.getRealPath(relativeWebPath); String name = file.getOriginalFilename(); // String name=file.getOriginalFilename(); System.out.println(absoluteFilePath); String path = absoluteFilePath + “/” + name; File […]

Eclipse中的openshift私钥认证失败错误

在Eclipse中,当我尝试从openshift导入现有应用程序时,它会给我以下错误 – 无法克隆存储库。 validation失败。 请确保您将私钥添加到ssh首选项中。 我按照以下步骤进行了操作 – 1.在Eclipse中转到窗口 – >首选项 – >常规 – >网络连接 – > SSH2 – >密钥管理2.生成RSA密钥3.将公钥内容粘贴到openshift Express帐户中。 4.使用密码保存私钥。 即使按照上述步骤操作,我在克隆GIT仓库时遇到错误。 我在Eclipse日志文件中有以下错误 – !ENTRY org.jboss.tools.openshift.express.ui 4 0 2012-03-21 10:43:20.161 !MESSAGE Could not clone the repository. Authentication failed. Please make sure that you added your private key to the ssh preferences. !STACK 0 org.eclipse.jgit.errors.TransportException: ssh://7261e534e25842aaa353878a6c9af7cf@astofa-astofa.rhcloud.com/~/git/astofa.git/: […]

将外部JAR添加到Openshift

我有一个非常基本的Java Web应用程序(使用Eclipse openshift插件创建)。 该应用程序在OpenShift服务器上运行良好。 现在我需要使用外部JAR库在Java中进行JSON解析和创建。 我无法理解如何将这个JAR添加到openshift服务器。 我去了项目属性>> BuildPath >>添加外部JAR 。 虽然这确实导入了JAR,但它在openshift服务器上不起作用并且提供了与该文件的导入相关的错误( NoClassDefFound ,我猜)。 你能告诉我如何将外部jar子导入openshift项目吗?

Tomcat 7是否支持Java 8?

在Tomcat的官方页面中,它说Tomcat 7支持Java 8.如果我下载它并使用Java 8运行它就可以了。 但是,在Openshift上是Tomcat 7(JBoss EWS 2.0) 。 在这个网页上,它说EWS 2.0 不支持Java 8 。 如果我将我的Java 8应用程序部署到Openshift(Tomcat 7),它就无法正常工作。 为什么? 我尝试在Openshift上使用Tomcat 7安装Java 8: https ://stackoverflow.com/a/23895161/2442133但它并不适合我。 我有错误: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping’: Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [pl.xxx.controller.HomeController] for bean with name ‘homeController’ defined in file [/var/lib/openshift/xxx/app- root/runtime/dependencies/jbossews/webapps/web1/WEB- INF/classes/xxx/controller/HomeController.class]: problem […]

不使用GIT将WAR文件部署到Openshift?

我想将一个WAR文件上传到我的Openshift帐户,但它迫使我使用GIT ot GITHUB( 这里 )。 请原谅我说这个,但这非常烦人。 有没有办法直接将WAR文件上传到我的应用程序而不使用某些第三方? 我的应用程序(在Openshift中)包括:Tomcat 7(JBoss EWS 2.0),MySQL 5.5。 非常感激

OpenShift上的OpenJDK:“NoSuchAlgorithmException:EC AlgorithmParameters not available”

我遇到了java.security.NoSuchAlgorithmException: EC AlgorithmParameters not available OpenShift上java.security.NoSuchAlgorithmException: EC AlgorithmParameters not available Wildfly 8.2(OpenJDK 1.8.0_31)的java.security.NoSuchAlgorithmException: EC AlgorithmParameters not available (AmazonHttpClient抛出exception)。 看起来OpenJDK 1.8和ECC存在一个错误: https ://bugzilla.redhat.com/show_bug.cgi?id = 1167153 根据建议的解决方法,需要编辑jre/lib/security/java.security以禁用jdk.tls.disabledAlgorithms=EC,ECDHE,ECDH 。 或者删除jre/lib/ext/sunec.jar 不幸的是我无法在OpenShift上执行此操作(缺少权限)。 这里最好的解决方法是什么? 我可以选择切换到没有这个问题的Oracle JDK(在OpenShift上)吗? 更新 : 我删除了Sun java.security.Provider-s并添加了BouncyCastle: static { Security.removeProvider(“SunEC”); Security.removeProvider(“SUN”); Security.removeProvider(“SunJSSE”); // … Security.addProvider(new BouncyCastleProvider()); } 不幸的是,BouncyCastle 不是 JSSE提供者( 使用Bouncy Castle提供程序创建SSLContext实例 ), SSLContext.getInstance()因NoSuchAlgorithmException: TLS SSLContext not […]

重启Openshift MySQL盒式磁带时出错

我有一个带有Tomcat 7和MySQL 5.5的不可扩展的OpenShift应用程序,该应用程序只运行一个小型Java应用程序。 这个应用程序运行良好几个月,但自上周以来它停止工作。 当我尝试使用OpenShift仪表板重新启动应用程序时,我收到以下错误消息: Starting MySQL 5.5 cartridge MySQL server failed to start: 140305 07:01:47 mysqld_safe Logging to ‘/var/lib/openshift/53104e375973cad496000022/mysql//log/mysql_error.log’. 140305 07:01:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/53104e375973cad496000022/mysql/data/ 140305 07:01:52 mysqld_safe mysqld from pid file /var/lib/openshift/53104e375973cad496000022/mysql/pid/mysql.pid ended 140305 07:01:48 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/53104e375973cad496000022/mysql/data/ 140305 7:01:49 [Note] Plugin ‘FEDERATED’ is […]