Jump to content

Guilherme Costa Lopes

Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

0 Comum

About Guilherme Costa Lopes

  1. Guilherme Costa Lopes

    Google cloud liberando portas

    Instalei o **Portainer** para gerenciamento de sistemas no google cloud. Entendo que liberei a porta 9000 MAs não acessa: O que pode estar faltando ?
  2. Guilherme Costa Lopes

    Agm-map dando erro em localhost e no servidor

    Estou usando o AgmCoreModule, para marcar endereços no google maps. No module, no import imports: [ AgmCoreModule.forRoot({ apiKey: 'xxxxxxxxxxx' }), ] no export exports: [ AgmCoreModule ] No ts texto = 'teste'; lat = -19.91506; lng = -44.00752; zoom = 15; No html <agm-map [latitude]="lat" [zoom]="zoom" [longitude]="lng"> <agm-marker [latitude]="lat" [longitude]="lng"></agm-marker> </agm-map> A principio ele mostra Mas depois dá este erro Ou este erro No servidor está dando este erro. O Chave key está liberada main.cb562ea7df40e3f09b5f.bundle.js:2 Refused to load the script 'https://maps.googleapis.com/maps/api/js?v=quarterly&callback=agmLazyMapsAPILoader&key=AIzaSyCD54jiJhEBda5MtJkgFJB-hfR6dv5V9jw&language=pt' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback. main.cb562ea7df40e3f09b5f.bundle.js:2 ERROR Error: Uncaught (in promise): Event: {"isTrusted":true} at x (main.cb562ea7df40e3f09b5f.bundle.js:2) at x (main.cb562ea7df40e3f09b5f.bundle.js:2) at main.cb562ea7df40e3f09b5f.bundle.js:2 at e.invokeTask (main.cb562ea7df40e3f09b5f.bundle.js:2) at Object.onInvokeTask (main.cb562ea7df40e3f09b5f.bundle.js:2) at e.invokeTask (main.cb562ea7df40e3f09b5f.bundle.js:2) at t.runTask (main.cb562ea7df40e3f09b5f.bundle.js:2) at y (main.cb562ea7df40e3f09b5f.bundle.js:2) at t.invokeTask [as invoke] (main.cb562ea7df40e3f09b5f.bundle.js:2) at u (main.cb562ea7df40e3f09b5f.bundle.js:2) O que pode ser ?
  3. Guilherme Costa Lopes

    Download de qualquer arquivo em angular 9

    component download(idArquivo: number): void { this.arquivosService.downloadArquivoOrcamento(idArquivo).subscribe( data => { const blob = new Blob([data.arquivo], { type: 'text/json; charset=utf-8' }); const url= window.URL.createObjectURL(blob); window.open(url); }, err => { console.error(err); } ) } Service import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { SERVER_API_URL } from 'app/app.constants'; import { Observable } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class ArquivosService { constructor( private http: HttpClient ) {} downloadArquivoOrcamento(id: number, tipo: string): Observable<any> { return this.http.get(SERVER_API_URL + '/api/orcamento-anexo/' + id, { responseType: 'blob', headers: new HttpHeaders().append('Content-Type', tipo) }); } } Retorno do backend Não retorna o arquivo conforme imagem anterior Dowload com erro Já pesquisei e fiz alguma alteração, mas não achei a solução. O que quero é simples. O arquivo vem do backend em bytesm nome e content-type. Só quero fazer o dowload. O que pode ser ?
  4. Estou fazendo assim: paginacao.service.ts import { Injectable, EventEmitter } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class PaginacaoService { public static modelo = new EventEmitter<any>(); public static primeiraPagina = new EventEmitter<any>(); public static paginaAnterior = new EventEmitter<any>(); public static proximaPagina = new EventEmitter<any>(); public static ultimaPagina = new EventEmitter<any>(); public static paginaAtual = new EventEmitter<any>(); public static totalPagina = new EventEmitter<any>(); public static totalRegistros = new EventEmitter<any>(); } paginacao.component.ts import { Component, OnInit } from '@angular/core'; import { PaginacaoService } from '../../../service/paginacao/paginacao.service'; @Component({ selector: 'app-paginacao', templateUrl: './paginacao.component.html', styleUrls: ['./paginacao.component.css'] }) export class PaginacaoComponent implements OnInit { /** * variáveis de paginação */ public totalPagina: number; public totalRegistros: number; public paginaAtual: number; public modelo: any; constructor( protected paginacaoService: PaginacaoService ) {} ngOnInit() { this.preencherVariaveisComponente(); } private preencherVariaveisComponente() { PaginacaoService.paginaAtual.subscribe( paginaAtual => { this.paginaAtual = paginaAtual; } ); } } paginacao.component.html Página <b>{{paginaAtual}}</b> de <b>{{totalPagina}}</b> - Total de Registros: <b>{{totalRegistros}}</b> A variável nunca é atualizada, mesmo o serviço trazer o valor, conforme imagem: Se preencho valor assim: this.paginaAtual = 1; PaginacaoService.paginaAtual.subscribe( paginaAtual => { this.paginaAtual = paginaAtual; } ); Funciona, mas se o valor vier pelo servico, conforme imagem, não funciona. O que pode ser ?
  5. Guilherme Costa Lopes

    Erro Ao Subir Projeto

    O que estou errando, não consegui encontrar o erro.dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd "> <!-- ONDE ESTÃO OS COMPONENTES DO SPRING (EX:@Controller, @Repository, @Service e @Component ) --> <context:component-scan base-package="br.com.netsoft" /> <!-- SEM ESSA TAG ELE NÃO RETORNA O JSON --> <mvc:annotation-driven /> <!-- SEM ESSA TAG NÃO CARREGA OS CSS/JS --> <mvc:default-servlet-handler /> <!-- GERENCIAMENTO DO JPA PELO SPRING --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitName" value="PERSISTENCE_UNIT" /> </bean> <!-- gerenciamento das transações --> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix"> <value>/WEB-INF/views/</value> </property> <property name="suffix"> <value>.html</value> </property> </bean> </beans>web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <display-name>DESIF</display-name> <servlet> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/dispatcher-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> </web-app>Log no console 01:19:05,602 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./desif.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./desif.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet from [Module "deployment.desif.war:main" from Service Module Loader] at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:1079) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:284) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet from [Module "deployment.desif.war:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93) at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:723) ... 6 more 01:19:05,608 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "desif.war")]) - failure description: { "WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./desif.UndertowDeploymentInfoService" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./desif.UndertowDeploymentInfoService: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet from [Module \"deployment.desif.war:main\" from Service Module Loader] Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet from [Module \"deployment.desif.war:main\" from Service Module Loader]"}, "WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./desif.UndertowDeploymentInfoService"], "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined }Servidor é Wildfly.Arquivo pom <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>br.com.netsoft</groupId> <artifactId>desif</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>war</packaging> <build> <finalName>desif</finalName> </build> <properties> <failOnMissingWebXml>false</failOnMissingWebXml> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <failOnMissingWebXml>false</failOnMissingWebXml> <java-version>1.8</java-version> <spring.version>5.0.0.RELEASE</spring.version> <org.aspectj-version>1.8.1</org.aspectj-version> <org.slf4j-version>1.6.6</org.slf4j-version> <!-- false - não precisa de XML --> <failOnMissingWebXml>false</failOnMissingWebXml> <!-- Thymeleaf --> <thymeleaf.version>3.0.3.RELEASE</thymeleaf.version> <!-- Thymeleaf - Layout Dialect --> <thymeleaf-layout-dialect.version>2.1.2</thymeleaf-layout-dialect.version> </properties> <repositories> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/libs-milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <dependencies> <!-- Métodos uteis para manipulação de String, métodos e etc --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.4</version> </dependency> <!-- Thymeleaf - Layout Dialect --> <dependency> <groupId>nz.net.ultraq.thymeleaf</groupId> <artifactId>thymeleaf-layout-dialect</artifactId> <version>${thymeleaf-layout-dialect.version}</version> </dependency> <!-- Thymeleaf - extras --> <dependency> <groupId>org.thymeleaf.extras</groupId> <artifactId>thymeleaf-extras-springsecurity4</artifactId> <version>3.0.1.RELEASE</version> </dependency> <!-- Thymeleaf --> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf</artifactId> <version>${thymeleaf.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring4</artifactId> <version>${thymeleaf.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <!-- Spring início --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>5.0.0.M4</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>2.0.0.M3</version> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> </dependency> <!-- Spring fim --> <!-- <dependency> --> <!-- <groupId>javax</groupId> --> <!-- <artifactId>javaee-api</artifactId> --> <!-- <scope>provided</scope> --> <!-- </dependency> --> <!-- AspectJ --> <!-- <dependency> --> <!-- <groupId>org.aspectj</groupId> --> <!-- <artifactId>aspectjrt</artifactId> --> <!-- <version>${org.aspectj-version}</version> --> <!-- </dependency> --> <!-- Logging início --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${org.slf4j-version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>${org.slf4j-version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>${org.slf4j-version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.15</version> <exclusions> <exclusion> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> </exclusion> <exclusion> <groupId>javax.jms</groupId> <artifactId>jms</artifactId> </exclusion> <exclusion> <groupId>com.sun.jdmk</groupId> <artifactId>jmxtools</artifactId> </exclusion> <exclusion> <groupId>com.sun.jmx</groupId> <artifactId>jmxri</artifactId> </exclusion> </exclusions> <scope>runtime</scope> </dependency> <!-- Logging fim --> <!-- @Inject --> <!-- <dependency> --> <!-- <groupId>javax.inject</groupId> --> <!-- <artifactId>javax.inject</artifactId> --> <!-- <version>1</version> --> <!-- </dependency> --> <!-- <dependency> --> <!-- <groupId>commons-dbcp</groupId> --> <!-- <artifactId>commons-dbcp</artifactId> --> <!-- <version>1.2.2</version> --> <!-- </dependency> --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.6.0.Final</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.1.0.Final</version> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version> </dependency> <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.7</version> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> </dependencies> </dependencyManagement> </project>
  6. Ao tentar iniciar uma página do sistema mostra este erro. Vou colocar os códigos: DAO package br.com.netsoft.desif.dao.endereco; import java.io.Serializable; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; import br.com.netsoft.desif.model.endereco.PaisEntity; public class PaisDao implements Serializable { private static final long serialVersionUID = 1402488530698938353L; final private String hql = " p FROM PaisEntity p "; EntityManager em; public List<PaisEntity> listarPaises() { StringBuilder hqlSelect = new StringBuilder(hql); final String query = "SELECT " + hqlSelect; Query querySelect = em.createQuery(query); @SuppressWarnings("unchecked") List<PaisEntity> resultList = querySelect.getResultList(); return resultList; } } ENTITY package br.com.netsoft.desif.model.endereco; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; public class PaisEntity implements Serializable { private static final long serialVersionUID = 7784827196506672790L; private Long id; private String descricao; @Id @Column(name = "pai_id") @SequenceGenerator(name = "enderecos.end_pais_pai_id_seq", sequenceName = "enderecos.end_pais_pai_id_seq", allocationSize = 1) @GeneratedValue(generator = "enderecos.end_pais_pai_id_seq", strategy = GenerationType.SEQUENCE) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(name = "pai_descricao") public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } } CONTROLLER package br.com.netsoft.desif.controler.endereco; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.faces.bean.ManagedBean; import br.com.netsoft.desif.dao.endereco.PaisDao; import br.com.netsoft.desif.model.endereco.PaisEntity; @ManagedBean(name = "paisControler") @RequestScoped public class PaisControler extends PaisEntity { private static final long serialVersionUID = -8396738159447021720L; private List<PaisEntity> paises; private PaisDao paisDao; public List<PaisEntity> getPaises() { if (paises == null) { return new ArrayList<PaisEntity>(); } return paises; } public void setPaises(List<PaisEntity> paises) { this.paises = paises; } @PostConstruct public void init() { System.out.println("Página inicial de países."); @SuppressWarnings("unused") List<PaisEntity> paisesBusca = paisDao.listarPaises(); ArrayList<PaisEntity> paises = (ArrayList<PaisEntity>) paisDao.listarPaises(); for (Iterator<?> iterator = paises.iterator(); iterator.hasNext();) { PaisEntity pais = (PaisEntity) iterator.next(); pais.setId(pais.getId()); pais.setDescricao(pais.getDescricao()); paises.add(pais); } this.setPaises(paises); } public String getMensagem() { return "Teste"; } } VISÃO <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Hello JSF!</title> </h:head> <h:body> #{paisControler.mensagem} <h:dataTable var="pais" value="#{paisControler.paises}"> <h:column headerText="Id"> <h:outputText value="#{pais.id}" /> </h:column> <h:column headerText="Year"> <h:outputText value="#{pais.descricao}" /> </h:column> </h:dataTable> </h:body> </html> Erro: mar 21, 2017 8:08:40 AM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException GRAVE: Error Rendering View[/public/index.xhtml] javax.el.ELException: /public/index.xhtml: Um erro ocorreu ao realizar a injeção de recurso no bean gerenciado paisControler at com.sun.faces.facelets.compiler.TextInstruction.write(TextInstruction.java:90) at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82) at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:443) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1441) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) Caused by: com.sun.faces.mgbean.ManagedBeanCreationException: Um erro ocorreu ao realizar a injeção de recurso no bean gerenciado paisControler at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:227) at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:103) at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) at com.sun.faces.el.ManagedBeanELResolv
  7. Guilherme Costa Lopes

    Erro WELD-000049 em jsf

    O que é este erro ?
  8. Guilherme Costa Lopes

    Campo Lista de um jsp

    Mas como fazer ? Pelo que entendi tenho que fazer no jsp. Tem alguma sugestão ?
  9. Guilherme Costa Lopes

    Campo Lista de um jsp

    Este campo é preenchido corretamente por uma consulta feita no DAO. O problema é que não está aceitando o objeto como nulo ou como o valor pelo ID. O campo da entidade é Estou com este erro do log do eclipse. O jsp está assim para este campo: Meu jsp O que pode ser ?
  10. Guilherme Costa Lopes

    Erro de mapeamento

    GRAVE: Servlet.service() for servlet [appServlet] in context with path [/extensao] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Professor is not mapped [ SELECT p FROM Professor p]] with root cause org.hibernate.hql.ast.QuerySyntaxException: Professor is not mapped [ SELECT p FROM Professor p] Classe Professor package br.newtonpaiva.extensao.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "tb_professor") public class Professor { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long cod_professor; private Long nom_nome; public Long getCod_professor() { return cod_professor; } public void setCod_professor(Long cod_professor) { this.cod_professor = cod_professor; } public Long getNom_nome() { return nom_nome; } public void setNom_nome(Long nom_nome) { this.nom_nome = nom_nome; } } Classe controller package br.newtonpaiva.extensao.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import br.newtonpaiva.extensao.model.Professor; import br.newtonpaiva.extensao.model.ProfessorRepository; @Controller @RequestMapping("professores") public class ProfessorController { @Autowired ProfessorRepository repository; @RequestMapping(method = RequestMethod.GET) public String index(Model model) { List<Professor> listaProfessores = repository.listar(); model.addAttribute("listaProfessores", listaProfessores); return "professores"; } } Classe Repository package br.newtonpaiva.extensao.model; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Repository; @Repository public class ProfessorRepository { @PersistenceContext private EntityManager manager; /** * Lista todos os professores */ @SuppressWarnings("unchecked") public List<Professor> listar() { return manager.createQuery("SELECT p FROM Professor p").getResultList(); } /** * Lista todos os professores por nome */ @SuppressWarnings("unchecked") public List<Professor> listarNome(String professor) { return manager.createQuery("SELECT p FROM Professor p WHERE p.nom_nome LIKE '%" + professor + "%' ") .getResultList(); } }
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.